From d5c91ece7bfea74ee7ab2bc86f3cb3f5c531f866 Mon Sep 17 00:00:00 2001 From: louis_chang Date: Tue, 28 Jan 2014 18:38:06 +0800 Subject: [PATCH] [ActivityManager]: Fix the activity visibility state not sync between ActivityManager and WindowManager Symptom: When press Home key to home screen, user is able to see the activity's window shown on top of wallpaper and below launcher(widgets). Root Cause: The ensureActivitiesVisibleLocked() is called pretty often (for example when a new process bound). If the top activity "B" was finishing, then the previous activity "A" should be visible. Therefore, the activity "A" window will be set to visible and then launched activity "A", but it does not updates the visible state in ActivityRecord for "A". There has a timing issue that if a new activity "C" is started, "C" becomes the new top activity and be resumed. In that case, Activity "A" window will remain visible even if it is behind a full screen activity "C" because the ActivityRecord.visble of "A" is still false, so the window visibility won't be update. So when user press home key and back to launcher, the surface of activity "A" will be composed on top of wallpaper. Solution: Updates ActivityRecord.visible to true for "A". After "C" is started, the "A" will be called WindowManagerService.setAppVisibility() to set invisible, then called onStop() when execute ensureActivitiesVisibleLocked() again. Change-Id: I536ba04b95d8d274fea6d679a6493e620bc981e2 --- services/java/com/android/server/am/ActivityStack.java | 1 + 1 file changed, 1 insertion(+) diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index e9c78a7a31a7e..d651a6217c493 100755 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -1094,6 +1094,7 @@ final class ActivityStack { if (!r.visible) { if (DEBUG_VISBILITY) Slog.v( TAG, "Starting and making visible: " + r); + r.visible = true; mWindowManager.setAppVisibility(r.appToken, true); } if (r != starting) {