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

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

Merge changes Ib103172b,I2f672fb6

* changes:
  Remove flag for keyguard remote animations [2/n]
  Remove flag for keyguard remote animations [1/n]
parents 33d5d471 8e559060
Loading
Loading
Loading
Loading
+37 −40
Original line number Diff line number Diff line
@@ -2082,22 +2082,21 @@ 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_GOING_AWAY transition, SysUI
                // receives IRemoteAnimationRunner#onAnimationStart to start animation, so we don't
                // need to call IKeyguardService#keyguardGoingAway here.
                return handleStartTransitionForKeyguardLw(keyguardGoingAway
                        && !WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation,
                        keyguardOccluding, duration);
                return handleTransitionForKeyguardLw(false /* startKeyguardExitAnimation */,
                        false /* notifyOccluded */);
            }

            @Override
            public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) {
                handleStartTransitionForKeyguardLw(
                        keyguardGoingAway, false /* keyguardOccludingStarted */,
                        0 /* duration */);
            public void onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled,
                    boolean keyguardOccludedCancelled) {
                // When app KEYGUARD_GOING_AWAY or (UN)OCCLUDE app transition is canceled, we need
                // to trigger relevant IKeyguardService calls to sync keyguard status in
                // WindowManagerService and SysUI.
                handleTransitionForKeyguardLw(
                        keyguardGoingAwayCancelled /* startKeyguardExitAnimation */,
                        keyguardOccludedCancelled /* notifyOccluded */);
            }
        });

@@ -3263,31 +3262,39 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            mPendingKeyguardOccluded = occluded;
            mKeyguardOccludedChanged = true;
        } else {
            setKeyguardOccludedLw(occluded, false /* force */,
                    false /* transitionStarted */);
            setKeyguardOccludedLw(occluded, true /* notify */);
        }
    }

    @Override
    public int applyKeyguardOcclusionChange(boolean transitionStarted) {
    public int applyKeyguardOcclusionChange(boolean notify) {
        if (mKeyguardOccludedChanged) {
            if (DEBUG_KEYGUARD) Slog.d(TAG, "transition/occluded changed occluded="
                    + mPendingKeyguardOccluded);
            if (setKeyguardOccludedLw(mPendingKeyguardOccluded, false /* force */,
                    transitionStarted)) {
            if (setKeyguardOccludedLw(mPendingKeyguardOccluded, notify)) {
                return FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_WALLPAPER;
            }
        }
        return 0;
    }

    private int handleStartTransitionForKeyguardLw(boolean keyguardGoingAway,
            boolean keyguardOccluding, long duration) {
        final int redoLayout = applyKeyguardOcclusionChange(keyguardOccluding);
    /**
     * Called when keyguard related app transition starts, or cancelled.
     *
     * @param startKeyguardExitAnimation Trigger IKeyguardService#startKeyguardExitAnimation to
     *                                  start keyguard exit animation.
     * @param notifyOccluded Trigger IKeyguardService#setOccluded binder call to notify whether
     *                      the top activity can occlude the keyguard or not.
     *
     * @return Whether the flags have changed and we have to redo the layout.
     */
    private int handleTransitionForKeyguardLw(boolean startKeyguardExitAnimation,
            boolean notifyOccluded) {
        final int redoLayout = applyKeyguardOcclusionChange(notifyOccluded);
        if (redoLayout != 0) return redoLayout;
        if (keyguardGoingAway) {
        if (startKeyguardExitAnimation) {
            if (DEBUG_KEYGUARD) Slog.d(TAG, "Starting keyguard exit animation");
            startKeyguardExitAnimation(SystemClock.uptimeMillis(), duration);
            startKeyguardExitAnimation(SystemClock.uptimeMillis());
        }
        return 0;
    }
@@ -3519,28 +3526,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
     * Updates the occluded state of the Keyguard.
     *
     * @param isOccluded Whether the Keyguard is occluded by another window.
     * @param force notify the occluded status to KeyguardService and update flags even though
     *             occlude status doesn't change.
     * @param transitionStarted {@code true} if keyguard (un)occluded transition started.
     * @param notify Notify keyguard occlude status change immediately via
     *       {@link com.android.internal.policy.IKeyguardService}.
     * @return Whether the flags have changed and we have to redo the layout.
     */
    private boolean setKeyguardOccludedLw(boolean isOccluded, boolean force,
            boolean transitionStarted) {
    private boolean setKeyguardOccludedLw(boolean isOccluded, boolean notify) {
        if (DEBUG_KEYGUARD) Slog.d(TAG, "setKeyguardOccluded occluded=" + isOccluded);
        mKeyguardOccludedChanged = false;
        if (isKeyguardOccluded() == isOccluded && !force) {
        if (isKeyguardOccluded() == isOccluded) {
            return false;
        }

        final boolean showing = mKeyguardDelegate.isShowing();
        final boolean animate = showing && !isOccluded;
        // When remote animation is enabled for keyguard (un)occlude transition, KeyguardService
        // uses remote animation start as a signal to update its occlusion status ,so we don't need
        // to notify here.
        final boolean notify = !WindowManagerService.sEnableRemoteKeyguardOccludeAnimation
                || !transitionStarted;
        mKeyguardDelegate.setOccluded(isOccluded, animate, notify);
        return showing;
        mKeyguardDelegate.setOccluded(isOccluded, notify);
        return mKeyguardDelegate.isShowing();
    }

    /** {@inheritDoc} */
@@ -4936,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);
        }
    }

+5 −6
Original line number Diff line number Diff line
@@ -171,10 +171,10 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
    void onKeyguardOccludedChangedLw(boolean occluded);

    /**
     * Applies a keyguard occlusion change if one happened.
     * @param transitionStarted Whether keyguard (un)occlude transition is starting or not.
     * @param notify {@code true} if the status change should be immediately notified via
     *        {@link com.android.internal.policy.IKeyguardService}
     */
    int applyKeyguardOcclusionChange(boolean transitionStarted);
    int applyKeyguardOcclusionChange(boolean notify);

    /**
     * Interface to the Window Manager state associated with a particular
@@ -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);
        }
    }

+12 −12
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(),
@@ -416,8 +413,11 @@ public class AppTransition implements Dump {
    }

    void freeze() {
        final boolean keyguardGoingAway = mNextAppTransitionRequests.contains(
        final boolean keyguardGoingAwayCancelled = mNextAppTransitionRequests.contains(
                TRANSIT_KEYGUARD_GOING_AWAY);
        final boolean keyguardOccludedCancelled =
                mNextAppTransitionRequests.contains(TRANSIT_KEYGUARD_OCCLUDE)
                || mNextAppTransitionRequests.contains(TRANSIT_KEYGUARD_UNOCCLUDE);

        // The RemoteAnimationControl didn't register AppTransitionListener and
        // only initialized the finish and timeout callback when goodToGo().
@@ -429,7 +429,7 @@ public class AppTransition implements Dump {
        mNextAppTransitionRequests.clear();
        clear();
        setReady();
        notifyAppTransitionCancelledLocked(keyguardGoingAway);
        notifyAppTransitionCancelledLocked(keyguardGoingAwayCancelled, keyguardOccludedCancelled);
    }

    private void setAppTransitionState(int state) {
@@ -479,9 +479,11 @@ public class AppTransition implements Dump {
        }
    }

    private void notifyAppTransitionCancelledLocked(boolean keyguardGoingAway) {
    private void notifyAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled,
            boolean keyguardOccludedCancelled) {
        for (int i = 0; i < mListeners.size(); i++) {
            mListeners.get(i).onAppTransitionCancelledLocked(keyguardGoingAway);
            mListeners.get(i).onAppTransitionCancelledLocked(keyguardGoingAwayCancelled,
                    keyguardOccludedCancelled);
        }
    }

@@ -491,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