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

Commit 8e559060 authored by Issei Suzuki's avatar Issei Suzuki
Browse files

Remove flag for keyguard remote animations [2/n]

Removed persist.wm.enable_remote_keyguard_animation system property, and
constants in WindowManagerService derived from the property.

Some variables become constant after removal of the system property, so
they are also removed and the logic around them is simplified.

Bug: 242833285
Test: Pass existing tests.
Change-Id: Ib103172b75429bf923515eb7a45c055b12557817
parent f0f72bc7
Loading
Loading
Loading
Loading
+10 −24
Original line number Diff line number Diff line
@@ -2082,20 +2082,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {

        mWindowManagerInternal.registerAppTransitionListener(new AppTransitionListener() {
            @Override
            public int onAppTransitionStartingLocked(boolean keyguardGoingAway,
                    boolean keyguardOccluding, long duration, long statusBarAnimationStartTime,
            public int onAppTransitionStartingLocked(long statusBarAnimationStartTime,
                    long statusBarAnimationDuration) {
                // When remote animation is enabled for keyguard transition, SysUI receives
                // IRemoteAnimationRunner#onAnimationStart to start animation, so we don't
                // need to call IKeyguardService#keyguardGoingAway and #setOccluded.
                final boolean notifyOccluded =
                        !WindowManagerService.sEnableRemoteKeyguardOccludeAnimation
                        && keyguardOccluding;
                final boolean startKeyguardExitAnimation =
                        !WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation
                        && keyguardGoingAway;
                return handleTransitionForKeyguardLw(startKeyguardExitAnimation,
                        notifyOccluded, duration);
                return handleTransitionForKeyguardLw(false /* startKeyguardExitAnimation */,
                        false /* notifyOccluded */);
            }

            @Override
@@ -2106,7 +2096,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                // WindowManagerService and SysUI.
                handleTransitionForKeyguardLw(
                        keyguardGoingAwayCancelled /* startKeyguardExitAnimation */,
                        keyguardOccludedCancelled /* notifyOccluded */, 0 /* duration */);
                        keyguardOccludedCancelled /* notifyOccluded */);
            }
        });

@@ -3295,17 +3285,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
     *                                  start keyguard exit animation.
     * @param notifyOccluded Trigger IKeyguardService#setOccluded binder call to notify whether
     *                      the top activity can occlude the keyguard or not.
     * @param duration the duration of the exit animation, in milliseconds.
     *
     * @return Whether the flags have changed and we have to redo the layout.
     */
    private int handleTransitionForKeyguardLw(boolean startKeyguardExitAnimation,
            boolean notifyOccluded, long duration) {
            boolean notifyOccluded) {
        final int redoLayout = applyKeyguardOcclusionChange(notifyOccluded);
        if (redoLayout != 0) return redoLayout;
        if (startKeyguardExitAnimation) {
            if (DEBUG_KEYGUARD) Slog.d(TAG, "Starting keyguard exit animation");
            startKeyguardExitAnimation(SystemClock.uptimeMillis(), duration);
            startKeyguardExitAnimation(SystemClock.uptimeMillis());
        }
        return 0;
    }
@@ -3547,11 +3536,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        if (isKeyguardOccluded() == isOccluded) {
            return false;
        }

        final boolean showing = mKeyguardDelegate.isShowing();
        final boolean animate = showing && !isOccluded;
        mKeyguardDelegate.setOccluded(isOccluded, animate, notify);
        return showing;
        mKeyguardDelegate.setOccluded(isOccluded, notify);
        return mKeyguardDelegate.isShowing();
    }

    /** {@inheritDoc} */
@@ -4947,10 +4933,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }

    @Override
    public void startKeyguardExitAnimation(long startTime, long fadeoutDuration) {
    public void startKeyguardExitAnimation(long startTime) {
        if (mKeyguardDelegate != null) {
            if (DEBUG_KEYGUARD) Slog.d(TAG, "PWM.startKeyguardExitAnimation");
            mKeyguardDelegate.startKeyguardExitAnimation(startTime, fadeoutDuration);
            mKeyguardDelegate.startKeyguardExitAnimation(startTime);
        }
    }

+2 −3
Original line number Diff line number Diff line
@@ -1129,11 +1129,10 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {

    /**
     * Notifies the keyguard to start fading out.
     *
     *  @param startTime the start time of the animation in uptime milliseconds
     * @param fadeoutDuration the duration of the exit animation, in milliseconds
     *
     */
    void startKeyguardExitAnimation(long startTime, long fadeoutDuration);
    void startKeyguardExitAnimation(long startTime);

    /**
     * Called when System UI has been started.
+5 −5
Original line number Diff line number Diff line
@@ -249,10 +249,10 @@ public class KeyguardServiceDelegate {
        }
    }

    public void setOccluded(boolean isOccluded, boolean animate, boolean notify) {
    public void setOccluded(boolean isOccluded, boolean notify) {
        if (mKeyguardService != null && notify) {
            if (DEBUG) Log.v(TAG, "setOccluded(" + isOccluded + ") animate=" + animate);
            mKeyguardService.setOccluded(isOccluded, animate);
            if (DEBUG) Log.v(TAG, "setOccluded(" + isOccluded + ")");
            mKeyguardService.setOccluded(isOccluded, false /* animate */);
        }
        mKeyguardState.occluded = isOccluded;
    }
@@ -394,9 +394,9 @@ public class KeyguardServiceDelegate {
        }
    }

    public void startKeyguardExitAnimation(long startTime, long fadeoutDuration) {
    public void startKeyguardExitAnimation(long startTime) {
        if (mKeyguardService != null) {
            mKeyguardService.startKeyguardExitAnimation(startTime, fadeoutDuration);
            mKeyguardService.startKeyguardExitAnimation(startTime, 0);
        }
    }

+3 −8
Original line number Diff line number Diff line
@@ -375,9 +375,6 @@ public class AppTransition implements Dump {
        final AnimationAdapter topOpeningAnim = wc != null ? wc.getAnimation() : null;

        int redoLayout = notifyAppTransitionStartingLocked(
                AppTransition.isKeyguardGoingAwayTransitOld(transit),
                AppTransition.isKeyguardOccludeTransitOld(transit),
                topOpeningAnim != null ? topOpeningAnim.getDurationHint() : 0,
                topOpeningAnim != null
                        ? topOpeningAnim.getStatusBarTransitionsStartTime()
                        : SystemClock.uptimeMillis(),
@@ -496,14 +493,12 @@ public class AppTransition implements Dump {
        }
    }

    private int notifyAppTransitionStartingLocked(boolean keyguardGoingAway,
            boolean keyguardOcclude, long duration, long statusBarAnimationStartTime,
    private int notifyAppTransitionStartingLocked(long statusBarAnimationStartTime,
            long statusBarAnimationDuration) {
        int redoLayout = 0;
        for (int i = 0; i < mListeners.size(); i++) {
            redoLayout |= mListeners.get(i).onAppTransitionStartingLocked(keyguardGoingAway,
                    keyguardOcclude, duration, statusBarAnimationStartTime,
                    statusBarAnimationDuration);
            redoLayout |= mListeners.get(i).onAppTransitionStartingLocked(
                    statusBarAnimationStartTime, statusBarAnimationDuration);
        }
        return redoLayout;
    }
+0 −30
Original line number Diff line number Diff line
@@ -20,10 +20,6 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_APP_CRASHED;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER;
import static android.view.WindowManager.TRANSIT_FLAG_OPEN_BEHIND;
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE;
@@ -93,7 +89,6 @@ import android.view.WindowManager.LayoutParams;
import android.view.WindowManager.TransitionFlags;
import android.view.WindowManager.TransitionOldType;
import android.view.WindowManager.TransitionType;
import android.view.animation.Animation;
import android.window.ITaskFragmentOrganizer;

import com.android.internal.annotations.VisibleForTesting;
@@ -295,7 +290,6 @@ public class AppTransitionController {

            final int flags = appTransition.getTransitFlags();
            layoutRedo = appTransition.goodToGo(transit, topOpeningApp);
            handleNonAppWindowsInTransition(transit, flags);
            appTransition.postAnimationCallback();
            appTransition.clear();
        } finally {
@@ -1143,30 +1137,6 @@ public class AppTransitionController {
        }
    }

    private void handleNonAppWindowsInTransition(@TransitionOldType int transit, int flags) {
        if (transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY
                && !WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation) {
            if ((flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER) != 0
                    && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) == 0
                    && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION) == 0) {
                Animation anim = mService.mPolicy.createKeyguardWallpaperExit(
                        (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE) != 0);
                if (anim != null) {
                    anim.scaleCurrentDuration(mService.getTransitionAnimationScaleLocked());
                    mDisplayContent.mWallpaperController.startWallpaperAnimation(anim);
                }
            }
        }
        if ((transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY
                || transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER)
                && !WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation) {
            mDisplayContent.startKeyguardExitOnNonAppWindows(
                    transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
                    (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE) != 0,
                    (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION) != 0);
        }
    }

    private boolean transitionGoodToGo(ArraySet<? extends WindowContainer> apps,
            ArrayMap<WindowContainer, Integer> outReasons) {
        ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
Loading