Skip to content

Commit 79b7742

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Fix wallpaper exposure bugs." into jb-dev
2 parents a3b6728 + 0afddcb commit 79b7742

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() {
@@ -987,20 +1008,7 @@ public void prepareSurfaceLocked(final boolean recoveringMemory) {
9871008
setSurfaceBoundaries(recoveringMemory);
9881009

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

0 commit comments

Comments
 (0)