diff options
| author | 2021-12-08 15:24:46 +0000 | |
|---|---|---|
| committer | 2021-12-08 15:24:46 +0000 | |
| commit | eb964bdf32bc67372db0aabc43f3ab9830c5ab8d (patch) | |
| tree | 61fb3cb721d8e4076eff5291a3dda5079c2de9ae | |
| parent | bed1814878fc6e4b8e90d5e3bc5c7e07f657c741 (diff) | |
| parent | a6529b1829ed354c6245720a6438b924c360d051 (diff) | |
Merge "Fix jank when app launched from quick panels on the lock screen" into sc-v2-dev am: 20569604d9 am: a6529b1829
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16389004
Change-Id: I10cb073de6da366078995c8e3837ec48aac723f2
| -rw-r--r-- | services/core/java/com/android/server/wm/AppTransition.java | 22 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java | 20 |
2 files changed, 31 insertions, 11 deletions
diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java index 03d65905d6a9..d5abe4f8ed02 100644 --- a/services/core/java/com/android/server/wm/AppTransition.java +++ b/services/core/java/com/android/server/wm/AppTransition.java @@ -1426,21 +1426,21 @@ public class AppTransition implements Dump { } @TransitionType int getKeyguardTransition() { + if (mNextAppTransitionRequests.indexOf(TRANSIT_KEYGUARD_GOING_AWAY) != -1) { + return TRANSIT_KEYGUARD_GOING_AWAY; + } + final int unoccludeIndex = mNextAppTransitionRequests.indexOf(TRANSIT_KEYGUARD_UNOCCLUDE); + final int occludeIndex = mNextAppTransitionRequests.indexOf(TRANSIT_KEYGUARD_OCCLUDE); + // No keyguard related transition requests. + if (unoccludeIndex == -1 && occludeIndex == -1) { + return TRANSIT_NONE; + } // In case we unocclude Keyguard and occlude it again, meaning that we never actually // unoccclude/occlude Keyguard, but just run a normal transition. - final int occludeIndex = mNextAppTransitionRequests.indexOf(TRANSIT_KEYGUARD_UNOCCLUDE); - if (occludeIndex != -1 - && occludeIndex < mNextAppTransitionRequests.indexOf(TRANSIT_KEYGUARD_OCCLUDE)) { + if (unoccludeIndex != -1 && unoccludeIndex < occludeIndex) { return TRANSIT_NONE; } - - for (int i = 0; i < mNextAppTransitionRequests.size(); ++i) { - final @TransitionType int transit = mNextAppTransitionRequests.get(i); - if (isKeyguardTransit(transit)) { - return transit; - } - } - return TRANSIT_NONE; + return unoccludeIndex != -1 ? TRANSIT_KEYGUARD_UNOCCLUDE : TRANSIT_KEYGUARD_OCCLUDE; } @TransitionType int getFirstAppTransition() { diff --git a/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java index c0959d311ed5..2ea7fdaf6348 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java @@ -22,6 +22,9 @@ import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_FLAG_APP_CRASHED; import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; +import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE; +import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE; +import static android.view.WindowManager.TRANSIT_NONE; import static android.view.WindowManager.TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE; import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY; import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE; @@ -92,6 +95,7 @@ public class AppTransitionTests extends WindowTestsBase { final ActivityRecord activity = createActivityRecord(dc); mDc.prepareAppTransition(TRANSIT_OPEN); + mDc.prepareAppTransition(TRANSIT_KEYGUARD_OCCLUDE); mDc.prepareAppTransition(TRANSIT_KEYGUARD_GOING_AWAY); mDc.mOpeningApps.add(activity); assertEquals(TRANSIT_OLD_KEYGUARD_GOING_AWAY, @@ -102,6 +106,22 @@ public class AppTransitionTests extends WindowTestsBase { } @Test + public void testKeyguardUnoccludeOcclude() { + final DisplayContent dc = createNewDisplay(Display.STATE_ON); + final ActivityRecord activity = createActivityRecord(dc); + + mDc.prepareAppTransition(TRANSIT_KEYGUARD_UNOCCLUDE); + mDc.prepareAppTransition(TRANSIT_KEYGUARD_OCCLUDE); + mDc.mOpeningApps.add(activity); + assertEquals(TRANSIT_NONE, + AppTransitionController.getTransitCompatType(mDc.mAppTransition, + mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps, + mDisplayContent.mChangingContainers, null /* wallpaperTarget */, + null /* oldWallpaper */, false /*skipAppTransitionAnimation*/)); + + } + + @Test public void testKeyguardKeep() { final DisplayContent dc = createNewDisplay(Display.STATE_ON); final ActivityRecord activity = createActivityRecord(dc); |