From edede6db924362d9884fe14fd14910409369f96c Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Mon, 28 Aug 2017 15:44:43 +0200 Subject: [PATCH] Fix transition between two occluding activities This fixes an issue when starting an activity that occldues Keyguard with the window flag from an activity that is already occluding Keyguard. Normally we wait until the transition starts until the next activity had a chance to set its layout flag (FLAG_SHOW_WHEN_LOCKED) with the UnknownVisibilityController. Now, since setAppVisibility(false) was called after immediately starting the activity, we removed the activity immediately from the UnknownVisibilityController waiting list and then unoccluded Keyguard. We fix this by only adding an activity to the unknown visibility list if it's a not a noDisplay activity as it will never add a window in this case, so a relayout will never happen. This regressed from I745e985766a1af97203e1d22b6443dabdd0c0363 because calling setVisible(true) was setting the token's visible to true. Then, setVisible(false) was NOT ignored anymore. Previously it was just ignored because the app wasn't made visible yet from WM perspective. Test: go/wm-smoke Test: android.server.cts.KeyguardTransitionTests#testNewActivityDuringOccluded Test: Launch camera from unlocked Keyguard by swiping from the icon with animation transition scale set to 0.5. (regression test) Change-Id: Idc2a5523f4653ae9788ba145c2d980343ae459f4 Merged-In: Idc2a5523f4653ae9788ba145c2d980343ae459f4 Fixes: 65061212 Bug: 37677242 --- .../core/java/com/android/server/am/ActivityRecord.java | 7 ++++++- .../com/android/server/am/ActivityStackSupervisor.java | 7 ++++--- .../android/server/wm/AppWindowContainerController.java | 1 - 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java index 871ccb9640d45..0b67774dc3300 100644 --- a/services/core/java/com/android/server/am/ActivityRecord.java +++ b/services/core/java/com/android/server/am/ActivityRecord.java @@ -1592,7 +1592,12 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo } void notifyUnknownVisibilityLaunched() { - mWindowContainerController.notifyUnknownVisibilityLaunched(); + + // No display activities never add a window, so there is no point in waiting them for + // relayout. + if (!noDisplay) { + mWindowContainerController.notifyUnknownVisibilityLaunched(); + } } /** diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index d16ae1858d200..f6b1e4cec1177 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -1336,6 +1336,10 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D r.app = app; + if (mKeyguardController.isKeyguardLocked()) { + r.notifyUnknownVisibilityLaunched(); + } + // Have the window manager re-evaluate the orientation of the screen based on the new // activity order. Note that as a result of this, it can call back into the activity // manager with a new orientation. We don't care about that, because the activity is @@ -1362,9 +1366,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D r.setVisibility(true); } - if (mKeyguardController.isKeyguardLocked()) { - r.notifyUnknownVisibilityLaunched(); - } final int applicationInfoUid = (r.info.applicationInfo != null) ? r.info.applicationInfo.uid : -1; if ((r.userId != app.userId) || (r.appInfo.uid != applicationInfoUid)) { diff --git a/services/core/java/com/android/server/wm/AppWindowContainerController.java b/services/core/java/com/android/server/wm/AppWindowContainerController.java index f142ff619884b..b083aee55a535 100644 --- a/services/core/java/com/android/server/wm/AppWindowContainerController.java +++ b/services/core/java/com/android/server/wm/AppWindowContainerController.java @@ -366,7 +366,6 @@ public class AppWindowContainerController // if made visible again. wtoken.removeDeadWindows(); wtoken.setVisibleBeforeClientHidden(); - mService.mUnknownAppVisibilityController.appRemovedOrHidden(wtoken); } else { if (!mService.mAppTransition.isTransitionSet() && mService.mAppTransition.isReady()) {