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

Commit 5e0122d1 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/23447960',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/23447960', 'googleplex-android-review.googlesource.com/24314473', 'googleplex-android-review.googlesource.com/24224609'] into udc-release.

Change-Id: I2f33858065e7f76bc8964949e323eb411700aa04
parents 9f02813f b38e61a3
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -1046,7 +1046,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
        boolean allowBlurringLauncher = mLauncher.getStateManager().getState() != OVERVIEW
                && BlurUtils.supportsBlursOnWindows();

        MyDepthController depthController = new MyDepthController(mLauncher);
        LaunchDepthController depthController = new LaunchDepthController(mLauncher);
        ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(depthController.stateDepth,
                        MULTI_PROPERTY_VALUE, BACKGROUND_APP.getDepth(mLauncher))
                .setDuration(APP_LAUNCH_DURATION);
@@ -2047,11 +2047,14 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
        }
    }

    private static class MyDepthController extends DepthController {
        MyDepthController(Launcher l) {
            super(l);
    private static class LaunchDepthController extends DepthController {
        LaunchDepthController(QuickstepLauncher launcher) {
            super(launcher);
            setCrossWindowBlursEnabled(
                    CrossWindowBlurListeners.getInstance().isCrossWindowBlurEnabled());
            // Make sure that the starting value matches the current depth set by the main
            // controller.
            stateDepth.setValue(launcher.getDepthController().stateDepth.getValue());
        }
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -472,6 +472,10 @@ public class QuickstepLauncher extends Launcher {
    public void onDestroy() {
        mAppTransitionManager.onActivityDestroyed();
        if (mUnfoldTransitionProgressProvider != null) {
            if (FeatureFlags.RECEIVE_UNFOLD_EVENTS_FROM_SYSUI.get()) {
                SystemUiProxy.INSTANCE.get(this).setUnfoldAnimationListener(null);
            }

            mUnfoldTransitionProgressProvider.destroy();
        }

+64 −1
Original line number Diff line number Diff line
@@ -60,6 +60,8 @@ public class LauncherUnfoldAnimationController implements OnDeviceProfileChangeL
    private final NaturalRotationUnfoldProgressProvider mNaturalOrientationProgressProvider;
    private final UnfoldMoveFromCenterHotseatAnimator mUnfoldMoveFromCenterHotseatAnimator;
    private final UnfoldMoveFromCenterWorkspaceAnimator mUnfoldMoveFromCenterWorkspaceAnimator;
    private final TransitionStatusProvider mExternalTransitionStatusProvider =
            new TransitionStatusProvider();
    private PreemptiveUnfoldTransitionProgressProvider mPreemptiveProgressProvider = null;
    private Boolean mIsTablet = null;

@@ -88,6 +90,8 @@ public class LauncherUnfoldAnimationController implements OnDeviceProfileChangeL
                    unfoldTransitionProgressProvider);
        }

        unfoldTransitionProgressProvider.addCallback(mExternalTransitionStatusProvider);

        mUnfoldMoveFromCenterHotseatAnimator = new UnfoldMoveFromCenterHotseatAnimator(launcher,
                windowManager, rotationChangeProvider);
        mUnfoldMoveFromCenterWorkspaceAnimator = new UnfoldMoveFromCenterWorkspaceAnimator(launcher,
@@ -166,11 +170,26 @@ public class LauncherUnfoldAnimationController implements OnDeviceProfileChangeL
        }

        if (mIsTablet != null && dp.isTablet != mIsTablet) {
            if (dp.isTablet && SystemUiProxy.INSTANCE.get(mLauncher).isActive()) {
            // We should preemptively start the animation only if:
            // - We changed to the unfolded screen
            // - SystemUI IPC connection is alive, so we won't end up in a situation that we won't
            //   receive transition progress events from SystemUI later because there was no
            //   IPC connection established (e.g. because of SystemUI crash)
            // - SystemUI has not already sent unfold animation progress events. This might happen
            //   if Launcher was not open during unfold, in this case we receive the configuration
            //   change only after we went back to home screen and we don't want to start the
            //   animation in this case.
            if (dp.isTablet
                    && SystemUiProxy.INSTANCE.get(mLauncher).isActive()
                    && !mExternalTransitionStatusProvider.hasRun()) {
                // Preemptively start the unfold animation to make sure that we have drawn
                // the first frame of the animation before the screen gets unblocked
                preemptivelyStartAnimationOnNextFrame();
            }

            if (!dp.isTablet) {
                mExternalTransitionStatusProvider.onFolded();
            }
        }

        mIsTablet = dp.isTablet;
@@ -222,4 +241,48 @@ public class LauncherUnfoldAnimationController implements OnDeviceProfileChangeL
            HOTSEAT_SCALE_PROPERTY.setValue(mLauncher.getHotseat(), value);
        }
    }

    /**
     * Class to track the current status of the external transition provider (the events are coming
     * from the SystemUI side through IPC), it allows to check if the transition has already
     * finished or currently running on the SystemUI side since last unfold.
     */
    private static class TransitionStatusProvider implements TransitionProgressListener {

        private boolean mHasRun = false;

        @Override
        public void onTransitionStarted() {
            markAsRun();
        }

        @Override
        public void onTransitionProgress(float progress) {
            markAsRun();
        }

        @Override
        public void onTransitionFinished() {
            markAsRun();
        }

        /**
         * Called when the device is folded, so we can reset the status of the animation
         */
        public void onFolded() {
            mHasRun = false;
        }

        /**
         * Returns true if there was an animation already (or it is currently running) after
         * unfolding the device
         */
        public boolean hasRun() {
            return mHasRun;
        }

        private void markAsRun() {
            mHasRun = true;
        }
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -331,8 +331,7 @@ public abstract class LauncherState implements BaseState<LauncherState> {
     * Gets the translation provider for workspace pages.
     */
    public PageTranslationProvider getWorkspacePageTranslationProvider(Launcher launcher) {
        if (this != SPRING_LOADED
                || this != EDIT_MODE
        if (!(this == SPRING_LOADED || this == EDIT_MODE)
                || !launcher.getDeviceProfile().isTwoPanels) {
            return DEFAULT_PAGE_TRANSLATION_PROVIDER;
        }
+1 −1
Original line number Diff line number Diff line
@@ -302,7 +302,7 @@ public final class FeatureFlags {
            "Enable widget transition animation when resizing the widgets");

    public static final BooleanFlag PREEMPTIVE_UNFOLD_ANIMATION_START = getDebugFlag(270397209,
            "PREEMPTIVE_UNFOLD_ANIMATION_START", DISABLED,
            "PREEMPTIVE_UNFOLD_ANIMATION_START", ENABLED,
            "Enables starting the unfold animation preemptively when unfolding, without"
                    + "waiting for SystemUI and then merging the SystemUI progress whenever we "
                    + "start receiving the events");