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

Commit 46b0e5ff authored by Issei Suzuki's avatar Issei Suzuki Committed by Android (Google) Code Review
Browse files

Merge "Remove flag for keyguard remote animations in SysUI."

parents f8f51b6b bc4eea57
Loading
Loading
Loading
Loading
+80 −116
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@ import android.os.IBinder;
import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.os.Trace;
import android.util.ArrayMap;
import android.util.Log;
@@ -89,34 +88,6 @@ public class KeyguardService extends Service {
    static final String TAG = "KeyguardService";
    static final String PERMISSION = android.Manifest.permission.CONTROL_KEYGUARD;

    /**
     * Run Keyguard animation as remote animation in System UI instead of local animation in
     * 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.
     */
    private static final String ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY =
            "persist.wm.enable_remote_keyguard_animation";

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

    /**
     * @see #ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY
     */
    public static boolean sEnableRemoteKeyguardGoingAwayAnimation =
            sEnableRemoteKeyguardAnimation >= 1;

    /**
     * @see #ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY
     */
    public static boolean sEnableRemoteKeyguardOccludeAnimation =
            sEnableRemoteKeyguardAnimation >= 2;

    private final KeyguardViewMediator mKeyguardViewMediator;
    private final KeyguardLifecyclesDispatcher mKeyguardLifecyclesDispatcher;
    private final ShellTransitions mShellTransitions;
@@ -288,15 +259,12 @@ public class KeyguardService extends Service {

        if (mShellTransitions == null || !Transitions.ENABLE_SHELL_TRANSITIONS) {
            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(
                            mKeyguardViewMediator.getOccludeAnimationRunner(), 0, 0);
@@ -308,24 +276,21 @@ public class KeyguardService extends Service {
                            mKeyguardViewMediator.getUnoccludeAnimationRunner(), 0, 0);
            definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_UNOCCLUDE,
                    unoccludeAnimationAdapter);
            }
            ActivityTaskManager.getInstance().registerRemoteAnimationsForDisplay(
                    DEFAULT_DISPLAY, definition);
            return;
        }
        if (sEnableRemoteKeyguardGoingAwayAnimation) {
        Slog.d(TAG, "KeyguardService registerRemote: TRANSIT_KEYGUARD_GOING_AWAY");
        TransitionFilter f = new TransitionFilter();
        f.mFlags = TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
        mShellTransitions.registerRemote(f,
                new RemoteTransition(wrap(mExitAnimationRunner), getIApplicationThread()));
        }
        if (sEnableRemoteKeyguardOccludeAnimation) {

        Slog.d(TAG, "KeyguardService registerRemote: TRANSIT_KEYGUARD_(UN)OCCLUDE");
        // Register for occluding
        final RemoteTransition occludeTransition = new RemoteTransition(
                mOccludeAnimation, getIApplicationThread());
            TransitionFilter f = new TransitionFilter();
        f = new TransitionFilter();
        f.mFlags = TRANSIT_FLAG_KEYGUARD_LOCKED;
        f.mRequirements = new TransitionFilter.Requirement[]{
                new TransitionFilter.Requirement(), new TransitionFilter.Requirement()};
@@ -379,7 +344,6 @@ public class KeyguardService extends Service {
        f.mTypeSet = new int[]{TRANSIT_KEYGUARD_UNOCCLUDE};
        mShellTransitions.registerRemote(f, unoccludeTransition);
    }
    }

    @Override
    public IBinder onBind(Intent intent) {
+5 −21
Original line number Diff line number Diff line
@@ -484,8 +484,8 @@ class KeyguardUnlockAnimationController @Inject constructor(
            // surface behind the keyguard to finish unlocking.
            if (keyguardStateController.isFlingingToDismissKeyguard) {
                playCannedUnlockAnimation()
            } else if (keyguardStateController.isDismissingFromSwipe
                    && willUnlockWithInWindowLauncherAnimations) {
            } else if (keyguardStateController.isDismissingFromSwipe &&
                    willUnlockWithInWindowLauncherAnimations) {
                // If we're swiping to unlock to the Launcher, and can play in-window animations,
                // make the launcher surface fully visible and play the in-window unlock animation
                // on the launcher icons. System UI will remain locked, using the swipe-to-unlock
@@ -622,10 +622,6 @@ class KeyguardUnlockAnimationController @Inject constructor(
    }

    override fun onKeyguardDismissAmountChanged() {
        if (!willHandleUnlockAnimation()) {
            return
        }

        if (keyguardViewController.isShowing && !playingCannedUnlockAnimation) {
            showOrHideSurfaceIfDismissAmountThresholdsReached()

@@ -685,8 +681,7 @@ class KeyguardUnlockAnimationController @Inject constructor(
     */
    private fun finishKeyguardExitRemoteAnimationIfReachThreshold() {
        // no-op if keyguard is not showing or animation is not enabled.
        if (!KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation ||
                !keyguardViewController.isShowing) {
        if (!keyguardViewController.isShowing) {
            return
        }

@@ -727,8 +722,8 @@ class KeyguardUnlockAnimationController @Inject constructor(

        // If we're dismissing via swipe to the Launcher, we'll play in-window scale animations, so
        // don't also scale the window.
        if (keyguardStateController.isDismissingFromSwipe
                && willUnlockWithInWindowLauncherAnimations) {
        if (keyguardStateController.isDismissingFromSwipe &&
                willUnlockWithInWindowLauncherAnimations) {
            scaleFactor = 1f
        }

@@ -919,17 +914,6 @@ class KeyguardUnlockAnimationController @Inject constructor(
        return willUnlockWithSmartspaceTransition
    }

    /**
     * Whether this animation controller will be handling the unlock. We require remote animations
     * to be enabled to do this.
     *
     * If this is not true, nothing in this class is relevant, and the unlock will be handled in
     * [KeyguardViewMediator].
     */
    fun willHandleUnlockAnimation(): Boolean {
        return KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation
    }

    /**
     * Whether the RemoteAnimation on the app/launcher surface behind the keyguard is 'running'.
     */
+2 −3
Original line number Diff line number Diff line
@@ -2427,7 +2427,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
            LatencyTracker.getInstance(mContext)
                    .onActionEnd(LatencyTracker.ACTION_LOCKSCREEN_UNLOCK);

            if (KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation && runner != null
            if (runner != null
                    && finishedCallback != null) {
                // Wrap finishedCallback to clean up the keyguard state once the animation is done.
                IRemoteAnimationFinishedCallback callback =
@@ -2461,8 +2461,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,

            // When remaining on the shade, there's no need to do a fancy remote animation,
            // it will dismiss the panel in that case.
            } else if (KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation
                    && !mStatusBarStateController.leaveOpenOnKeyguardHide()
            } else if (!mStatusBarStateController.leaveOpenOnKeyguardHide()
                    && apps != null && apps.length > 0) {
                mSurfaceBehindRemoteAnimationFinishedCallback = finishedCallback;
                mSurfaceBehindRemoteAnimationRunning = true;
+0 −9
Original line number Diff line number Diff line
@@ -477,15 +477,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
                if (!wasDeviceInteractive) {
                    mPendingShowBouncer = true;
                } else {
                    // If the keyguard unlock controller is going to handle the unlock animation, it
                    // will fling the panel collapsed when it's ready.
                    if (!mKeyguardUnlockAnimationController.willHandleUnlockAnimation()) {
                        mShadeController.animateCollapsePanels(
                                CommandQueue.FLAG_EXCLUDE_NONE,
                                true /* force */,
                                false /* delayed */,
                                BIOMETRIC_COLLAPSE_SPEEDUP_FACTOR);
                    }
                    mPendingShowBouncer = false;
                    mKeyguardViewController.notifyKeyguardAuthenticated(
                            false /* strongAuth */);
+2 −5
Original line number Diff line number Diff line
@@ -152,7 +152,6 @@ import com.android.systemui.flags.Flags;
import com.android.systemui.fragments.ExtensionFragmentListener;
import com.android.systemui.fragments.FragmentHostManager;
import com.android.systemui.fragments.FragmentService;
import com.android.systemui.keyguard.KeyguardService;
import com.android.systemui.keyguard.KeyguardUnlockAnimationController;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.keyguard.ScreenLifecycle;
@@ -1875,11 +1874,9 @@ public class CentralSurfacesImpl extends CoreStartable implements
            return true;
        }

        // If we are locked and have to dismiss the keyguard, only animate if remote unlock
        // animations are enabled. We also don't animate non-activity launches as they can break the
        // animation.
        // We don't animate non-activity launches as they can break the animation.
        // TODO(b/184121838): Support non activity launches on the lockscreen.
        return isActivityIntent && KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation;
        return isActivityIntent;
    }

    /** Whether we should animate an activity launch. */