Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe2f1f78 authored by Aurélien Pomini's avatar Aurélien Pomini
Browse files

Move xml & loading logic to a new class

Part of the WallpaperManagerService refactor

Test: treehugger
Test: atest CtsWallpaperTestCases
Test: atest FrameworksMockingServicesTests:WallpaperManagerServiceTests
Bug: 264637309

Change-Id: I27d34fed6e15e9e6bf6995f48f11f906a381330d
parent 51a6e414
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import android.app.WallpaperManager.SetWallpaperFlags;
import android.content.ComponentName;
import android.graphics.Rect;
import android.os.RemoteCallbackList;
import android.util.ArrayMap;
import android.util.SparseArray;

import java.io.File;

@@ -115,7 +115,7 @@ class WallpaperData {
     * A map to keep track of the dimming set by different applications. The key is the calling
     * UID and the value is the dim amount.
     */
    ArrayMap<Integer, Float> mUidToDimAmount = new ArrayMap<>();
    SparseArray<Float> mUidToDimAmount = new SparseArray<>();

    /**
     * Whether we need to extract the wallpaper colors again to calculate the dark hints
+550 −0

File added.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.view.DisplayInfo;
import com.android.server.wm.WindowManagerInternal;

import java.util.function.Consumer;

/**
 * Internal class used to store all the display data relevant to the wallpapers
 */
+24 −447

File changed.

Preview size limit exceeded, changes collapsed.

+3 −3
Original line number Diff line number Diff line
@@ -200,7 +200,6 @@ public class WallpaperManagerServiceTests {
    @Before
    public void setUp() {
        MockitoAnnotations.initMocks(this);

        ExtendedMockito.doAnswer(invocation -> {
            int userId = (invocation.getArgument(0));
            return getWallpaperTestDir(userId);
@@ -398,7 +397,8 @@ public class WallpaperManagerServiceTests {
            TypedXmlSerializer serializer = Xml.newBinarySerializer();
            serializer.setOutput(new ByteArrayOutputStream(), StandardCharsets.UTF_8.name());
            serializer.startDocument(StandardCharsets.UTF_8.name(), true);
            mService.writeWallpaperAttributes(serializer, "wp", systemWallpaperData);
            mService.mWallpaperDataParser.writeWallpaperAttributes(
                    serializer, "wp", systemWallpaperData);
        } catch (IOException e) {
            fail("exception occurred while writing system wallpaper attributes");
        }
@@ -409,7 +409,7 @@ public class WallpaperManagerServiceTests {
                systemWallpaperData.cropFile.getAbsolutePath());
        try {
            TypedXmlPullParser parser = Xml.newBinaryPullParser();
            mService.parseWallpaperAttributes(parser, shouldMatchSystem, true);
            mService.mWallpaperDataParser.parseWallpaperAttributes(parser, shouldMatchSystem, true);
        } catch (XmlPullParserException e) {
            fail("exception occurred while parsing wallpaper");
        }