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

Commit 7fc3b633 authored by Evan Rosky's avatar Evan Rosky Committed by Automerger Merge Worker
Browse files

Merge "Move keyguard shell transition init to onCreate" into sc-v2-dev am:...

Merge "Move keyguard shell transition init to onCreate" into sc-v2-dev am: 3d388044 am: d1695232

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16193457

Change-Id: I1b1af4a818d1eaeb9862c3456735410d42925822
parents 06e568a5 d1695232
Loading
Loading
Loading
Loading
+55 −48
Original line number Diff line number Diff line
@@ -118,6 +118,7 @@ public class KeyguardService extends Service {

    private final KeyguardViewMediator mKeyguardViewMediator;
    private final KeyguardLifecyclesDispatcher mKeyguardLifecyclesDispatcher;
    private final ShellTransitions mShellTransitions;

    private static int newModeToLegacyMode(int newMode) {
        switch (newMode) {
@@ -231,13 +232,45 @@ public class KeyguardService extends Service {
        super();
        mKeyguardViewMediator = keyguardViewMediator;
        mKeyguardLifecyclesDispatcher = keyguardLifecyclesDispatcher;
        mShellTransitions = shellTransitions;

        if (shellTransitions != null && Transitions.ENABLE_SHELL_TRANSITIONS) {
            // Nothing here. Initialization for this happens in onCreate.
        } else {
            RemoteAnimationDefinition definition = new RemoteAnimationDefinition();
            if (sEnableRemoteKeyguardGoingAwayAnimation) {
                final RemoteAnimationAdapter exitAnimationAdapter =
                        new RemoteAnimationAdapter(mExitAnimationRunner, 0, 0);
                definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_GOING_AWAY,
                        exitAnimationAdapter);
                definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
                        exitAnimationAdapter);
            }
            if (sEnableRemoteKeyguardOccludeAnimation) {
                final RemoteAnimationAdapter occludeAnimationAdapter =
                        new RemoteAnimationAdapter(mOccludeAnimationRunner, 0, 0);
                definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_OCCLUDE,
                        occludeAnimationAdapter);
                definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_UNOCCLUDE,
                        occludeAnimationAdapter);
            }
            ActivityTaskManager.getInstance().registerRemoteAnimationsForDisplay(
                    DEFAULT_DISPLAY, definition);
        }
    }

    @Override
    public void onCreate() {
        ((SystemUIApplication) getApplication()).startServicesIfNeeded();

        if (mShellTransitions == null || !Transitions.ENABLE_SHELL_TRANSITIONS) {
            return;
        }
        if (sEnableRemoteKeyguardGoingAwayAnimation) {
            Slog.d(TAG, "KeyguardService registerRemote: TRANSIT_KEYGUARD_GOING_AWAY");
            TransitionFilter f = new TransitionFilter();
            f.mFlags = TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
                shellTransitions.registerRemote(f,
            mShellTransitions.registerRemote(f,
                    new RemoteTransition(wrap(mExitAnimationRunner), getIApplicationThread()));
        }
        if (sEnableRemoteKeyguardOccludeAnimation) {
@@ -257,7 +290,7 @@ public class KeyguardService extends Service {
            f.mRequirements[1].mMustBeIndependent = false;
            f.mRequirements[1].mFlags = FLAG_OCCLUDES_KEYGUARD;
            f.mRequirements[1].mModes = new int[]{TRANSIT_CLOSE, TRANSIT_TO_BACK};
                shellTransitions.registerRemote(f,
            mShellTransitions.registerRemote(f,
                    new RemoteTransition(mOccludeAnimation, getIApplicationThread()));

            // Now register for un-occlude.
@@ -278,35 +311,9 @@ public class KeyguardService extends Service {
            f.mRequirements[0].mMustBeIndependent = false;
            f.mRequirements[0].mFlags = FLAG_OCCLUDES_KEYGUARD;
            f.mRequirements[0].mModes = new int[]{TRANSIT_OPEN, TRANSIT_TO_FRONT};
                shellTransitions.registerRemote(f,
            mShellTransitions.registerRemote(f,
                    new RemoteTransition(mUnoccludeAnimation, getIApplicationThread()));
        }
        } else {
            RemoteAnimationDefinition definition = new RemoteAnimationDefinition();
            if (sEnableRemoteKeyguardGoingAwayAnimation) {
                final RemoteAnimationAdapter exitAnimationAdapter =
                        new RemoteAnimationAdapter(mExitAnimationRunner, 0, 0);
                definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_GOING_AWAY,
                        exitAnimationAdapter);
                definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
                        exitAnimationAdapter);
            }
            if (sEnableRemoteKeyguardOccludeAnimation) {
                final RemoteAnimationAdapter occludeAnimationAdapter =
                        new RemoteAnimationAdapter(mOccludeAnimationRunner, 0, 0);
                definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_OCCLUDE,
                        occludeAnimationAdapter);
                definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_UNOCCLUDE,
                        occludeAnimationAdapter);
            }
            ActivityTaskManager.getInstance().registerRemoteAnimationsForDisplay(
                    DEFAULT_DISPLAY, definition);
        }
    }

    @Override
    public void onCreate() {
        ((SystemUIApplication) getApplication()).startServicesIfNeeded();
    }

    @Override