OSDN Git Service

Fix lost window warning
authorChong Zhang <chz@google.com>
Thu, 12 Nov 2015 22:56:28 +0000 (14:56 -0800)
committerChong Zhang <chz@google.com>
Thu, 12 Nov 2015 23:44:10 +0000 (15:44 -0800)
Mark activity window as invisible with window manager when it's
destroyed normally, to differentiate with the case where the app
crashed while visible.

bug: 25671369

Change-Id: I26d8df6b7e08fc5b65cd2c7aa432a3c5c8c5c7b3

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

index ba6e9b1..853a55c 100644 (file)
@@ -3103,6 +3103,9 @@ final class ActivityStack {
             // If the activity is PAUSING, we will complete the finish once
             // it is done pausing; else we can just directly finish it here.
             if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Finish not pausing: " + r);
+            if (r.visible) {
+                mWindowManager.setAppVisibility(r.appToken, false);
+            }
             return finishCurrentActivityLocked(r, FINISH_AFTER_PAUSE, oomAdj) == null;
         } else {
             if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Finish waiting for pause of: " + r);