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

Commit acd17dfc authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Removing some new object creation during touch handling

> Motion various transformation methods to Orientation Handler
> Moving orientation handler to quickstep package

Bug: 150300347
Bug: 151269990
Bug: 149610456
Change-Id: I28434c1d1f62a3b85f3583740f0a8f827513fab3
parent 34a9d752
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -46,11 +46,8 @@ import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.model.PagedViewOrientedState;
import com.android.launcher3.states.RotationHelper;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.touch.PortraitPagedViewHandler;
import com.android.launcher3.util.VibratorWrapper;
import com.android.launcher3.views.FloatingIconView;
import com.android.quickstep.BaseActivityInterface.HomeAnimationFactory;
@@ -59,6 +56,7 @@ import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.util.ActivityInitListener;
import com.android.quickstep.util.AppWindowAnimationHelper;
import com.android.quickstep.util.AppWindowAnimationHelper.TransformParams;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
@@ -127,7 +125,7 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
    protected boolean mCanceled;
    protected int mFinishingRecentsAnimationForNewTaskId = -1;

    private PagedViewOrientedState mOrientedState;
    private RecentsOrientedState mOrientedState;

    protected BaseSwipeUpHandler(Context context, RecentsAnimationDeviceState deviceState,
            GestureState gestureState, InputConsumerController inputConsumer) {
@@ -350,9 +348,11 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
            // TODO(b/150300347): The first recents animation after launcher is started with the
            //  foreground app not in landscape will look funky until that bug is fixed
            displayRotation = mOrientedState.getDisplayRotation();

            RectF tempRectF = new RectF(TEMP_RECT);
            mOrientedState.mapRectFromNormalOrientation(tempRectF, dp.widthPx, dp.heightPx);
            tempRectF.roundOut(TEMP_RECT);
        }
        RotationHelper.getTargetRectForRotation(TEMP_RECT, dp.widthPx, dp.heightPx,
            displayRotation);
        mAppWindowAnimationHelper.updateTargetRect(TEMP_RECT);
        if (mDeviceState.isFullyGesturalNavMode()) {
            // We can drag all the way to the top of the screen.
@@ -447,7 +447,7 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten

    protected PagedOrientationHandler getOrientationHandler() {
        if (mOrientedState == null) {
            return new PortraitPagedViewHandler();
            return PagedOrientationHandler.PORTRAIT;
        }
        return mOrientedState.getOrientationHandler();
    }
@@ -468,8 +468,8 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
                    .setTargetSet(mRecentsAnimationTargets)
                    .setLauncherOnTop(false)));
        if (isFloatingIconView) {
            RotationHelper.mapInverseRectFromNormalOrientation(startRect,
                mDp.widthPx, mDp.heightPx, mOrientedState.getDisplayRotation());
            mOrientedState.mapInverseRectFromNormalOrientation(
                    startRect, mDp.widthPx, mDp.heightPx);
        }
        RectFSpringAnim anim = new RectFSpringAnim(startRect, targetRect, mContext);
        if (isFloatingIconView) {
@@ -500,8 +500,8 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten

                rotatedRect.set(currentRect);
                if (isFloatingIconView) {
                    RotationHelper.mapRectFromNormalOrientation(rotatedRect,
                        mDp.widthPx, mDp.heightPx, mOrientedState.getDisplayRotation());
                    mOrientedState.mapRectFromNormalOrientation(
                            rotatedRect, mDp.widthPx, mDp.heightPx);
                    mTransformParams.setCornerRadius(endRadius * progress + startRadius
                        * (1f - progress));
                }
+0 −2
Original line number Diff line number Diff line
@@ -33,8 +33,6 @@ import androidx.annotation.Nullable;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.touch.PortraitPagedViewHandler;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.fallback.FallbackRecentsView;
import com.android.quickstep.util.ActivityInitListener;
+2 −4
Original line number Diff line number Diff line
@@ -40,9 +40,7 @@ import android.view.MotionEvent;
import com.android.launcher3.R;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.touch.LandscapePagedViewHandler;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.touch.PortraitPagedViewHandler;
import com.android.launcher3.util.ObjectWrapper;
import com.android.quickstep.BaseActivityInterface.HomeAnimationFactory;
import com.android.quickstep.GestureState.GestureEndTarget;
@@ -503,8 +501,8 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa
                PagedOrientationHandler orientationHandler = mRecentsView != null
                        ? mRecentsView.getPagedOrientationHandler()
                        : (mDp.isLandscape
                                ? new LandscapePagedViewHandler()
                                : new PortraitPagedViewHandler());
                                ? PagedOrientationHandler.LANDSCAPE
                                : PagedOrientationHandler.PORTRAIT);
                return HomeAnimationFactory
                    .getDefaultWindowTargetRect(orientationHandler, mDp);
            }
+9 −10
Original line number Diff line number Diff line
@@ -15,6 +15,13 @@
 */
package com.android.quickstep.util;

import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;

import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
@@ -33,7 +40,6 @@ import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.model.PagedViewOrientedState;
import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.RemoteAnimationTargets;
import com.android.quickstep.SystemUiProxy;
@@ -47,13 +53,6 @@ import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.
import com.android.systemui.shared.system.TransactionCompat;
import com.android.systemui.shared.system.WindowManagerWrapper;

import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;

/**
 * Utility class to handle window clip animation
 */
@@ -86,7 +85,7 @@ public class AppWindowAnimationHelper {
    private final Rect mTmpRect = new Rect();
    private final RectF mTmpRectF = new RectF();
    private final RectF mCurrentRectWithInsets = new RectF();
    private PagedViewOrientedState mOrientedState;
    private RecentsOrientedState mOrientedState;
    // Corner radius of windows, in pixels
    private final float mWindowCornerRadius;
    // Corner radius of windows when they're in overview mode.
@@ -105,7 +104,7 @@ public class AppWindowAnimationHelper {
    private TargetAlphaProvider mTaskAlphaCallback = (t, a) -> a;
    private TargetAlphaProvider mBaseAlphaCallback = (t, a) -> 1;

    public AppWindowAnimationHelper(PagedViewOrientedState orientedState, Context context) {
    public AppWindowAnimationHelper(RecentsOrientedState orientedState, Context context) {
        Resources res = context.getResources();
        mOrientedState = orientedState;
        mWindowCornerRadius = getWindowCornerRadius(res);
+0 −15
Original line number Diff line number Diff line
@@ -78,21 +78,6 @@ public class ClearAllButton extends Button implements PageCallbacks {
        }
    }

    public void onLayoutChanged() {
        if (mParent == null) {
            return;
        }
        setRotation(mParent.getPagedOrientationHandler().getDegreesRotated());
    }

    public void setRtl(boolean rtl) {
        if (mIsRtl == rtl) {
            return;
        }
        mIsRtl = rtl;
        invalidate();
    }

    public void setVisibilityAlpha(float alpha) {
        if (mVisibilityAlpha != alpha) {
            mVisibilityAlpha = alpha;
Loading