summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tiger Huang <tigerhuang@google.com> 2018-05-25 22:57:52 +0800
committer Tiger Huang <tigerhuang@google.com> 2018-09-21 06:42:05 +0000
commitdf87af8bf18c1809adb2df39386fdff736bdfd92 (patch)
treebe6c2e30241a52a063cbed79e34f67651a5294f8
parent7c0e462b20b4a424f07f73260121864252f99fdc (diff)
Clear mDeferredHideWallpaper if wallpaper is being hidden
We defer wallpaper hiding while AppTransition.isRunning() is true. However, the state can be changed from 'running' to 'ready', which makes mDeferredHideWallpaper not to be cleared in time because handleAnimatingStoppedAndTransitionLocked() would not be called. When AppTransition is not in 'running' state (animations may be still running), the logic in WallpaperController.hideWallpapers() would start hiding wallpapers. However, before applying this patch, it can only hide the wallpaper surface in WindowState.hideWallpaperWindow(), but it cannot set the wallpaper to be invisible because mDeferredHideWallpaper is not cleared. These conditions cause that the WindowStateAnimator of wallpaper keeps showing the surface of wallpaper; the WindowStateAnimator of exiting window keeps hiding the surface of wallpaper frequently. Bug: 78681867 Bug: 80226677 Test: 1. Run monkey test for hours and see if there is any log like: "Performed 6 layouts in a row. Skipping" 2. Manually open/close activities rapidly and see if wallpaper becomes black. 3. go/wm-smoke Change-Id: I237fd1942d7365cb747534a21dc98edb076e0d80 Merged-In: I237fd1942d7365cb747534a21dc98edb076e0d80 (cherry picked from commit 50d4546567ecbd143344a75fcacfa15afb5c34d2)
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java6
-rw-r--r--services/core/java/com/android/server/wm/WindowStateAnimator.java7
2 files changed, 12 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index c797d8d35db2..799a1db03b08 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -87,6 +87,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_FOCUS;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_FOCUS_LIGHT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_INPUT_METHOD;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT;
+import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT_REPEATS;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ORIENTATION;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_POWER;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_RESIZE;
@@ -4210,10 +4211,15 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
}
if (!mWinAnimator.mLastHidden || wasDeferred) {
mWinAnimator.hide(reason);
+ getDisplayContent().mWallpaperController.mDeferredHideWallpaper = null;
dispatchWallpaperVisibility(false);
final DisplayContent displayContent = getDisplayContent();
if (displayContent != null) {
displayContent.pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER;
+ if (DEBUG_LAYOUT_REPEATS) {
+ mService.mWindowPlacerLocked.debugLayoutRepeats("hideWallpaperWindow " + this,
+ displayContent.pendingLayoutChanges);
+ }
}
}
}
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 3eef12540e7f..561c9de219da 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -1115,7 +1115,7 @@ class WindowStateAnimator {
setSurfaceBoundariesLocked(recoveringMemory);
- if (mIsWallpaper && !mWin.mWallpaperVisible) {
+ if (mIsWallpaper && !w.mWallpaperVisible) {
// Wallpaper is no longer visible and there is no wp target => hide it.
hide("prepareSurfaceLocked");
} else if (w.isParentWindowHidden() || !w.isOnScreen()) {
@@ -1179,6 +1179,11 @@ class WindowStateAnimator {
// LogicalDisplay.
mAnimator.setPendingLayoutChanges(w.getDisplayId(),
FINISH_LAYOUT_REDO_ANIM);
+ if (DEBUG_LAYOUT_REPEATS) {
+ mService.mWindowPlacerLocked.debugLayoutRepeats(
+ "showSurfaceRobustlyLocked " + w,
+ mAnimator.getPendingLayoutChanges(w.getDisplayId()));
+ }
} else {
w.setOrientationChanging(false);
}