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

Commit 78268c3b authored by wilsonshih's avatar wilsonshih
Browse files

A quick fix for fallback wallpaper connection NPE.

This is a quick fix for system service crash in WallpaperManagerService
due to I didn't consider what to do if SystemUI crash or bind
ImageWallpaper failed.

Bug: 121181553
Test: Mojave boot up.
Change-Id: Ie47d9a8fdcc4140a218c5c37f566e3c2a53fb691
parent 66daf214
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -900,12 +900,21 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
        if (mLastWallpaper == null || mFallbackWallpaper == null) return;
        final WallpaperConnection systemConnection = mLastWallpaper.connection;
        final WallpaperConnection fallbackConnection = mFallbackWallpaper.connection;
        if (fallbackConnection == null) {
            Slog.w(TAG, "Fallback wallpaper connection has not been created yet!!");
            return;
        }
        if (supportsMultiDisplay(systemConnection)
                && fallbackConnection.getConnectedEngineSize() != 0) {
            fallbackConnection.forEachDisplayConnector(
                    WallpaperConnection.DisplayConnector::disconnectLocked);
            fallbackConnection.mDisplayConnector.clear();
        } else {
            // TODO(b/121181553) Handle wallpaper service disconnect case.
            if (fallbackConnection.mService == null) {
                Slog.w(TAG, "There is no fallback wallpaper service");
                return;
            }
            fallbackConnection.appendConnectorWithCondition(display ->
                    fallbackConnection.isUsableDisplay(display)
                            && display.getDisplayId() != DEFAULT_DISPLAY