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

Commit 95327177 authored by Johannes Gallmann's avatar Johannes Gallmann Committed by Android (Google) Code Review
Browse files

Merge changes I05d517a7,Ided0a095 into main

* changes:
  Minor clenaup in LauncherBackAnimationController
  Fix window corner radius for predictive back to home on Felix
parents 09f29f74 0614de59
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1161,6 +1161,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
        SystemUiProxy.INSTANCE.get(mLauncher)
                .registerRemoteTransition(mLauncherOpenTransition, homeCheck);
        if (mBackAnimationController != null) {
            mBackAnimationController.registerComponentCallbacks();
            mBackAnimationController.registerBackCallbacks(mHandler);
        }
    }
@@ -1168,6 +1169,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
    public void onActivityDestroyed() {
        unregisterRemoteAnimations();
        unregisterRemoteTransitions();
        mLauncher.removeOnDeviceProfileChangeListener(this);
        SystemUiProxy.INSTANCE.get(mLauncher).setStartingWindowListener(null);
        ORDERED_BG_EXECUTOR.execute(() -> mLauncher.getContentResolver()
                .unregisterContentObserver(mAnimationRemovalObserver));
@@ -1200,6 +1202,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
        mWallpaperOpenTransitionRunner = null;
        if (mBackAnimationController != null) {
            mBackAnimationController.unregisterBackCallbacks();
            mBackAnimationController.unregisterComponentCallbacks();
            mBackAnimationController = null;
        }
    }
+41 −14
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.content.ComponentCallbacks;
import android.content.res.Configuration;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.graphics.Rect;
@@ -99,44 +101,45 @@ public class LauncherBackAnimationController {
    private final RectF mCurrentRect = new RectF();
    private final QuickstepLauncher mLauncher;
    private final int mWindowScaleMarginX;
    /** Max window translation in the Y axis. */
    private final int mWindowMaxDeltaY;
    private final float mWindowScaleEndCornerRadius;
    private final float mWindowScaleStartCornerRadius;
    private float mWindowScaleEndCornerRadius;
    private float mWindowScaleStartCornerRadius;
    private final Interpolator mCancelInterpolator;
    private final Interpolator mProgressInterpolator = new DecelerateInterpolator();
    private final PointF mInitialTouchPos = new PointF();

    private RemoteAnimationTarget mBackTarget;
    private View mLauncherTargetView;
    private SurfaceControl.Transaction mTransaction = new SurfaceControl.Transaction();
    private final SurfaceControl.Transaction mTransaction = new SurfaceControl.Transaction();
    private boolean mSpringAnimationInProgress = false;
    private boolean mAnimatorSetInProgress = false;
    private float mBackProgress = 0;
    private boolean mBackInProgress = false;
    private OnBackInvokedCallbackStub mBackCallback;
    private IRemoteAnimationFinishedCallback mAnimationFinishedCallback;
    private BackProgressAnimator mProgressAnimator = new BackProgressAnimator();
    private final BackProgressAnimator mProgressAnimator = new BackProgressAnimator();
    private SurfaceControl mScrimLayer;
    private ValueAnimator mScrimAlphaAnimator;
    private float mScrimAlpha;
    private boolean mOverridingStatusBarFlags;

    private final ComponentCallbacks mComponentCallbacks = new ComponentCallbacks() {
        @Override
        public void onConfigurationChanged(Configuration newConfig) {
            loadCornerRadius();
        }

        @Override
        public void onLowMemory() {}
    };

    public LauncherBackAnimationController(
            QuickstepLauncher launcher,
            QuickstepTransitionManager quickstepTransitionManager) {
        mLauncher = launcher;
        mQuickstepTransitionManager = quickstepTransitionManager;
        mWindowScaleEndCornerRadius = QuickStepContract.supportsRoundedCornersOnWindows(
                mLauncher.getResources())
                ? mLauncher.getResources().getDimensionPixelSize(
                        R.dimen.swipe_back_window_corner_radius)
                : 0;
        mWindowScaleStartCornerRadius = QuickStepContract.getWindowCornerRadius(mLauncher);
        loadCornerRadius();
        mWindowScaleMarginX = mLauncher.getResources().getDimensionPixelSize(
                R.dimen.swipe_back_window_scale_x_margin);
        mWindowMaxDeltaY = mLauncher.getResources().getDimensionPixelSize(
                R.dimen.swipe_back_window_max_delta_y);
        mCancelInterpolator =
                AnimationUtils.loadInterpolator(mLauncher, R.interpolator.standard_interpolator);
    }
@@ -548,6 +551,30 @@ public class LauncherBackAnimationController {
        anim.start();
    }

    private void loadCornerRadius() {
        mWindowScaleEndCornerRadius = QuickStepContract.supportsRoundedCornersOnWindows(
                mLauncher.getResources())
                ? mLauncher.getResources().getDimensionPixelSize(
                R.dimen.swipe_back_window_corner_radius)
                : 0;
        mWindowScaleStartCornerRadius = QuickStepContract.getWindowCornerRadius(mLauncher);
    }

    /**
     * Called when launcher is destroyed. Unregisters component callbacks to avoid memory leaks.
     */
    public void unregisterComponentCallbacks() {
        mLauncher.unregisterComponentCallbacks(mComponentCallbacks);
    }

    /**
     * Registers component callbacks with the launcher to receive configuration change events.
     */
    public void registerComponentCallbacks() {
        mLauncher.registerComponentCallbacks(mComponentCallbacks);
    }


    private void resetScrim() {
        removeScrimLayer();
        mScrimAlpha = 0;
+0 −1
Original line number Diff line number Diff line
@@ -201,7 +201,6 @@

    <!-- Swipe back to home related -->
    <dimen name="swipe_back_window_scale_x_margin">10dp</dimen>
    <dimen name="swipe_back_window_max_delta_y">160dp</dimen>
    <dimen name="swipe_back_window_corner_radius">40dp</dimen>

    <!-- The duration of the bottom sheet opening and closing animation -->