OSDN Git Service

Wait for next app to be visible if current activity is marked visible
authorChong Zhang <chz@google.com>
Mon, 25 Apr 2016 20:17:53 +0000 (13:17 -0700)
committerChong Zhang <chz@google.com>
Mon, 25 Apr 2016 20:24:18 +0000 (20:24 +0000)
WM's AppWindowToken.updateReportedVisibilityLocked() may not report
nowVisible if the app has animation set. So nowVisibible could be false
for a while after the app is already on screen. If we finish the app in
this state, we still need to wait for next app to be visible.

bug: 28019637
Change-Id: I4f9f8e138f5d011a9ab393913159ed2978d26e0d

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

index 5249131..a7c994b 100644 (file)
@@ -3457,7 +3457,7 @@ final class ActivityStack {
         // First things first: if this activity is currently visible,
         // and the resumed activity is not yet visible, then hold off on
         // finishing until the resumed one becomes visible.
-        if (mode == FINISH_AFTER_VISIBLE && r.nowVisible) {
+        if (mode == FINISH_AFTER_VISIBLE && (r.visible || r.nowVisible)) {
             if (!mStackSupervisor.mStoppingActivities.contains(r)) {
                 addToStopping(r, false /* immediate */);
             }