Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55b1bc32 authored by Josh Tsuji's avatar Josh Tsuji
Browse files

Pass keyguard occlude state to onLaunchAnimationCancelled.

We need to apply this canonical occlusion state whenever an
animation that occludes the lockscreen is cancelled. We
usually do this via KeyguardViewMediator's occlusion launch
animator, but the controls/wallet launch cases do not use
this code path, so the WM occlusion value was being ignored.

This is normally fine, but in an edge case where the animation
is cancelled before it begins, this resulted in a temporary
mismatch of the occlusion state, leaving an empty wallpaper
with no lockscreen rendered.

Fixes: 240347798
Test: atest SystemUITests
Test: launch controls activity over lockscreen with a patch to force WM to instantly cancel all remote launch animations
Change-Id: I8a11db3a3b277364c1d8415aa152b352aa8a1c36
parent 50d3d730
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -352,8 +352,11 @@ class ActivityLaunchAnimator(
         * The animation was cancelled. Note that [onLaunchAnimationEnd] will still be called after
         * The animation was cancelled. Note that [onLaunchAnimationEnd] will still be called after
         * this if the animation was already started, i.e. if [onLaunchAnimationStart] was called
         * this if the animation was already started, i.e. if [onLaunchAnimationStart] was called
         * before the cancellation.
         * before the cancellation.
         *
         * If this launch animation affected the occlusion state of the keyguard, WM will provide
         * us with [newKeyguardOccludedState] so that we can set the occluded state appropriately.
         */
         */
        fun onLaunchAnimationCancelled() {}
        fun onLaunchAnimationCancelled(newKeyguardOccludedState: Boolean? = null) {}
    }
    }


    @VisibleForTesting
    @VisibleForTesting
@@ -667,7 +670,7 @@ class ActivityLaunchAnimator(
            removeTimeout()
            removeTimeout()
            context.mainExecutor.execute {
            context.mainExecutor.execute {
                animation?.cancel()
                animation?.cancel()
                controller.onLaunchAnimationCancelled()
                controller.onLaunchAnimationCancelled(newKeyguardOccludedState = isKeyguardOccluded)
            }
            }
        }
        }


+1 −1
Original line number Original line Diff line number Diff line
@@ -238,7 +238,7 @@ constructor(
                }
                }
            }
            }


            override fun onLaunchAnimationCancelled() {
            override fun onLaunchAnimationCancelled(newKeyguardOccludedState: Boolean?) {
                controller.onLaunchAnimationCancelled()
                controller.onLaunchAnimationCancelled()
                enableDialogDismiss()
                enableDialogDismiss()
                dialog.dismiss()
                dialog.dismiss()
+1 −1
Original line number Original line Diff line number Diff line
@@ -831,7 +831,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
                public void onLaunchAnimationStart(boolean isExpandingFullyAbove) {}
                public void onLaunchAnimationStart(boolean isExpandingFullyAbove) {}


                @Override
                @Override
                public void onLaunchAnimationCancelled() {
                public void onLaunchAnimationCancelled(@Nullable Boolean newKeyguardOccludedState) {
                    Log.d(TAG, "Occlude launch animation cancelled. Occluded state is now: "
                    Log.d(TAG, "Occlude launch animation cancelled. Occluded state is now: "
                            + mOccluded);
                            + mOccluded);
                }
                }
+1 −1
Original line number Original line Diff line number Diff line
@@ -136,7 +136,7 @@ class NotificationLaunchAnimatorController(
        headsUpManager.removeNotification(notificationKey, true /* releaseImmediately */, animate)
        headsUpManager.removeNotification(notificationKey, true /* releaseImmediately */, animate)
    }
    }


    override fun onLaunchAnimationCancelled() {
    override fun onLaunchAnimationCancelled(newKeyguardOccludedState: Boolean?) {
        // TODO(b/184121838): Should we call InteractionJankMonitor.cancel if the animation started
        // TODO(b/184121838): Should we call InteractionJankMonitor.cancel if the animation started
        // here?
        // here?
        notificationShadeWindowViewController.setExpandAnimationRunning(false)
        notificationShadeWindowViewController.setExpandAnimationRunning(false)
+7 −2
Original line number Original line Diff line number Diff line
@@ -1721,13 +1721,18 @@ public class CentralSurfacesImpl extends CoreStartable implements
                }
                }


                @Override
                @Override
                public void onLaunchAnimationCancelled() {
                public void onLaunchAnimationCancelled(@Nullable Boolean newKeyguardOccludedState) {
                    if (newKeyguardOccludedState != null) {
                        mKeyguardViewMediator.setOccluded(
                                newKeyguardOccludedState, false /* animate */);
                    }

                    // Set mIsLaunchingActivityOverLockscreen to false before actually finishing the
                    // Set mIsLaunchingActivityOverLockscreen to false before actually finishing the
                    // animation so that we can assume that mIsLaunchingActivityOverLockscreen
                    // animation so that we can assume that mIsLaunchingActivityOverLockscreen
                    // being true means that we will collapse the shade (or at least run the
                    // being true means that we will collapse the shade (or at least run the
                    // post collapse runnables) later on.
                    // post collapse runnables) later on.
                    CentralSurfacesImpl.this.mIsLaunchingActivityOverLockscreen = false;
                    CentralSurfacesImpl.this.mIsLaunchingActivityOverLockscreen = false;
                    getDelegate().onLaunchAnimationCancelled();
                    getDelegate().onLaunchAnimationCancelled(newKeyguardOccludedState);
                }
                }
            };
            };
        } else if (dismissShade) {
        } else if (dismissShade) {
Loading