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

Commit badd58ce authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Removing some new object creation during touch handling" into ub-launcher3-master

parents 56265832 acd17dfc
Loading
Loading
Loading
Loading
+11 −11
Original line number Original line Diff line number Diff line
@@ -46,11 +46,8 @@ import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
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.testing.TestProtocol;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.touch.PortraitPagedViewHandler;
import com.android.launcher3.util.VibratorWrapper;
import com.android.launcher3.util.VibratorWrapper;
import com.android.launcher3.views.FloatingIconView;
import com.android.launcher3.views.FloatingIconView;
import com.android.quickstep.BaseActivityInterface.HomeAnimationFactory;
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.ActivityInitListener;
import com.android.quickstep.util.AppWindowAnimationHelper;
import com.android.quickstep.util.AppWindowAnimationHelper;
import com.android.quickstep.util.AppWindowAnimationHelper.TransformParams;
import com.android.quickstep.util.AppWindowAnimationHelper.TransformParams;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.quickstep.views.TaskView;
@@ -127,7 +125,7 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
    protected boolean mCanceled;
    protected boolean mCanceled;
    protected int mFinishingRecentsAnimationForNewTaskId = -1;
    protected int mFinishingRecentsAnimationForNewTaskId = -1;


    private PagedViewOrientedState mOrientedState;
    private RecentsOrientedState mOrientedState;


    protected BaseSwipeUpHandler(Context context, RecentsAnimationDeviceState deviceState,
    protected BaseSwipeUpHandler(Context context, RecentsAnimationDeviceState deviceState,
            GestureState gestureState, InputConsumerController inputConsumer) {
            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
            // 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
            //  foreground app not in landscape will look funky until that bug is fixed
            displayRotation = mOrientedState.getDisplayRotation();
            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);
        mAppWindowAnimationHelper.updateTargetRect(TEMP_RECT);
        if (mDeviceState.isFullyGesturalNavMode()) {
        if (mDeviceState.isFullyGesturalNavMode()) {
            // We can drag all the way to the top of the screen.
            // 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() {
    protected PagedOrientationHandler getOrientationHandler() {
        if (mOrientedState == null) {
        if (mOrientedState == null) {
            return new PortraitPagedViewHandler();
            return PagedOrientationHandler.PORTRAIT;
        }
        }
        return mOrientedState.getOrientationHandler();
        return mOrientedState.getOrientationHandler();
    }
    }
@@ -468,8 +468,8 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
                    .setTargetSet(mRecentsAnimationTargets)
                    .setTargetSet(mRecentsAnimationTargets)
                    .setLauncherOnTop(false)));
                    .setLauncherOnTop(false)));
        if (isFloatingIconView) {
        if (isFloatingIconView) {
            RotationHelper.mapInverseRectFromNormalOrientation(startRect,
            mOrientedState.mapInverseRectFromNormalOrientation(
                mDp.widthPx, mDp.heightPx, mOrientedState.getDisplayRotation());
                    startRect, mDp.widthPx, mDp.heightPx);
        }
        }
        RectFSpringAnim anim = new RectFSpringAnim(startRect, targetRect, mContext);
        RectFSpringAnim anim = new RectFSpringAnim(startRect, targetRect, mContext);
        if (isFloatingIconView) {
        if (isFloatingIconView) {
@@ -500,8 +500,8 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten


                rotatedRect.set(currentRect);
                rotatedRect.set(currentRect);
                if (isFloatingIconView) {
                if (isFloatingIconView) {
                    RotationHelper.mapRectFromNormalOrientation(rotatedRect,
                    mOrientedState.mapRectFromNormalOrientation(
                        mDp.widthPx, mDp.heightPx, mOrientedState.getDisplayRotation());
                            rotatedRect, mDp.widthPx, mDp.heightPx);
                    mTransformParams.setCornerRadius(endRadius * progress + startRadius
                    mTransformParams.setCornerRadius(endRadius * progress + startRadius
                        * (1f - progress));
                        * (1f - progress));
                }
                }
+0 −2
Original line number Original line Diff line number Diff line
@@ -33,8 +33,6 @@ import androidx.annotation.Nullable;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
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.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.fallback.FallbackRecentsView;
import com.android.quickstep.fallback.FallbackRecentsView;
import com.android.quickstep.util.ActivityInitListener;
import com.android.quickstep.util.ActivityInitListener;
+2 −4
Original line number Original line Diff line number Diff line
@@ -40,9 +40,7 @@ import android.view.MotionEvent;
import com.android.launcher3.R;
import com.android.launcher3.R;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.touch.LandscapePagedViewHandler;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.touch.PortraitPagedViewHandler;
import com.android.launcher3.util.ObjectWrapper;
import com.android.launcher3.util.ObjectWrapper;
import com.android.quickstep.BaseActivityInterface.HomeAnimationFactory;
import com.android.quickstep.BaseActivityInterface.HomeAnimationFactory;
import com.android.quickstep.GestureState.GestureEndTarget;
import com.android.quickstep.GestureState.GestureEndTarget;
@@ -503,8 +501,8 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa
                PagedOrientationHandler orientationHandler = mRecentsView != null
                PagedOrientationHandler orientationHandler = mRecentsView != null
                        ? mRecentsView.getPagedOrientationHandler()
                        ? mRecentsView.getPagedOrientationHandler()
                        : (mDp.isLandscape
                        : (mDp.isLandscape
                                ? new LandscapePagedViewHandler()
                                ? PagedOrientationHandler.LANDSCAPE
                                : new PortraitPagedViewHandler());
                                : PagedOrientationHandler.PORTRAIT);
                return HomeAnimationFactory
                return HomeAnimationFactory
                    .getDefaultWindowTargetRect(orientationHandler, mDp);
                    .getDefaultWindowTargetRect(orientationHandler, mDp);
            }
            }
+9 −10
Original line number Original line Diff line number Diff line
@@ -15,6 +15,13 @@
 */
 */
package com.android.quickstep.util;
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.annotation.TargetApi;
import android.content.Context;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.Resources;
@@ -33,7 +40,6 @@ import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.model.PagedViewOrientedState;
import com.android.launcher3.views.BaseDragLayer;
import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.RemoteAnimationTargets;
import com.android.quickstep.RemoteAnimationTargets;
import com.android.quickstep.SystemUiProxy;
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.TransactionCompat;
import com.android.systemui.shared.system.WindowManagerWrapper;
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
 * Utility class to handle window clip animation
 */
 */
@@ -86,7 +85,7 @@ public class AppWindowAnimationHelper {
    private final Rect mTmpRect = new Rect();
    private final Rect mTmpRect = new Rect();
    private final RectF mTmpRectF = new RectF();
    private final RectF mTmpRectF = new RectF();
    private final RectF mCurrentRectWithInsets = new RectF();
    private final RectF mCurrentRectWithInsets = new RectF();
    private PagedViewOrientedState mOrientedState;
    private RecentsOrientedState mOrientedState;
    // Corner radius of windows, in pixels
    // Corner radius of windows, in pixels
    private final float mWindowCornerRadius;
    private final float mWindowCornerRadius;
    // Corner radius of windows when they're in overview mode.
    // 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 mTaskAlphaCallback = (t, a) -> a;
    private TargetAlphaProvider mBaseAlphaCallback = (t, a) -> 1;
    private TargetAlphaProvider mBaseAlphaCallback = (t, a) -> 1;


    public AppWindowAnimationHelper(PagedViewOrientedState orientedState, Context context) {
    public AppWindowAnimationHelper(RecentsOrientedState orientedState, Context context) {
        Resources res = context.getResources();
        Resources res = context.getResources();
        mOrientedState = orientedState;
        mOrientedState = orientedState;
        mWindowCornerRadius = getWindowCornerRadius(res);
        mWindowCornerRadius = getWindowCornerRadius(res);
+0 −15
Original line number Original line 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) {
    public void setVisibilityAlpha(float alpha) {
        if (mVisibilityAlpha != alpha) {
        if (mVisibilityAlpha != alpha) {
            mVisibilityAlpha = alpha;
            mVisibilityAlpha = alpha;
Loading