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

Commit 67cc2396 authored by Bonian Chen's avatar Bonian Chen Committed by Automerger Merge Worker
Browse files

Merge "Revert "Enable remote animation for keygaurd going away."" into sc-dev am: 7fea8cef

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

Change-Id: Ieb472e86cdad7e2d959033fbef7ec38ebe9a9510
parents 33f897b8 7fea8cef
Loading
Loading
Loading
Loading
+6 −22
Original line number Original line Diff line number Diff line
@@ -51,7 +51,6 @@ import com.android.internal.policy.IKeyguardExitCallback;
import com.android.internal.policy.IKeyguardService;
import com.android.internal.policy.IKeyguardService;
import com.android.internal.policy.IKeyguardStateCallback;
import com.android.internal.policy.IKeyguardStateCallback;
import com.android.systemui.SystemUIApplication;
import com.android.systemui.SystemUIApplication;
import com.android.wm.shell.transition.Transitions;


import javax.inject.Inject;
import javax.inject.Inject;


@@ -63,29 +62,16 @@ public class KeyguardService extends Service {
     * Run Keyguard animation as remote animation in System UI instead of local animation in
     * Run Keyguard animation as remote animation in System UI instead of local animation in
     * the server process.
     * the server process.
     *
     *
     * 0: Runs all keyguard animation as local animation
     * 1: Only runs keyguard going away animation as remote animation
     * 2: Runs all keyguard animation as remote animation
     *
     * Note: Must be consistent with WindowManagerService.
     * Note: Must be consistent with WindowManagerService.
     */
     */
    private static final String ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY =
    private static final String ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY =
            "persist.wm.enable_remote_keyguard_animation";
            "persist.wm.enable_remote_keyguard_animation";


    private static final int sEnableRemoteKeyguardAnimation =
            SystemProperties.getInt(ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY, 1);

    /**
    /**
     * @see #ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY
     * @see #ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY
     */
     */
    public static boolean sEnableRemoteKeyguardGoingAwayAnimation =
    static boolean sEnableRemoteKeyguardAnimation =
            !Transitions.ENABLE_SHELL_TRANSITIONS && sEnableRemoteKeyguardAnimation >= 1;
            SystemProperties.getBoolean(ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY, false);

    /**
     * @see #ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY
     */
    public static boolean sEnableRemoteKeyguardOccludeAnimation =
            !Transitions.ENABLE_SHELL_TRANSITIONS && sEnableRemoteKeyguardAnimation >= 2;


    private final KeyguardViewMediator mKeyguardViewMediator;
    private final KeyguardViewMediator mKeyguardViewMediator;
    private final KeyguardLifecyclesDispatcher mKeyguardLifecyclesDispatcher;
    private final KeyguardLifecyclesDispatcher mKeyguardLifecyclesDispatcher;
@@ -97,23 +83,21 @@ public class KeyguardService extends Service {
        mKeyguardViewMediator = keyguardViewMediator;
        mKeyguardViewMediator = keyguardViewMediator;
        mKeyguardLifecyclesDispatcher = keyguardLifecyclesDispatcher;
        mKeyguardLifecyclesDispatcher = keyguardLifecyclesDispatcher;


        if (sEnableRemoteKeyguardAnimation) {
            RemoteAnimationDefinition definition = new RemoteAnimationDefinition();
            RemoteAnimationDefinition definition = new RemoteAnimationDefinition();
        if (sEnableRemoteKeyguardGoingAwayAnimation) {
            final RemoteAnimationAdapter exitAnimationAdapter =
            final RemoteAnimationAdapter exitAnimationAdapter =
                    new RemoteAnimationAdapter(mExitAnimationRunner, 0, 0);
                    new RemoteAnimationAdapter(mExitAnimationRunner, 0, 0);
            definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_GOING_AWAY, exitAnimationAdapter);
            definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_GOING_AWAY, exitAnimationAdapter);
            definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
            definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
                    exitAnimationAdapter);
                    exitAnimationAdapter);
        }
        if (sEnableRemoteKeyguardOccludeAnimation) {
            final RemoteAnimationAdapter occludeAnimationAdapter =
            final RemoteAnimationAdapter occludeAnimationAdapter =
                    new RemoteAnimationAdapter(mOccludeAnimationRunner, 0, 0);
                    new RemoteAnimationAdapter(mOccludeAnimationRunner, 0, 0);
            definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_OCCLUDE, occludeAnimationAdapter);
            definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_OCCLUDE, occludeAnimationAdapter);
            definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_UNOCCLUDE, occludeAnimationAdapter);
            definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_UNOCCLUDE, occludeAnimationAdapter);
        }
            ActivityTaskManager.getInstance().registerRemoteAnimationsForDisplay(
            ActivityTaskManager.getInstance().registerRemoteAnimationsForDisplay(
                    DEFAULT_DISPLAY, definition);
                    DEFAULT_DISPLAY, definition);
        }
        }
    }


    @Override
    @Override
    public void onCreate() {
    public void onCreate() {
+1 −1
Original line number Original line Diff line number Diff line
@@ -280,7 +280,7 @@ class KeyguardUnlockAnimationController @Inject constructor(
    }
    }


    override fun onKeyguardDismissAmountChanged() {
    override fun onKeyguardDismissAmountChanged() {
        if (!KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation) {
        if (!KeyguardService.sEnableRemoteKeyguardAnimation) {
            return
            return
        }
        }


+1 −1
Original line number Original line Diff line number Diff line
@@ -2100,7 +2100,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
                playSounds(false);
                playSounds(false);
            }
            }


            if (KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation) {
            if (KeyguardService.sEnableRemoteKeyguardAnimation) {
                mSurfaceBehindRemoteAnimationFinishedCallback = finishedCallback;
                mSurfaceBehindRemoteAnimationFinishedCallback = finishedCallback;
                mSurfaceBehindRemoteAnimationRunning = true;
                mSurfaceBehindRemoteAnimationRunning = true;


+1 −1
Original line number Original line Diff line number Diff line
@@ -3014,7 +3014,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    private int handleStartTransitionForKeyguardLw(boolean keyguardGoingAway, long duration) {
    private int handleStartTransitionForKeyguardLw(boolean keyguardGoingAway, long duration) {
        final int res = applyKeyguardOcclusionChange();
        final int res = applyKeyguardOcclusionChange();
        if (res != 0) return res;
        if (res != 0) return res;
        if (!WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation && keyguardGoingAway) {
        if (!WindowManagerService.sEnableRemoteKeyguardAnimation && keyguardGoingAway) {
            if (DEBUG_KEYGUARD) Slog.d(TAG, "Starting keyguard exit animation");
            if (DEBUG_KEYGUARD) Slog.d(TAG, "Starting keyguard exit animation");
            startKeyguardExitAnimation(SystemClock.uptimeMillis(), duration);
            startKeyguardExitAnimation(SystemClock.uptimeMillis(), duration);
        }
        }
+2 −4
Original line number Original line Diff line number Diff line
@@ -263,8 +263,7 @@ public class KeyguardServiceDelegate {
     */
     */
    @Deprecated
    @Deprecated
    public void setOccluded(boolean isOccluded, boolean animate) {
    public void setOccluded(boolean isOccluded, boolean animate) {
        if (!WindowManagerService.sEnableRemoteKeyguardOccludeAnimation
        if (!WindowManagerService.sEnableRemoteKeyguardAnimation && mKeyguardService != null) {
                && mKeyguardService != null) {
            if (DEBUG) Log.v(TAG, "setOccluded(" + isOccluded + ") animate=" + animate);
            if (DEBUG) Log.v(TAG, "setOccluded(" + isOccluded + ") animate=" + animate);
            mKeyguardService.setOccluded(isOccluded, animate);
            mKeyguardService.setOccluded(isOccluded, animate);
        }
        }
@@ -404,8 +403,7 @@ public class KeyguardServiceDelegate {
    }
    }


    public void startKeyguardExitAnimation(long startTime, long fadeoutDuration) {
    public void startKeyguardExitAnimation(long startTime, long fadeoutDuration) {
        if (!WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation
        if (!WindowManagerService.sEnableRemoteKeyguardAnimation && mKeyguardService != null) {
                && mKeyguardService != null) {
            mKeyguardService.startKeyguardExitAnimation(startTime, fadeoutDuration);
            mKeyguardService.startKeyguardExitAnimation(startTime, fadeoutDuration);
        }
        }
    }
    }
Loading