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

Commit 5203a8b5 authored by Michael Wright's avatar Michael Wright
Browse files

Ensure WallpaperEngine has correct size information

Currently it's possible for the WallpaperManagerService to receive a
request to change the desired wallpaper size between when it attaches
to the WallpaperService and when the Engine attaches back to it. This
means that the Engine will be created with the prior dimensions and
won't receive the update. Check to see if we're in this state and
make note to update the Engine once it attaches to ensure that the
Engine always has the correct dimensions.

Bug: 10853302
Change-Id: I8d5cd3371b269dbb4c0ff2d75c68529b69028ae5
parent 4c6b2900
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -219,6 +219,8 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
        WallpaperData mWallpaper;
        IRemoteCallback mReply;

        boolean mDimensionsChanged = false;

        public WallpaperConnection(WallpaperInfo info, WallpaperData wallpaper) {
            mInfo = info;
            mWallpaper = wallpaper;
@@ -262,6 +264,14 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
        public void attachEngine(IWallpaperEngine engine) {
            synchronized (mLock) {
                mEngine = engine;
                if (mDimensionsChanged) {
                    try {
                        mEngine.setDesiredSize(mWallpaper.width, mWallpaper.height);
                    } catch (RemoteException e) {
                        Slog.w(TAG, "Failed to set wallpaper dimensions", e);
                    }
                    mDimensionsChanged = false;
                }
            }
        }

@@ -652,6 +662,11 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
                        } catch (RemoteException e) {
                        }
                        notifyCallbacksLocked(wallpaper);
                    } else if (wallpaper.connection.mService != null) {
                        // We've attached to the service but the engine hasn't attached back to us
                        // yet. This means it will be created with the previous dimensions, so we
                        // need to update it to the new dimensions once it attaches.
                        wallpaper.connection.mDimensionsChanged = true;
                    }
                }
            }