Skip to content

Commit 4b27125

Browse files
Jean-Baptiste Queruandroid code review
authored andcommitted
Merge changes Ib28636e6,I93ebc433
* changes: WallpaperManagerService does not properly propagate setDimensionHints() ImageWallpaper : get bitmap width before calc screen offset
2 parents 00f94e8 + 3d9a9d6 commit 4b27125

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

packages/SystemUI/src/com/android/systemui/ImageWallpaper.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,13 @@ void drawFrameLocked() {
282282
updateWallpaperLocked();
283283
}
284284

285+
if (mBackground == null) {
286+
// If we somehow got to this point after we have last flushed
287+
// the wallpaper, well we really need it to draw again. So
288+
// seems like we need to reload it. Ouch.
289+
updateWallpaperLocked();
290+
}
291+
285292
SurfaceHolder sh = getSurfaceHolder();
286293
final Rect frame = sh.getSurfaceFrame();
287294
final int dw = frame.width();
@@ -303,13 +310,6 @@ void drawFrameLocked() {
303310
mLastXTranslation = xPixels;
304311
mLastYTranslation = yPixels;
305312

306-
if (mBackground == null) {
307-
// If we somehow got to this point after we have last flushed
308-
// the wallpaper, well we really need it to draw again. So
309-
// seems like we need to reload it. Ouch.
310-
updateWallpaperLocked();
311-
}
312-
313313
if (mIsHwAccelerated) {
314314
if (!drawWallpaperWithOpenGL(sh, availw, availh, xPixels, yPixels)) {
315315
drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels);

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)