summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author wilsonshih <wilsonshih@google.com> 2019-09-10 09:44:51 +0800
committer Wei Sheng Shih <wilsonshih@google.com> 2019-09-24 09:39:50 +0000
commit78e5542545acea33190fbe3b199a525a88faab90 (patch)
treec0d8adeae29cf8337c71469dace0c0a9a2b94221
parentc50ac5df2caddf4ba5f57b7e315c44684b9c50d5 (diff)
Check client hidden state before resetting draw state.
If there are more than activities switched to foreground very quickly, imagine like: A->B->A, in previous fix, if we found the resumed activity is hidden in server side, we will reset the drawing state. However, the resumed activity may be currently visible at client side, and since the previous transition may not have finished and we will clear the AppWindowToken in clearChangeLeash, this AppWindowToken may never receive onAnimationFinished callback, so the mClientHidden will stay in false. Since server side doesn't require client side to relayout, the allDraw state will remain in false, which will cause the second transition cannot start. Therefore, even when resumed activity idled, the stopping activity cannot be removed from processStoppingActivitiesLocked because isSelfAnimating remains true. Fix: 137898192 Bug: 127741025 Test: atest CtsWindowManagerDeviceTestCases:ActivityStarterTests Test: Manual testing that b/134561008 didn't reproduce. Change-Id: Ie76b33ec5f12591c3166612e69b49325d7276216
-rw-r--r--services/core/java/com/android/server/wm/AppWindowToken.java25
1 files changed, 14 insertions, 11 deletions
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index f647fe46f067..fc350cd900c1 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -548,17 +548,20 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
if (isHidden()) {
waitingToShow = true;
- // Let's reset the draw state in order to prevent the starting window to be
- // immediately dismissed when the app still has the surface.
- forAllWindows(w -> {
- if (w.mWinAnimator.mDrawState == HAS_DRAWN) {
- w.mWinAnimator.resetDrawState();
-
- // Force add to mResizingWindows, so that we are guaranteed to get
- // another reportDrawn callback.
- w.resetLastContentInsets();
- }
- }, true /* traverseTopToBottom */);
+ // If the client isn't hidden, we don't need to reset the drawing state.
+ if (isClientHidden()) {
+ // Let's reset the draw state in order to prevent the starting window to be
+ // immediately dismissed when the app still has the surface.
+ forAllWindows(w -> {
+ if (w.mWinAnimator.mDrawState == HAS_DRAWN) {
+ w.mWinAnimator.resetDrawState();
+
+ // Force add to mResizingWindows, so that we are guaranteed to get
+ // another reportDrawn callback.
+ w.resetLastContentInsets();
+ }
+ }, true /* traverseTopToBottom */);
+ }
}
}