Skip to content

Commit 3db86b6

Browse files
Craig MautnerAndroid Git Automerger
authored andcommitted
am f93afcd: am 27c0773: Merge "Fix wallpaper not updating on initial boot." into jb-mr1-dev
* commit 'f93afcde559ac370fcff384527a85e762a26673a': Fix wallpaper not updating on initial boot.
2 parents c9579ce + f93afcd commit 3db86b6

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

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

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public void onReceive(Context context, Intent intent) {
156156
mBackgroundWidth = mBackgroundHeight = -1;
157157
mBackground = null;
158158
mRedrawNeeded = true;
159-
drawFrameLocked();
159+
drawFrameLocked(false);
160160
}
161161
}
162162
}
@@ -234,7 +234,7 @@ public void onVisibilityChanged(boolean visible) {
234234
Log.d(TAG, "Visibility changed to visible=" + visible);
235235
}
236236
mVisible = visible;
237-
drawFrameLocked();
237+
drawFrameLocked(false);
238238
}
239239
}
240240
}
@@ -263,7 +263,7 @@ public void onOffsetsChanged(float xOffset, float yOffset,
263263
mYOffset = yOffset;
264264
mOffsetsChanged = true;
265265
}
266-
drawFrameLocked();
266+
drawFrameLocked(false);
267267
}
268268
}
269269

@@ -277,7 +277,8 @@ public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int he
277277

278278
synchronized (mLock) {
279279
mRedrawNeeded = true;
280-
drawFrameLocked();
280+
mBackgroundWidth = mBackgroundHeight = -1;
281+
drawFrameLocked(true);
281282
}
282283
}
283284

@@ -290,25 +291,26 @@ public void onSurfaceRedrawNeeded(SurfaceHolder holder) {
290291

291292
synchronized (mLock) {
292293
mRedrawNeeded = true;
293-
drawFrameLocked();
294+
drawFrameLocked(false);
294295
}
295296
}
296297

297-
void drawFrameLocked() {
298-
if (!mVisible) {
299-
if (DEBUG) {
300-
Log.d(TAG, "Suppressed drawFrame since wallpaper is not visible.");
298+
void drawFrameLocked(boolean force) {
299+
if (!force) {
300+
if (!mVisible) {
301+
if (DEBUG) {
302+
Log.d(TAG, "Suppressed drawFrame since wallpaper is not visible.");
303+
}
304+
return;
301305
}
302-
return;
303-
}
304-
if (!mRedrawNeeded && !mOffsetsChanged) {
305-
if (DEBUG) {
306-
Log.d(TAG, "Suppressed drawFrame since redraw is not needed "
307-
+ "and offsets have not changed.");
306+
if (!mRedrawNeeded && !mOffsetsChanged) {
307+
if (DEBUG) {
308+
Log.d(TAG, "Suppressed drawFrame since redraw is not needed "
309+
+ "and offsets have not changed.");
310+
}
311+
return;
308312
}
309-
return;
310313
}
311-
312314
// If we don't yet know the size of the wallpaper bitmap,
313315
// we need to get it now.
314316
boolean updateWallpaper = mBackgroundWidth < 0 || mBackgroundHeight < 0 ;
@@ -332,7 +334,8 @@ void drawFrameLocked() {
332334
int yPixels = availh < 0 ? (int)(availh * mYOffset + .5f) : (availh / 2);
333335

334336
mOffsetsChanged = false;
335-
if (!mRedrawNeeded && xPixels == mLastXTranslation && yPixels == mLastYTranslation) {
337+
if (!force && !mRedrawNeeded
338+
&& xPixels == mLastXTranslation && yPixels == mLastYTranslation) {
336339
if (DEBUG) {
337340
Log.d(TAG, "Suppressed drawFrame since the image has not "
338341
+ "actually moved an integral number of pixels.");
@@ -343,6 +346,11 @@ void drawFrameLocked() {
343346
mLastXTranslation = xPixels;
344347
mLastYTranslation = yPixels;
345348

349+
if (DEBUG) {
350+
Log.d(TAG, "drawFrameUnlocked(" + force + "): mBackgroundWxH=" + mBackgroundWidth + "x"
351+
+ mBackgroundHeight + " SurfaceFrame=" + frame.toShortString()
352+
+ " X,YOffset=" + mXOffset + "," + mYOffset);
353+
}
346354
if (mIsHwAccelerated) {
347355
if (!drawWallpaperWithOpenGL(sh, availw, availh, xPixels, yPixels)) {
348356
drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels);

0 commit comments

Comments
 (0)