OSDN Git Service

Fix stopping activity when removed from waiting visible
authorAndrii Kulian <akulian@google.com>
Wed, 21 Sep 2016 22:34:45 +0000 (15:34 -0700)
committerAndrii Kulian <akulian@google.com>
Thu, 22 Sep 2016 00:17:43 +0000 (00:17 +0000)
During refactoring in ag/613666 waitingVisible flag clearing
was mistakenly removed. It was added back in ag/1221328 but
only for activities that are finishing.
This caused activity not being stopped in some cases when
window visibility change was handled before receiving idle
callback from client. This is easily reproducible when there
is a scene transition animation specified.

Bug: 31078584
Change-Id: Ic09c5199ad4fceae0607e4bcce02be5335c8870b

services/core/java/com/android/server/am/ActivityStackSupervisor.java

index 17670f8..c6ab918 100644 (file)
@@ -3139,11 +3139,14 @@ public final class ActivityStackSupervisor implements DisplayListener {
         final boolean nowVisible = allResumedActivitiesVisible();
         for (int activityNdx = mStoppingActivities.size() - 1; activityNdx >= 0; --activityNdx) {
             ActivityRecord s = mStoppingActivities.get(activityNdx);
+            // TODO: Remove mWaitingVisibleActivities list and just remove activity from
+            // mStoppingActivities when something else comes up.
             boolean waitingVisible = mWaitingVisibleActivities.contains(s);
             if (DEBUG_STATES) Slog.v(TAG, "Stopping " + s + ": nowVisible=" + nowVisible
                     + " waitingVisible=" + waitingVisible + " finishing=" + s.finishing);
             if (waitingVisible && nowVisible) {
                 mWaitingVisibleActivities.remove(s);
+                waitingVisible = false;
                 if (s.finishing) {
                     // If this activity is finishing, it is sitting on top of
                     // everyone else but we now know it is no longer needed...
@@ -3152,7 +3155,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
                     // hidden by the activities in front of it.
                     if (DEBUG_STATES) Slog.v(TAG, "Before stopping, can hide: " + s);
                     mWindowManager.setAppVisibility(s.appToken, false);
-                    waitingVisible = false;
                 }
             }
             if ((!waitingVisible || mService.isSleepingOrShuttingDownLocked()) && remove) {