Skip to content

Commit 47adf86

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Fix exposing wallpaper on rotations and other." into jb-dev
2 parents 0f6471a + b9836b9 commit 47adf86

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,19 @@ 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();
88+
void hideWallpapersLocked(final WindowState w) {
89+
if ((mService.mWallpaperTarget == w && mService.mLowerWallpaperTarget == null)
90+
|| mService.mWallpaperTarget == null) {
91+
for (final WindowToken token : mService.mWallpaperTokens) {
92+
for (final WindowState wallpaper : token.windows) {
93+
final WindowStateAnimator winAnimator = wallpaper.mWinAnimator;
94+
if (!winAnimator.mLastHidden) {
95+
winAnimator.hide();
96+
mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
97+
}
98+
}
99+
token.hidden = true;
92100
}
93-
token.hidden = true;
94101
}
95102
}
96103

@@ -491,6 +498,10 @@ synchronized void animate() {
491498
for (int i = 0; i < N; i++) {
492499
final WindowStateAnimator winAnimator = mWinAnimators.get(i);
493500
if (winAnimator.mWin.mIsWallpaper && mService.mWallpaperTarget == null) {
501+
if (!winAnimator.mWin.mWallpaperVisible && !winAnimator.mLastHidden) {
502+
// Wallpaper is no longer visible and there is no wp target => hide it.
503+
winAnimator.hide();
504+
}
494505
continue;
495506
}
496507
winAnimator.prepareSurfaceLocked(true);

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import android.graphics.Rect;
1717
import android.graphics.Region;
1818
import android.os.Debug;
19-
import android.os.RemoteException;
2019
import android.util.Slog;
2120
import android.view.Surface;
2221
import android.view.SurfaceSession;
@@ -379,10 +378,7 @@ void finishExit() {
379378
mService.mPendingRemove.add(mWin);
380379
mWin.mRemoveOnExit = false;
381380
}
382-
if (mService.mWallpaperTarget == mWin && mService.mLowerWallpaperTarget == null) {
383-
mAnimator.hideWallpapersLocked();
384-
mAnimator.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
385-
}
381+
mAnimator.hideWallpapersLocked(mWin);
386382
}
387383

388384
void hide() {
@@ -738,6 +734,7 @@ void destroySurfaceLocked() {
738734
}
739735
mSurface.destroy();
740736
}
737+
mAnimator.hideWallpapersLocked(mWin);
741738
} catch (RuntimeException e) {
742739
Slog.w(TAG, "Exception thrown when destroying Window " + this
743740
+ " surface " + mSurface + " session " + mSession
@@ -763,6 +760,7 @@ void destroyDeferredSurfaceLocked() {
763760
WindowManagerService.logSurface(mWin, "DESTROY PENDING", e);
764761
}
765762
mPendingDestroySurface.destroy();
763+
mAnimator.hideWallpapersLocked(mWin);
766764
}
767765
} catch (RuntimeException e) {
768766
Slog.w(TAG, "Exception thrown when destroying Window "
@@ -1067,11 +1065,8 @@ public void prepareSurfaceLocked(final boolean recoveringMemory) {
10671065

10681066
if (w.mAttachedHidden || !w.isReadyForDisplay()) {
10691067
hide();
1070-
// TODO: Consider moving the following into hide() and out of finishExit() as well.
1071-
if (mService.mWallpaperTarget == mWin && mService.mLowerWallpaperTarget == null) {
1072-
mAnimator.hideWallpapersLocked();
1073-
mAnimator.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
1074-
}
1068+
mAnimator.hideWallpapersLocked(w);
1069+
10751070
// If we are waiting for this window to handle an
10761071
// orientation change, well, it is hidden, so
10771072
// doesn't really matter. Note that this does

0 commit comments

Comments
 (0)