Skip to content

Commit 0afddcb

Browse files
author
Craig Mautner
committed
Fix wallpaper exposure bugs.
Qualify the test for wallpaper animation to exclude the dummy animation. This keeps us from treating a dummy-animating wallpaper as an exiting wallpaper and providing the wrong animation. Hide wallpapers when the wallpaper target window is hidden. This fixes a timing issue where the wallpaper was exposed for one pass through performLayout after the launcher was hidden. Fixes bug 6454992. Change-Id: Ib4f9205c01a37e6f48f1f93ddcf2476e40ff942f
1 parent 989c753 commit 0afddcb

File tree

3 files changed

+43
-23
lines changed

3 files changed

+43
-23
lines changed

services/java/com/android/server/wm/WindowAnimator.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ public class WindowAnimator {
8585
mPolicy = policy;
8686
}
8787

88+
void hideWallpapersLocked() {
89+
for (final WindowToken token : mService.mWallpaperTokens) {
90+
for (final WindowState wallpaper : token.windows) {
91+
wallpaper.mWinAnimator.hide();
92+
}
93+
token.hidden = true;
94+
}
95+
}
96+
8897
private void testWallpaperAndBackgroundLocked() {
8998
if (mWindowDetachedWallpaper != mDetachedWallpaper) {
9099
if (WindowManagerService.DEBUG_WALLPAPER) Slog.v(TAG,

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3825,7 +3825,8 @@ public void prepareAppTransition(int transit, boolean alwaysKeepCurrent) {
38253825
synchronized(mWindowMap) {
38263826
if (DEBUG_APP_TRANSITIONS) Slog.v(
38273827
TAG, "Prepare app transition: transit=" + transit
3828-
+ " mNextAppTransition=" + mNextAppTransition);
3828+
+ " mNextAppTransition=" + mNextAppTransition
3829+
+ "\nCallers=" + Debug.getCallers(3));
38293830
if (okToDisplay()) {
38303831
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET
38313832
|| mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
@@ -4237,7 +4238,7 @@ public void setAppVisibility(IBinder token, boolean visible) {
42374238
e = new RuntimeException();
42384239
e.fillInStackTrace();
42394240
}
4240-
Slog.v(TAG, "setAppVisibility(" + token + ", " + visible
4241+
Slog.v(TAG, "setAppVisibility(" + token + ", visible=" + visible
42414242
+ "): mNextAppTransition=" + mNextAppTransition
42424243
+ " hidden=" + wtoken.hidden
42434244
+ " hiddenRequested=" + wtoken.hiddenRequested, e);
@@ -7866,8 +7867,10 @@ public int handleAppTransitionReadyLocked() {
78667867
mToTopApps.clear();
78677868
}
78687869

7870+
// if wallpaper is animating in or out set oldWallpaper to null else to wallpaper
78697871
WindowState oldWallpaper =
78707872
mWallpaperTarget != null && mWallpaperTarget.mWinAnimator.isAnimating()
7873+
&& !mWallpaperTarget.mWinAnimator.isDummyAnimation()
78717874
? null : mWallpaperTarget;
78727875

78737876
adjustWallpaperWindowsLocked();

services/java/com/android/server/wm/WindowStateAnimator.java

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ boolean isAnimating() {
177177
|| atoken.inPendingTransaction));
178178
}
179179

180+
/** Is the window animating the DummyAnimation? */
181+
boolean isDummyAnimation() {
182+
final AppWindowToken atoken = mWin.mAppToken;
183+
return atoken != null
184+
&& atoken.mAppAnimator.animation == AppWindowAnimator.sDummyAnimation;
185+
}
186+
180187
/** Is this window currently animating? */
181188
boolean isWindowAnimating() {
182189
return mAnimation != null;
@@ -363,19 +370,33 @@ void finishExit() {
363370
mWin.mDestroying = true;
364371
if (WindowState.SHOW_TRANSACTIONS) WindowManagerService.logSurface(
365372
mWin, "HIDE (finishExit)", null);
366-
mSurfaceShown = false;
367-
try {
368-
mSurface.hide();
369-
} catch (RuntimeException e) {
370-
Slog.w(TAG, "Error hiding surface in " + this, e);
371-
}
372-
mLastHidden = true;
373+
hide();
373374
}
374375
mWin.mExiting = false;
375376
if (mWin.mRemoveOnExit) {
376377
mService.mPendingRemove.add(mWin);
377378
mWin.mRemoveOnExit = false;
378379
}
380+
if (mService.mWallpaperTarget == mWin) {
381+
mAnimator.hideWallpapersLocked();
382+
}
383+
}
384+
385+
void hide() {
386+
if (!mLastHidden) {
387+
//dump();
388+
mLastHidden = true;
389+
if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(mWin,
390+
"HIDE (performLayout)", null);
391+
if (mSurface != null) {
392+
mSurfaceShown = false;
393+
try {
394+
mSurface.hide();
395+
} catch (RuntimeException e) {
396+
Slog.w(TAG, "Exception hiding surface in " + mWin);
397+
}
398+
}
399+
}
379400
}
380401

381402
boolean finishDrawingLocked() {
@@ -983,20 +1004,7 @@ public void prepareSurfaceLocked(final boolean recoveringMemory) {
9831004
setSurfaceBoundaries(recoveringMemory);
9841005

9851006
if (w.mAttachedHidden || !w.isReadyForDisplay()) {
986-
if (!mLastHidden) {
987-
//dump();
988-
mLastHidden = true;
989-
if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
990-
"HIDE (performLayout)", null);
991-
if (mSurface != null) {
992-
mSurfaceShown = false;
993-
try {
994-
mSurface.hide();
995-
} catch (RuntimeException e) {
996-
Slog.w(TAG, "Exception hiding surface in " + w);
997-
}
998-
}
999-
}
1007+
hide();
10001008
// If we are waiting for this window to handle an
10011009
// orientation change, well, it is hidden, so
10021010
// doesn't really matter. Note that this does

0 commit comments

Comments
 (0)