Skip to content

Commit 3d9a9d6

Browse files
author
SangWook Han
committed
WallpaperManagerService does not properly propagate setDimensionHints()
During bootstrap, Launcher could be initialized in between WallpaperManagerService and ImageWallpaper. In case Launcher's WindowManager.suggestDesiredDimenstions() is called after WallpaperManagerService begin to create ImageWallpaper and before ImageWallpaper Engine attached, that mostly resulted in Black Edge of image wallpaper. This can be reproduced easily (1 in 3) - set image wallpaper other than default. - modify Launcher/Workspace to call suggestDesiredDimenstions(w,h) - reboot To fix Black Edge, WallpaperManagerService modified to maintain a flag mDesiredDimensionChanging and set desired size at Engine attach. Black Edge still can be shown for some moment. but, always recoverd. To eliminate Black Edge it seems that IWallpaperConnection.aidl need more method. NOTE: Many market launcher and some phone vendor launcher call suggestDesiredDimenstions with argument (w,h) instead aosp's original (w*2,h) for single page wallpaper. Change-Id: Ib28636e6b2964d9deeee1f1e1d304554cc7a837e
1 parent 2b1bcca commit 3d9a9d6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

services/java/com/android/server/WallpaperManagerService.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public void onEvent(int event, String path) {
169169
WallpaperConnection mWallpaperConnection;
170170
long mLastDiedTime;
171171
boolean mWallpaperUpdating;
172+
boolean mDesiredDimensionChanging;
172173

173174
class WallpaperConnection extends IWallpaperConnection.Stub
174175
implements ServiceConnection {
@@ -213,6 +214,13 @@ public void onServiceDisconnected(ComponentName name) {
213214

214215
public void attachEngine(IWallpaperEngine engine) {
215216
mEngine = engine;
217+
if (engine != null && mDesiredDimensionChanging) {
218+
try {
219+
engine.setDesiredSize(mWidth, mHeight);
220+
mDesiredDimensionChanging = false;
221+
} catch (RemoteException e) {
222+
}
223+
}
216224
}
217225

218226
public ParcelFileDescriptor setWallpaper(String name) {
@@ -395,6 +403,7 @@ public void setDimensionHints(int width, int height) throws RemoteException {
395403

396404
synchronized (mLock) {
397405
if (width != mWidth || height != mHeight) {
406+
boolean desiredDimensionPropagated = false;
398407
mWidth = width;
399408
mHeight = height;
400409
saveSettingsLocked();
@@ -403,11 +412,15 @@ public void setDimensionHints(int width, int height) throws RemoteException {
403412
try {
404413
mWallpaperConnection.mEngine.setDesiredSize(
405414
width, height);
415+
desiredDimensionPropagated = true;
406416
} catch (RemoteException e) {
407417
}
408418
notifyCallbacksLocked();
409419
}
410420
}
421+
if (!desiredDimensionPropagated) {
422+
mDesiredDimensionChanging = true;
423+
}
411424
}
412425
}
413426
}

0 commit comments

Comments
 (0)