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

Commit 1d4ddacc authored by abdelrahmani's avatar abdelrahmani
Browse files

Stop WPMS from trying to rebind to a disconnected wallpaper service

To prevent the cases where the connection is switched while the
disconnection runnable is running waiting for the lock.

Bug: 332871851
Flag: com.android.window.flags.avoid_rebinding_intentionally_disconnected_wallpaper
Test: atest WallpaperManagerTest

Change-Id: I3d68d3caae740305e1f2ee88f8bace44465a6462
parent 30c41f95
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -49,3 +49,13 @@ flag {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "avoid_rebinding_intentionally_disconnected_wallpaper"
  namespace: "systemui"
  description: "Prevents rebinding with intentionally disconnected wallpaper services."
  bug: "332871851"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
+14 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import static com.android.server.wallpaper.WallpaperUtils.WALLPAPER_INFO;
import static com.android.server.wallpaper.WallpaperUtils.WALLPAPER_LOCK_ORIG;
import static com.android.server.wallpaper.WallpaperUtils.getWallpaperDir;
import static com.android.server.wallpaper.WallpaperUtils.makeWallpaperIdLocked;
import static com.android.window.flags.Flags.avoidRebindingIntentionallyDisconnectedWallpaper;
import static com.android.window.flags.Flags.multiCrop;
import static com.android.window.flags.Flags.offloadColorExtraction;

@@ -897,6 +898,12 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                    return;
                }

                if (avoidRebindingIntentionallyDisconnectedWallpaper()
                        && mWallpaper.connection == null) {
                    Slog.w(TAG, "Trying to reset an intentionally disconnected wallpaper!");
                    return;
                }

                if (!mWallpaper.wallpaperUpdating && mWallpaper.userId == mCurrentUserId) {
                    Slog.w(TAG, "Wallpaper reconnect timed out for " + mWallpaper.wallpaperComponent
                            + ", reverting to built-in wallpaper!");
@@ -1066,6 +1073,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                if (mWallpaper.wallpaperUpdating) {
                    return;
                }

                if (avoidRebindingIntentionallyDisconnectedWallpaper()
                        && mWallpaper.connection == null) {
                    Slog.w(TAG, "Trying to rebind an intentionally disconnected wallpaper!");
                    return;
                }

                final ComponentName wpService = mWallpaper.wallpaperComponent;
                // The broadcast of package update could be delayed after service disconnected. Try
                // to re-bind the service for 10 seconds.