From 3b9ac733e4211fafec4dea350deecfaf22b2eb9e Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Tue, 18 Feb 2020 16:10:29 +0800 Subject: [PATCH] Polish the transition when unlocking to home - Only take snapshot if keyguard is secure because the snapshot doesn't help too much if there is unlocking window animation, because screen is already turned on in this case. - Only use the snapshot when unlocking to home directly because the visual look may be worse with translate animation. - Dismiss the snapshot starting window directly when the main window is ready, so it has less chance to see the fading translucent outdated snapshot. Bug: 140811348 Bug: 148553119 Test: Unlock device with fingerprint and password. Check the top area of home doesn't have obvious fading scrim. Change-Id: Ifb1302bd185d83ca9b203cf5d01a8f50fa1d6e69 --- .../core/java/com/android/server/wm/ActivityRecord.java | 7 +++---- .../core/java/com/android/server/wm/DisplayPolicy.java | 5 +++++ .../java/com/android/server/wm/TaskSnapshotController.java | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index b3b81595d4ffe..0ac959d7f9982 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -1723,10 +1723,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // The snapshot of home is only used once because it won't be updated while screen // is on (see {@link TaskSnapshotController#screenTurningOff}). mWmService.mTaskSnapshotController.removeSnapshotCache(task.mTaskId); - // TODO(b/9684093): Use more general condition to specify the case. - if (mDisplayContent.mAppTransition - .getAppTransition() != WindowManager.TRANSIT_KEYGUARD_GOING_AWAY) { - // Only use snapshot of home as starting window when unlocking. + if ((mDisplayContent.mAppTransition.getTransitFlags() + & WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) == 0) { + // Only use snapshot of home as starting window when unlocking directly. return false; } } diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 330244577f875..79a3496336337 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -1183,6 +1183,11 @@ public class DisplayPolicy { if (transit == TRANSIT_PREVIEW_DONE) { if (win.hasAppShownWindows()) { + if (win.isActivityTypeHome()) { + // Dismiss the starting window as soon as possible to avoid the crossfade out + // with old content because home is easier to have different UI states. + return ANIMATION_NONE; + } if (DEBUG_ANIM) Slog.i(TAG, "**** STARTING EXIT"); return R.anim.app_starting_exit; } diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java index 10d6823c850f5..d8091edb91700 100644 --- a/services/core/java/com/android/server/wm/TaskSnapshotController.java +++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java @@ -559,8 +559,10 @@ class TaskSnapshotController { } }); // Allow taking snapshot of home when turning screen off to reduce the delay of - // unlocking/waking to home. - snapshotTasks(mTmpTasks, true /* allowSnapshotHome */); + // waking from secure lock to home. + final boolean allowSnapshotHome = + mService.mPolicy.isKeyguardSecure(mService.mCurrentUserId); + snapshotTasks(mTmpTasks, allowSnapshotHome); } } finally { listener.onScreenOff();