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

Commit 9a488346 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Clean up flag android.app.remove_next_wallpaper_component" into main

parents 37d324a5 84c6a44c
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
package: "android.app"
container: "system"

flag {
  name: "remove_next_wallpaper_component"
  namespace: "systemui"
  description: "Remove deprecated field WallpaperData#nextWallpaperComponent. Only effective after rebooting."
  bug: "365991991"
}

flag {
  name: "fix_wallpaper_changed"
  namespace: "systemui"
+0 −8
Original line number Diff line number Diff line
@@ -93,14 +93,6 @@ class WallpaperData {
     */
    private ComponentName mWallpaperComponent;

    // TODO(b/347235611) Remove this field
    /**
     * The component name of the wallpaper that should be set next.
     *
     * @deprecated
     */
    ComponentName nextWallpaperComponent;

    /**
     * The ID of this wallpaper
     */
+2 −12
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.server.wallpaper;

import static android.app.Flags.liveWallpaperContentHandling;
import static android.app.Flags.removeNextWallpaperComponent;
import static android.app.WallpaperManager.FLAG_LOCK;
import static android.app.WallpaperManager.FLAG_SYSTEM;
import static android.app.WallpaperManager.ORIENTATION_UNKNOWN;
@@ -246,11 +245,7 @@ public class WallpaperDataParser {

                    ComponentName comp = parseComponentName(parser);
                    if (!liveWallpaperContentHandling()) {
                        if (removeNextWallpaperComponent()) {
                        wallpaperToParse.setComponent(comp);
                        } else {
                            wallpaperToParse.nextWallpaperComponent = comp;
                        }
                    }
                    if (multiCrop()) {
                        parseWallpaperAttributes(parser, wallpaperToParse, keepDimensionHints);
@@ -262,12 +257,7 @@ public class WallpaperDataParser {
                        Slog.v(TAG, "cropRect:" + wallpaper.cropHint);
                        Slog.v(TAG, "primaryColors:" + wallpaper.primaryColors);
                        Slog.v(TAG, "mName:" + wallpaper.name);
                        if (removeNextWallpaperComponent()) {
                        Slog.v(TAG, "mWallpaperComponent:" + wallpaper.getComponent());
                        } else {
                            Slog.v(TAG, "mNextWallpaperComponent:"
                                    + wallpaper.nextWallpaperComponent);
                        }
                    }
                }
            }
+4 −48
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import static android.app.Flags.fixGetBitmapCrops;
import static android.app.Flags.fixWallpaperChanged;
import static android.app.Flags.liveWallpaperContentHandling;
import static android.app.Flags.notifyKeyguardEvents;
import static android.app.Flags.removeNextWallpaperComponent;
import static android.app.Flags.updateRecentsFromSystem;
import static android.app.WallpaperManager.COMMAND_REAPPLY;
import static android.app.WallpaperManager.FLAG_LOCK;
@@ -82,7 +81,6 @@ import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageManagerInternal;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
@@ -1630,16 +1628,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                    }
                }
            }
            if (!removeNextWallpaperComponent()) {
                if (wallpaper.nextWallpaperComponent != null) {
                    int change = isPackageDisappearing(wallpaper.nextWallpaperComponent
                            .getPackageName());
                    if (change == PACKAGE_PERMANENT_CHANGE
                            || change == PACKAGE_TEMPORARY_CHANGE) {
                        wallpaper.nextWallpaperComponent = null;
                    }
                }
            }
            if (wallpaper.getComponent() != null
                    && isPackageModified(wallpaper.getComponent().getPackageName())) {
                ServiceInfo serviceInfo = null;
@@ -1656,19 +1644,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                    clearWallpaperLocked(wallpaper.mWhich, wallpaper.userId, false, null);
                }
            }
            if (!removeNextWallpaperComponent()) {
                if (wallpaper.nextWallpaperComponent != null
                        && isPackageModified(wallpaper.nextWallpaperComponent.getPackageName())) {
                    try {
                        mContext.getPackageManager().getServiceInfo(
                                wallpaper.nextWallpaperComponent,
                                PackageManager.MATCH_DIRECT_BOOT_AWARE
                                        | PackageManager.MATCH_DIRECT_BOOT_UNAWARE);
                    } catch (NameNotFoundException e) {
                        wallpaper.nextWallpaperComponent = null;
                    }
                }
            }
            return changed;
        }
    }
@@ -1823,13 +1798,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
        WallpaperData wallpaper = mWallpaperMap.get(UserHandle.USER_SYSTEM);
        // If we think we're going to be using the system image wallpaper imagery, make
        // sure we have something to render
        boolean isImageComponent;
        if (removeNextWallpaperComponent()) {
            isImageComponent = wallpaper.getComponent() == null
        boolean isImageComponent = wallpaper.getComponent() == null
                || mImageWallpaper.equals(wallpaper.getComponent());
        } else {
            isImageComponent = mImageWallpaper.equals(wallpaper.nextWallpaperComponent);
        }
        if (isImageComponent) {
            // No crop file? Make sure we've finished the processing sequence if necessary
            if (!wallpaper.cropExists()) {
@@ -2102,13 +2072,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                return;
            }

            final ComponentName cname;
            if (removeNextWallpaperComponent()) {
                cname = wallpaper.getComponent();
            } else {
                cname = (wallpaper.getComponent() != null)
                        ? wallpaper.getComponent() : wallpaper.nextWallpaperComponent;
            }
            final ComponentName cname = wallpaper.getComponent();
            if (!bindWallpaperComponentLocked(cname, true, false, wallpaper, reply)) {
                // We failed to bind the desired wallpaper, but that might
                // happen if the wallpaper isn't direct-boot aware
@@ -2135,12 +2099,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
            return;
        }
        Slog.w(TAG, "Wallpaper isn't direct boot aware; using fallback until unlocked");
        if (!removeNextWallpaperComponent()) {
            // We might end up persisting the current wallpaper data
            // while locked, so pretend like the component was actually
            // bound into place
            wallpaper.setComponent(wallpaper.nextWallpaperComponent);
        }
        final WallpaperData fallback = new WallpaperData(wallpaper.userId, wallpaper.mWhich);

        // files from the previous static wallpaper may still be stored in memory.
@@ -4413,9 +4371,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
            wallpaper = mWallpaperMap.get(UserHandle.USER_SYSTEM);
            wallpaper.wallpaperId = makeWallpaperIdLocked();    // always bump id at restore
            wallpaper.allowBackup = true;   // by definition if it was restored
            ComponentName componentName =
                    removeNextWallpaperComponent() ? wallpaper.getComponent()
                            : wallpaper.nextWallpaperComponent;
            ComponentName componentName = wallpaper.getComponent();

            if (liveWallpaperContentHandling()) {
                // Per b/373875373 this method should be removed, so we just set wallpapers to
+2 −32
Original line number Diff line number Diff line
@@ -507,8 +507,7 @@ public class WallpaperManagerServiceTests {
    }

    @Test
    @EnableFlags({Flags.FLAG_REMOVE_NEXT_WALLPAPER_COMPONENT,
            Flags.FLAG_LIVE_WALLPAPER_CONTENT_HANDLING})
    @EnableFlags(Flags.FLAG_LIVE_WALLPAPER_CONTENT_HANDLING)
    public void testSaveLoadSettings_withoutWallpaperDescription()
            throws IOException, XmlPullParserException {
        WallpaperData expectedData = mService.getCurrentWallpaperData(FLAG_SYSTEM, 0);
@@ -548,8 +547,7 @@ public class WallpaperManagerServiceTests {
    }

    @Test
    @EnableFlags({Flags.FLAG_REMOVE_NEXT_WALLPAPER_COMPONENT,
            Flags.FLAG_LIVE_WALLPAPER_CONTENT_HANDLING})
    @EnableFlags(Flags.FLAG_LIVE_WALLPAPER_CONTENT_HANDLING)
    public void testSaveLoadSettings_withWallpaperDescription()
            throws IOException, XmlPullParserException {
        WallpaperData expectedData = mService.getCurrentWallpaperData(FLAG_SYSTEM, 0);
@@ -580,34 +578,6 @@ public class WallpaperManagerServiceTests {
        assertThat(actualData.getDescription()).isEqualTo(expectedData.getDescription());
    }

    @Test
    @DisableFlags({Flags.FLAG_REMOVE_NEXT_WALLPAPER_COMPONENT,
            Flags.FLAG_LIVE_WALLPAPER_CONTENT_HANDLING})
    public void testSaveLoadSettings_legacyNextComponent()
            throws IOException, XmlPullParserException {
        WallpaperData systemWallpaperData = mService.getCurrentWallpaperData(FLAG_SYSTEM, 0);
        systemWallpaperData.setComponent(sDefaultWallpaperComponent);
        ByteArrayOutputStream ostream = new ByteArrayOutputStream();
        TypedXmlSerializer serializer = Xml.newBinarySerializer();
        serializer.setOutput(ostream, StandardCharsets.UTF_8.name());
        mService.mWallpaperDataParser.saveSettingsToSerializer(serializer, systemWallpaperData,
                null);
        ostream.close();

        WallpaperData shouldMatchSystem = new WallpaperData(0, FLAG_SYSTEM);
        ByteArrayInputStream istream = new ByteArrayInputStream(ostream.toByteArray());
        TypedXmlPullParser parser = Xml.newBinaryPullParser();
        parser.setInput(istream, StandardCharsets.UTF_8.name());
        mService.mWallpaperDataParser.loadSettingsFromSerializer(parser,
                shouldMatchSystem, /* userId= */0, /* loadSystem= */ true, /* loadLock= */
                false, /* keepDimensionHints= */ true,
                new WallpaperDisplayHelper.DisplayData(0));

        assertThat(shouldMatchSystem.nextWallpaperComponent).isEqualTo(
                systemWallpaperData.getComponent());
        assertThat(shouldMatchSystem.primaryColors).isEqualTo(systemWallpaperData.primaryColors);
    }

    @Test
    @Ignore("b/372942682")
    public void testWallpaperManagerCallbackInRightOrder() throws RemoteException {