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

Commit c09e8fbe authored by Tony Wickham's avatar Tony Wickham Committed by Android (Google) Code Review
Browse files

Merge "Remove mPendingCallback from ActivityTracker" into ub-launcher3-rvc-dev

parents e0f58a0f 73ff6dde
Loading
Loading
Loading
Loading
+7 −6
Original line number Original line Diff line number Diff line
@@ -31,7 +31,6 @@ import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.RectF;
import android.os.Build;
import android.os.Build;
import android.util.Log;
import android.util.Pair;
import android.util.Pair;
import android.view.MotionEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View;
@@ -46,7 +45,6 @@ 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.testing.TestProtocol;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.util.VibratorWrapper;
import com.android.launcher3.util.VibratorWrapper;
import com.android.launcher3.views.FloatingIconView;
import com.android.launcher3.views.FloatingIconView;
@@ -133,8 +131,7 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
        mDeviceState = deviceState;
        mDeviceState = deviceState;
        mGestureState = gestureState;
        mGestureState = gestureState;
        mActivityInterface = gestureState.getActivityInterface();
        mActivityInterface = gestureState.getActivityInterface();
        mActivityInitListener =
        mActivityInitListener = mActivityInterface.createActivityInitListener(this::onActivityInit);
                mActivityInterface.createActivityInitListener(this::onActivityInit);
        mInputConsumer = inputConsumer;
        mInputConsumer = inputConsumer;
        mAppWindowAnimationHelper = new AppWindowAnimationHelper(context);
        mAppWindowAnimationHelper = new AppWindowAnimationHelper(context);
        mPageSpacing = context.getResources().getDimensionPixelSize(R.dimen.recents_page_spacing);
        mPageSpacing = context.getResources().getDimensionPixelSize(R.dimen.recents_page_spacing);
@@ -395,11 +392,15 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten


    public void setIsLikelyToStartNewTask(boolean isLikelyToStartNewTask) { }
    public void setIsLikelyToStartNewTask(boolean isLikelyToStartNewTask) { }


    public void initWhenReady() {
    /**
     * Registers a callback to run when the activity is ready.
     * @param intent The intent that will be used to start the activity if it doesn't exist already.
     */
    public void initWhenReady(Intent intent) {
        // Preload the plan
        // Preload the plan
        RecentsModel.INSTANCE.get(mContext).getTasks(null);
        RecentsModel.INSTANCE.get(mContext).getTasks(null);


        mActivityInitListener.register();
        mActivityInitListener.register(intent);
    }
    }


    /**
    /**
+2 −2
Original line number Original line Diff line number Diff line
@@ -188,10 +188,10 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa
    }
    }


    @Override
    @Override
    public void initWhenReady() {
    public void initWhenReady(Intent intent) {
        if (mInQuickSwitchMode) {
        if (mInQuickSwitchMode) {
            // Only init if we are in quickswitch mode
            // Only init if we are in quickswitch mode
            super.initWhenReady();
            super.initWhenReady(intent);
        }
        }
    }
    }


+5 −10
Original line number Original line Diff line number Diff line
@@ -90,7 +90,6 @@ import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver;
import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver;
import com.android.systemui.shared.system.InputConsumerController;
import com.android.systemui.shared.system.InputConsumerController;
import com.android.systemui.shared.system.InputMonitorCompat;
import com.android.systemui.shared.system.InputMonitorCompat;
import com.android.systemui.shared.system.RecentsAnimationListener;
import com.android.systemui.shared.tracing.ProtoTraceable;
import com.android.systemui.shared.tracing.ProtoTraceable;


import java.io.FileDescriptor;
import java.io.FileDescriptor;
@@ -739,12 +738,14 @@ public class TouchInteractionService extends Service implements PluginListener<O


        final BaseActivityInterface<BaseDraggingActivity> activityInterface =
        final BaseActivityInterface<BaseDraggingActivity> activityInterface =
                mOverviewComponentObserver.getActivityInterface();
                mOverviewComponentObserver.getActivityInterface();
        final Intent overviewIntent = new Intent(
                mOverviewComponentObserver.getOverviewIntentIgnoreSysUiState());
        if (activityInterface.getCreatedActivity() == null) {
        if (activityInterface.getCreatedActivity() == null) {
            // Make sure that UI states will be initialized.
            // Make sure that UI states will be initialized.
            activityInterface.createActivityInitListener((wasVisible) -> {
            activityInterface.createActivityInitListener((wasVisible) -> {
                AppLaunchTracker.INSTANCE.get(TouchInteractionService.this);
                AppLaunchTracker.INSTANCE.get(TouchInteractionService.this);
                return false;
                return false;
            }).register();
            }).register(overviewIntent);
        } else if (fromInit) {
        } else if (fromInit) {
            // The activity has been created before the initialization of overview service. It is
            // The activity has been created before the initialization of overview service. It is
            // usually happens when booting or launcher is the top activity, so we should already
            // usually happens when booting or launcher is the top activity, so we should already
@@ -752,8 +753,7 @@ public class TouchInteractionService extends Service implements PluginListener<O
            return;
            return;
        }
        }


        mTaskAnimationManager.preloadRecentsAnimation(
        mTaskAnimationManager.preloadRecentsAnimation(overviewIntent);
                mOverviewComponentObserver.getOverviewIntentIgnoreSysUiState());
    }
    }


    @Override
    @Override
@@ -858,11 +858,6 @@ public class TouchInteractionService extends Service implements PluginListener<O
        }
        }
    }
    }


    public static void startRecentsActivityAsync(Intent intent, RecentsAnimationListener listener) {
        UI_HELPER_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance()
                .startRecentsActivity(intent, null, listener, null, null));
    }

    @Override
    @Override
    public void onPluginConnected(OverscrollPlugin overscrollPlugin, Context context) {
    public void onPluginConnected(OverscrollPlugin overscrollPlugin, Context context) {
        mOverscrollPlugin = overscrollPlugin;
        mOverscrollPlugin = overscrollPlugin;
+2 −2
Original line number Original line Diff line number Diff line
@@ -333,7 +333,8 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
                mTaskAnimationManager.isRecentsAnimationRunning(), isLikelyToStartNewTask);
                mTaskAnimationManager.isRecentsAnimationRunning(), isLikelyToStartNewTask);
        mInteractionHandler.setGestureEndCallback(this::onInteractionGestureFinished);
        mInteractionHandler.setGestureEndCallback(this::onInteractionGestureFinished);
        mMotionPauseDetector.setOnMotionPauseListener(mInteractionHandler::onMotionPauseChanged);
        mMotionPauseDetector.setOnMotionPauseListener(mInteractionHandler::onMotionPauseChanged);
        mInteractionHandler.initWhenReady();
        Intent intent = new Intent(mInteractionHandler.getLaunchIntent());
        mInteractionHandler.initWhenReady(intent);


        if (mTaskAnimationManager.isRecentsAnimationRunning()) {
        if (mTaskAnimationManager.isRecentsAnimationRunning()) {
            mActiveCallbacks = mTaskAnimationManager.continueRecentsAnimation(mGestureState);
            mActiveCallbacks = mTaskAnimationManager.continueRecentsAnimation(mGestureState);
@@ -341,7 +342,6 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
            mTaskAnimationManager.notifyRecentsAnimationState(mInteractionHandler);
            mTaskAnimationManager.notifyRecentsAnimationState(mInteractionHandler);
            notifyGestureStarted();
            notifyGestureStarted();
        } else {
        } else {
            Intent intent = mInteractionHandler.getLaunchIntent();
            intent.putExtra(INTENT_EXTRA_LOG_TRACE_ID, mGestureState.getGestureId());
            intent.putExtra(INTENT_EXTRA_LOG_TRACE_ID, mGestureState.getGestureId());
            mActiveCallbacks = mTaskAnimationManager.startRecentsAnimation(mGestureState, intent,
            mActiveCallbacks = mTaskAnimationManager.startRecentsAnimation(mGestureState, intent,
                    mInteractionHandler);
                    mInteractionHandler);
+11 −17
Original line number Original line Diff line number Diff line
@@ -36,17 +36,14 @@ import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.R;
import com.android.launcher3.R;
import com.android.quickstep.GestureState;
import com.android.quickstep.GestureState;
import com.android.quickstep.InputConsumer;
import com.android.quickstep.InputConsumer;
import com.android.quickstep.views.LauncherRecentsView;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.plugins.OverscrollPlugin;
import com.android.systemui.plugins.OverscrollPlugin;
import com.android.systemui.shared.system.InputMonitorCompat;
import com.android.systemui.shared.system.InputMonitorCompat;


/**
/**
 * Input consumer for handling events to pass to an {@code OverscrollPlugin}.
 * Input consumer for handling events to pass to an {@code OverscrollPlugin}.
 *
 * @param <T> Draggable activity subclass used by RecentsView
 */
 */
public class OverscrollInputConsumer<T extends BaseDraggingActivity> extends DelegateInputConsumer {
public class OverscrollInputConsumer extends DelegateInputConsumer {


    private static final String TAG = "OverscrollInputConsumer";
    private static final String TAG = "OverscrollInputConsumer";


@@ -61,12 +58,12 @@ public class OverscrollInputConsumer<T extends BaseDraggingActivity> extends Del


    private final float mSquaredSlop;
    private final float mSquaredSlop;


    private final Context mContext;
    private final GestureState mGestureState;
    private final GestureState mGestureState;
    @Nullable
    @Nullable
    private final OverscrollPlugin mPlugin;
    private final OverscrollPlugin mPlugin;
    private final GestureDetector mGestureDetector;
    private final GestureDetector mGestureDetector;


    @Nullable
    private RecentsView mRecentsView;
    private RecentsView mRecentsView;


    public OverscrollInputConsumer(Context context, GestureState gestureState,
    public OverscrollInputConsumer(Context context, GestureState gestureState,
@@ -77,7 +74,6 @@ public class OverscrollInputConsumer<T extends BaseDraggingActivity> extends Del
                .getInteger(R.integer.assistant_gesture_corner_deg_threshold);
                .getInteger(R.integer.assistant_gesture_corner_deg_threshold);
        mFlingThresholdPx = context.getResources()
        mFlingThresholdPx = context.getResources()
            .getDimension(R.dimen.gestures_overscroll_fling_threshold);
            .getDimension(R.dimen.gestures_overscroll_fling_threshold);
        mContext = context;
        mGestureState = gestureState;
        mGestureState = gestureState;
        mPlugin = plugin;
        mPlugin = plugin;


@@ -85,9 +81,6 @@ public class OverscrollInputConsumer<T extends BaseDraggingActivity> extends Del


        mSquaredSlop = slop * slop;
        mSquaredSlop = slop * slop;
        mGestureDetector = new GestureDetector(context, new FlingGestureListener());
        mGestureDetector = new GestureDetector(context, new FlingGestureListener());

        gestureState.getActivityInterface().createActivityInitListener(this::onActivityInit)
                .register();
    }
    }


    @Override
    @Override
@@ -95,12 +88,6 @@ public class OverscrollInputConsumer<T extends BaseDraggingActivity> extends Del
        return TYPE_OVERSCROLL | mDelegate.getType();
        return TYPE_OVERSCROLL | mDelegate.getType();
    }
    }


    private boolean onActivityInit(Boolean alreadyOnHome) {
        mRecentsView = mGestureState.getActivityInterface().getCreatedActivity().getOverviewPanel();

        return true;
    }

    @Override
    @Override
    public void onMotionEvent(MotionEvent ev) {
    public void onMotionEvent(MotionEvent ev) {
        switch (ev.getActionMasked()) {
        switch (ev.getActionMasked()) {
@@ -191,10 +178,17 @@ public class OverscrollInputConsumer<T extends BaseDraggingActivity> extends Del
    }
    }


    private boolean isOverscrolled() {
    private boolean isOverscrolled() {
        if (mRecentsView == null) {
            BaseDraggingActivity activity = mGestureState.getActivityInterface()
                    .getCreatedActivity();
            if (activity != null) {
                mRecentsView = activity.getOverviewPanel();
            }
        }

        // Make sure there isn't an app to quick switch to on our right
        // Make sure there isn't an app to quick switch to on our right
        int maxIndex = 0;
        int maxIndex = 0;
        if ((mRecentsView instanceof LauncherRecentsView)
        if (mRecentsView != null && mRecentsView.hasRecentsExtraCard()) {
                && ((LauncherRecentsView) mRecentsView).hasRecentsExtraCard()) {
            maxIndex = 1;
            maxIndex = 1;
        }
        }


Loading