diff options
| author | 2023-05-19 08:39:22 +0000 | |
|---|---|---|
| committer | 2023-05-22 14:28:09 +0000 | |
| commit | 7a376bf1572d00f7fcd83f2072661f5a4cc4dfb5 (patch) | |
| tree | 3cc15f6b72f861e007f63935a1765b737220541e | |
| parent | aefac4e02417e3b2c1654843c4676912d29fa610 (diff) | |
Fix split-tasks & wallpaper flicker when unlocking keyguard
As now we have KeyguardTransitionHandler to handle keyguard animation
and takes over other mixed transition cases in
DefaultMixedHandler#animateKeyguard, 2 things needs to be fixed:
1) All leashes handled by KeyguardTransitionHandler will by default
reparented to the transition root which the position (0,0) is screen
space based, so in KeyguardUnlockedAnimationController we have to
change using screenSpaceBounds position for all leash in case seeing
split-tasks animating on the same position.
2) In KeyguardService, we have to ensure to only apply the opening
root task & wallpaper setting alpha 0 for fade-in animation. In case
seeing the flicker that previously we didn't consider that.
Note that setting alpha 0 for opening wallpaper targets is just fixing
one of the wallpaper flicker source for Bug 283465374 and the CL is not
intended to fully fixing all wallpaper flicker cases.
Fix: 282593683
Bug: 283465374
Test: manual as issue steps
1. Launch Gmail and Chrome in split screen.
2. Turn off the screen by pressing power button.
3. Turn on the screen by pressing power button.
4. Observe the split screen transition without any flicker
Change-Id: I13070a9e6f327bc1f3cb4f037b411a0c43c90250
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java | 45 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt | 4 |
2 files changed, 26 insertions, 23 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java index 54da680d8a68..fca7ed6da970 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java @@ -19,7 +19,6 @@ package com.android.systemui.keyguard; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.view.RemoteAnimationTarget.MODE_CLOSING; import static android.view.RemoteAnimationTarget.MODE_OPENING; -import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY; import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE; @@ -30,13 +29,11 @@ import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE; import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE_BY_DREAM; import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE; import static android.view.WindowManager.TRANSIT_OLD_NONE; -import static android.view.WindowManager.TRANSIT_OPEN; -import static android.view.WindowManager.TRANSIT_TO_BACK; -import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.view.WindowManager.TransitionFlags; import static android.view.WindowManager.TransitionOldType; import static android.view.WindowManager.TransitionType; +import android.annotation.NonNull; import android.app.ActivityManager; import android.app.ActivityTaskManager; import android.app.Service; @@ -116,6 +113,14 @@ public class KeyguardService extends Service { final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo(); final int taskId = taskInfo != null ? change.getTaskInfo().taskId : -1; + if (taskId != -1 && change.getParent() != null) { + final TransitionInfo.Change parentChange = info.getChange(change.getParent()); + if (parentChange != null && parentChange.getTaskInfo() != null) { + // Only adding the root task as the animation target. + continue; + } + } + final RemoteAnimationTarget target = TransitionUtil.newTarget(change, // wallpapers go into the "below" layer space info.getChanges().size() - i, @@ -123,13 +128,6 @@ public class KeyguardService extends Service { (change.getFlags() & TransitionInfo.FLAG_SHOW_WALLPAPER) != 0, info, t, leashMap); - // Use hasAnimatingParent to mark the anything below root task - if (taskId != -1 && change.getParent() != null) { - final TransitionInfo.Change parentChange = info.getChange(change.getParent()); - if (parentChange != null && parentChange.getTaskInfo() != null) { - target.hasAnimatingParent = true; - } - } out.add(target); } return out.toArray(new RemoteAnimationTarget[out.size()]); @@ -173,18 +171,15 @@ public class KeyguardService extends Service { wrap(info, true /* wallpapers */, t, mLeashMap); final RemoteAnimationTarget[] nonApps = new RemoteAnimationTarget[0]; - // Sets the alpha to 0 for the opening root task for fade in animation. And since - // the fade in animation can only apply on the first opening app, so set alpha to 1 - // for anything else. - for (RemoteAnimationTarget target : apps) { - if (target.taskId != -1 - && target.mode == RemoteAnimationTarget.MODE_OPENING - && !target.hasAnimatingParent) { - t.setAlpha(target.leash, 0.0f); - } else { - t.setAlpha(target.leash, 1.0f); + // Set alpha back to 1 for the independent changes because we will be animating + // children instead. + for (TransitionInfo.Change chg : info.getChanges()) { + if (TransitionInfo.isIndependent(chg, info)) { + t.setAlpha(chg.getLeash(), 1.f); } } + initAlphaForAnimationTargets(t, apps); + initAlphaForAnimationTargets(t, wallpapers); t.apply(); synchronized (mFinishCallbacks) { mFinishCallbacks.put(transition, finishCallback); @@ -223,6 +218,14 @@ public class KeyguardService extends Service { // nothing, we'll just let it finish on its own I guess. } } + + private static void initAlphaForAnimationTargets(@NonNull SurfaceControl.Transaction t, + @NonNull RemoteAnimationTarget[] targets) { + for (RemoteAnimationTarget target : targets) { + if (target.mode != MODE_OPENING) continue; + t.setAlpha(target.leash, 0.f); + } + } }; } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt index f96f337d5cb2..122e25975837 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt @@ -812,8 +812,8 @@ class KeyguardUnlockAnimationController @Inject constructor( // Translate up from the bottom. surfaceBehindMatrix.setTranslate( - surfaceBehindRemoteAnimationTarget.localBounds.left.toFloat(), - surfaceBehindRemoteAnimationTarget.localBounds.top.toFloat() + + surfaceBehindRemoteAnimationTarget.screenSpaceBounds.left.toFloat(), + surfaceBehindRemoteAnimationTarget.screenSpaceBounds.top.toFloat() + surfaceHeight * SURFACE_BEHIND_START_TRANSLATION_Y * (1f - amount) ) |