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

Commit da9d2fcc authored by Dave Mankoff's avatar Dave Mankoff
Browse files

Move ActivityLaunchAnimator.KeyguardHandler internal to StatusBar.

Bug: 190746471
Test: atest SystemUITest
Change-Id: Ie43400d2833835af945a90e2c2663b123bbc185b
parent 9e5c45cb
Loading
Loading
Loading
Loading
+36 −33
Original line number Original line Diff line number Diff line
@@ -252,8 +252,7 @@ import dagger.Lazy;
/** */
/** */
public class StatusBar extends SystemUI implements
public class StatusBar extends SystemUI implements
        ActivityStarter,
        ActivityStarter,
        LifecycleOwner,
        LifecycleOwner {
        ActivityLaunchAnimator.Callback {
    public static final boolean MULTIUSER_DEBUG = false;
    public static final boolean MULTIUSER_DEBUG = false;


    protected static final int MSG_HIDE_RECENT_APPS = 1020;
    protected static final int MSG_HIDE_RECENT_APPS = 1020;
@@ -919,6 +918,40 @@ public class StatusBar extends SystemUI implements
                    }
                    }
                }
                }
            };
            };

    private final ActivityLaunchAnimator.Callback mKeyguardHandler =
            new ActivityLaunchAnimator.Callback() {
        @Override
        public boolean isOnKeyguard() {
            return mKeyguardStateController.isShowing();
        }

        @Override
        public void hideKeyguardWithAnimation(IRemoteAnimationRunner runner) {
            // We post to the main thread for 2 reasons:
            //   1. KeyguardViewMediator is not thread-safe.
            //   2. To ensure that ViewMediatorCallback#keyguardDonePending is called before
            //      ViewMediatorCallback#readyForKeyguardDone. The wrong order could occur when
            //      doing dismissKeyguardThenExecute { hideKeyguardWithAnimation(runner) }.
            mMainThreadHandler.post(() -> mKeyguardViewMediator.hideWithAnimation(runner));
        }

        @Override
        public void setBlursDisabledForAppLaunch(boolean disabled) {
            mKeyguardViewMediator.setBlursDisabledForAppLaunch(disabled);
        }

        @Override
        public int getBackgroundColor(TaskInfo task) {
            if (!mStartingSurfaceOptional.isPresent()) {
                Log.w(TAG, "No starting surface, defaulting to SystemBGColor");
                return SplashscreenContentDrawer.getSystemBGColor();
            }

            return mStartingSurfaceOptional.get().getBackgroundColor(task);
        }
    };

    /**
    /**
     * Public constructor for StatusBar.
     * Public constructor for StatusBar.
     *
     *
@@ -1634,7 +1667,7 @@ public class StatusBar extends SystemUI implements


    private void setUpPresenter() {
    private void setUpPresenter() {
        // Set up the initial notification state.
        // Set up the initial notification state.
        mActivityLaunchAnimator = new ActivityLaunchAnimator(this, mContext);
        mActivityLaunchAnimator = new ActivityLaunchAnimator(mKeyguardHandler, mContext);
        mNotificationAnimationProvider = new NotificationLaunchAnimatorControllerProvider(
        mNotificationAnimationProvider = new NotificationLaunchAnimatorControllerProvider(
                mNotificationShadeWindowViewController,
                mNotificationShadeWindowViewController,
                mStackScrollerController.getNotificationListContainer(),
                mStackScrollerController.getNotificationListContainer(),
@@ -2133,36 +2166,6 @@ public class StatusBar extends SystemUI implements
        return isActivityIntent && KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation;
        return isActivityIntent && KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation;
    }
    }


    @Override
    public boolean isOnKeyguard() {
        return mKeyguardStateController.isShowing();
    }

    @Override
    public void hideKeyguardWithAnimation(IRemoteAnimationRunner runner) {
        // We post to the main thread for 2 reasons:
        //   1. KeyguardViewMediator is not thread-safe.
        //   2. To ensure that ViewMediatorCallback#keyguardDonePending is called before
        //      ViewMediatorCallback#readyForKeyguardDone. The wrong order could occur when doing
        //      dismissKeyguardThenExecute { hideKeyguardWithAnimation(runner) }.
        mMainThreadHandler.post(() -> mKeyguardViewMediator.hideWithAnimation(runner));
    }

    @Override
    public void setBlursDisabledForAppLaunch(boolean disabled) {
        mKeyguardViewMediator.setBlursDisabledForAppLaunch(disabled);
    }

    @Override
    public int getBackgroundColor(TaskInfo task) {
        if (!mStartingSurfaceOptional.isPresent()) {
            Log.w(TAG, "No starting surface, defaulting to SystemBGColor");
            return SplashscreenContentDrawer.getSystemBGColor();
        }

        return mStartingSurfaceOptional.get().getBackgroundColor(task);
    }

    public boolean isDeviceInVrMode() {
    public boolean isDeviceInVrMode() {
        return mPresenter.isDeviceInVrMode();
        return mPresenter.isDeviceInVrMode();
    }
    }