8/ Rename ActivityControlHelper
- ActivityControlHelper -> BaseActivityInterface
LauncherActivityControlHelper -> LauncherActivityInterface
FallbackActivityControlHelper -> FallbackActivityInterface
QuickCaptureTouchConsumer -> QuickCaptureInputConsumer
- Move gestures to use the activity interface from the gesture state
Bug: 141886704
Change-Id: I6f12daeb03d564143404767dfe4576e3e5da2a1d
diff --git a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
index f31cf37..6b50088 100644
--- a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
+++ b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
@@ -46,12 +46,12 @@
RemoteAnimationProvider {
private static final String TAG = "AppToOverviewAnimationProvider";
- private final ActivityControlHelper<T> mHelper;
+ private final BaseActivityInterface<T> mHelper;
private final int mTargetTaskId;
private IconRecentsView mRecentsView;
private AppToOverviewAnimationListener mAnimationReadyListener;
- AppToOverviewAnimationProvider(ActivityControlHelper<T> helper, int targetTaskId) {
+ AppToOverviewAnimationProvider(BaseActivityInterface<T> helper, int targetTaskId) {
mHelper = helper;
mTargetTaskId = targetTaskId;
}
@@ -75,7 +75,7 @@
if (mAnimationReadyListener != null) {
mAnimationReadyListener.onActivityReady(activity);
}
- ActivityControlHelper.AnimationFactory factory =
+ BaseActivityInterface.AnimationFactory factory =
mHelper.prepareRecentsUI(activity, wasVisible,
false /* animate activity */, (controller) -> {
controller.dispatchOnStart();
@@ -85,7 +85,7 @@
anim.start();
});
factory.onRemoteAnimationReceived(null);
- factory.createActivityController(getRecentsLaunchDuration());
+ factory.createActivityInterface(getRecentsLaunchDuration());
mRecentsView = activity.getOverviewPanel();
return false;
}
diff --git a/go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java b/go/quickstep/src/com/android/quickstep/FallbackActivityInterface.java
similarity index 90%
rename from go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java
rename to go/quickstep/src/com/android/quickstep/FallbackActivityInterface.java
index ee860ab..2af8441 100644
--- a/go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java
+++ b/go/quickstep/src/com/android/quickstep/FallbackActivityInterface.java
@@ -33,14 +33,14 @@
import java.util.function.Consumer;
/**
- * {@link ActivityControlHelper} for recents when the default launcher is different than the
+ * {@link BaseActivityInterface} for recents when the default launcher is different than the
* currently running one and apps should interact with the {@link RecentsActivity} as opposed
* to the in-launcher one.
*/
-public final class FallbackActivityControllerHelper extends
- GoActivityControlHelper<RecentsActivity> {
+public final class FallbackActivityInterface extends
+ GoActivityInterface<RecentsActivity> {
- public FallbackActivityControllerHelper() { }
+ public FallbackActivityInterface() { }
@Override
public AnimationFactory prepareRecentsUI(RecentsActivity activity, boolean activityVisible,
@@ -63,12 +63,12 @@
if (!isAnimatingToRecents) {
rv.setAlpha(1);
}
- createActivityController(getSwipeUpDestinationAndLength(
+ createActivityInterface(getSwipeUpDestinationAndLength(
activity.getDeviceProfile(), activity, new Rect()));
}
@Override
- public void createActivityController(long transitionLength) {
+ public void createActivityInterface(long transitionLength) {
if (!isAnimatingToRecents) {
return;
}
diff --git a/go/quickstep/src/com/android/quickstep/GoActivityControlHelper.java b/go/quickstep/src/com/android/quickstep/GoActivityInterface.java
similarity index 93%
rename from go/quickstep/src/com/android/quickstep/GoActivityControlHelper.java
rename to go/quickstep/src/com/android/quickstep/GoActivityInterface.java
index 274a347..5ce0f4c 100644
--- a/go/quickstep/src/com/android/quickstep/GoActivityControlHelper.java
+++ b/go/quickstep/src/com/android/quickstep/GoActivityInterface.java
@@ -13,8 +13,8 @@
*
* @param <T> activity that contains the overview
*/
-public abstract class GoActivityControlHelper<T extends BaseDraggingActivity> implements
- ActivityControlHelper<T> {
+public abstract class GoActivityInterface<T extends BaseDraggingActivity> implements
+ BaseActivityInterface<T> {
@Override
public void onTransitionCancelled(T activity, boolean activityVisible) {
diff --git a/go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java b/go/quickstep/src/com/android/quickstep/LauncherActivityInterface.java
similarity index 93%
rename from go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java
rename to go/quickstep/src/com/android/quickstep/LauncherActivityInterface.java
index 8993b67..5bff8e8 100644
--- a/go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java
+++ b/go/quickstep/src/com/android/quickstep/LauncherActivityInterface.java
@@ -30,10 +30,10 @@
import java.util.function.Consumer;
/**
- * {@link ActivityControlHelper} for the in-launcher recents.
+ * {@link BaseActivityInterface} for the in-launcher recents.
* TODO: Implement the app to overview animation functionality
*/
-public final class LauncherActivityControllerHelper extends GoActivityControlHelper<Launcher> {
+public final class LauncherActivityInterface extends GoActivityInterface<Launcher> {
@Override
public AnimationFactory prepareRecentsUI(Launcher activity,
@@ -43,8 +43,7 @@
activity.<IconRecentsView>getOverviewPanel().setUsingRemoteAnimation(true);
//TODO: Implement this based off where the recents view needs to be for app => recents anim.
return new AnimationFactory() {
- @Override
- public void createActivityController(long transitionLength) {
+ public void createActivityInterface(long transitionLength) {
callback.accept(activity.getStateManager().createAnimationToNewWorkspace(
fromState, OVERVIEW, transitionLength));
}
diff --git a/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
index f65109a..a436ce7 100644
--- a/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
+++ b/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
@@ -101,7 +101,7 @@
private class RecentsActivityCommand<T extends BaseDraggingActivity> implements Runnable {
- protected final ActivityControlHelper<T> mHelper;
+ protected final BaseActivityInterface<T> mHelper;
private final long mCreateTime;
private final long mToggleClickedTime = SystemClock.uptimeMillis();
@@ -109,7 +109,7 @@
private ActivityInitListener<T> mListener;
public RecentsActivityCommand() {
- mHelper = mOverviewComponentObserver.getActivityControlHelper();
+ mHelper = mOverviewComponentObserver.getActivityInterface();
mCreateTime = SystemClock.elapsedRealtime();
// Preload the plan
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java
index 3eab5ac..8a11ac8 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java
@@ -48,14 +48,14 @@
private static final long RECENTS_LAUNCH_DURATION = 250;
private static final String TAG = "AppToOverviewAnimationProvider";
- private final ActivityControlHelper<T> mHelper;
+ private final BaseActivityInterface<T> mHelper;
// The id of the currently running task that is transitioning to overview.
private final int mTargetTaskId;
private T mActivity;
private RecentsView mRecentsView;
- AppToOverviewAnimationProvider(ActivityControlHelper<T> helper, int targetTaskId) {
+ AppToOverviewAnimationProvider(BaseActivityInterface<T> helper, int targetTaskId) {
mHelper = helper;
mTargetTaskId = targetTaskId;
}
@@ -69,7 +69,7 @@
boolean onActivityReady(T activity, Boolean wasVisible) {
activity.<RecentsView>getOverviewPanel().showCurrentTask(mTargetTaskId);
AbstractFloatingView.closeAllOpenViews(activity, wasVisible);
- ActivityControlHelper.AnimationFactory factory =
+ BaseActivityInterface.AnimationFactory factory =
mHelper.prepareRecentsUI(activity, wasVisible,
false /* animate activity */, (controller) -> {
controller.dispatchOnStart();
@@ -79,7 +79,7 @@
anim.start();
});
factory.onRemoteAnimationReceived(null);
- factory.createActivityController(RECENTS_LAUNCH_DURATION);
+ factory.createActivityInterface(RECENTS_LAUNCH_DURATION);
factory.setRecentsAttachedToAppWindow(true, false);
mActivity = activity;
mRecentsView = mActivity.getOverviewPanel();
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java
index 9eb2d4c..e1e994c 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java
@@ -56,7 +56,7 @@
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.views.FloatingIconView;
-import com.android.quickstep.ActivityControlHelper.HomeAnimationFactory;
+import com.android.quickstep.BaseActivityInterface.HomeAnimationFactory;
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.util.ActivityInitListener;
@@ -97,7 +97,7 @@
protected final Context mContext;
protected final OverviewComponentObserver mOverviewComponentObserver;
- protected final ActivityControlHelper<T> mActivityControlHelper;
+ protected final BaseActivityInterface<T> mActivityInterface;
protected final RecentsModel mRecentsModel;
protected final int mRunningTaskId;
@@ -135,15 +135,15 @@
protected boolean mCanceled;
protected int mFinishingRecentsAnimationForNewTaskId = -1;
- protected BaseSwipeUpHandler(Context context,
+ protected BaseSwipeUpHandler(Context context, GestureState gestureState,
OverviewComponentObserver overviewComponentObserver,
RecentsModel recentsModel, InputConsumerController inputConsumer, int runningTaskId) {
mContext = context;
mOverviewComponentObserver = overviewComponentObserver;
- mActivityControlHelper = overviewComponentObserver.getActivityControlHelper();
+ mActivityInterface = gestureState.getActivityInterface();
mRecentsModel = recentsModel;
mActivityInitListener =
- mActivityControlHelper.createActivityInitListener(this::onActivityInit);
+ mActivityInterface.createActivityInitListener(this::onActivityInit);
mRunningTaskId = runningTaskId;
mInputConsumer = inputConsumer;
mMode = SysUINavigationMode.getMode(context);
@@ -246,10 +246,10 @@
success -> {
resultCallback.accept(success);
if (!success) {
- mActivityControlHelper.onLaunchTaskFailed(mActivity);
+ mActivityInterface.onLaunchTaskFailed(mActivity);
nextTask.notifyTaskLaunchFailed(TAG);
} else {
- mActivityControlHelper.onLaunchTaskSuccess(mActivity);
+ mActivityInterface.onLaunchTaskSuccess(mActivity);
}
}, mMainThreadHandler);
}
@@ -291,7 +291,7 @@
RemoteAnimationTargetCompat runningTaskTarget = targets.findTask(mRunningTaskId);
if (targets.minimizedHomeBounds != null && runningTaskTarget != null) {
- overviewStackBounds = mActivityControlHelper
+ overviewStackBounds = mActivityInterface
.getOverviewWindowBounds(targets.minimizedHomeBounds, runningTaskTarget);
dp = dp.getMultiWindowProfile(mContext, new Point(
overviewStackBounds.width(), overviewStackBounds.height()));
@@ -345,7 +345,7 @@
protected void initTransitionEndpoints(DeviceProfile dp) {
mDp = dp;
- mTransitionDragLength = mActivityControlHelper.getSwipeUpDestinationAndLength(
+ mTransitionDragLength = mActivityInterface.getSwipeUpDestinationAndLength(
dp, mContext, TEMP_RECT);
if (!dp.isMultiWindowMode) {
// When updating the target rect, also update the home bounds since the location on
@@ -517,7 +517,7 @@
public interface Factory {
- BaseSwipeUpHandler newHandler(RunningTaskInfo runningTask,
+ BaseSwipeUpHandler newHandler(GestureState gestureState, RunningTaskInfo runningTask,
long touchTimeMs, boolean continuingLastGesture, boolean isLikelyToStartNewTask);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java
similarity index 95%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
rename to quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java
index 14bd35c..8deb835 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java
@@ -44,14 +44,14 @@
import java.util.function.Consumer;
/**
- * {@link ActivityControlHelper} for recents when the default launcher is different than the
+ * {@link BaseActivityInterface} for recents when the default launcher is different than the
* currently running one and apps should interact with the {@link RecentsActivity} as opposed
* to the in-launcher one.
*/
-public final class FallbackActivityControllerHelper implements
- ActivityControlHelper<RecentsActivity> {
+public final class FallbackActivityInterface implements
+ BaseActivityInterface<RecentsActivity> {
- public FallbackActivityControllerHelper() { }
+ public FallbackActivityInterface() { }
@Override
public void onTransitionCancelled(RecentsActivity activity, boolean activityVisible) {
@@ -142,12 +142,12 @@
if (!isAnimatingToRecents) {
rv.setContentAlpha(1);
}
- createActivityController(getSwipeUpDestinationAndLength(
+ createActivityInterface(getSwipeUpDestinationAndLength(
activity.getDeviceProfile(), activity, new Rect()));
}
@Override
- public void createActivityController(long transitionLength) {
+ public void createActivityInterface(long transitionLength) {
AnimatorSet animatorSet = new AnimatorSet();
if (isAnimatingToRecents) {
ObjectAnimator anim = ObjectAnimator.ofFloat(rv, CONTENT_ALPHA, 0, 1);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java
similarity index 97%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
rename to quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java
index c749761..f6b3654 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java
@@ -73,9 +73,9 @@
import java.util.function.Consumer;
/**
- * {@link ActivityControlHelper} for the in-launcher recents.
+ * {@link BaseActivityInterface} for the in-launcher recents.
*/
-public final class LauncherActivityControllerHelper implements ActivityControlHelper<Launcher> {
+public final class LauncherActivityInterface implements BaseActivityInterface<Launcher> {
private Runnable mAdjustInterpolatorsRunnable;
@@ -214,8 +214,8 @@
private boolean mIsAttachedToWindow;
@Override
- public void createActivityController(long transitionLength) {
- createActivityControllerInternal(activity, fromState, transitionLength, callback);
+ public void createActivityInterface(long transitionLength) {
+ createActivityInterfaceInternal(activity, fromState, transitionLength, callback);
// Creating the activity controller animation sometimes reapplies the launcher state
// (because we set the animation as the current state animation), so we reapply the
// attached state here as well to ensure recents is shown/hidden appropriately.
@@ -312,7 +312,7 @@
};
}
- private void createActivityControllerInternal(Launcher activity, LauncherState fromState,
+ private void createActivityInterfaceInternal(Launcher activity, LauncherState fromState,
long transitionLength, Consumer<AnimatorPlaybackController> callback) {
LauncherState endState = OVERVIEW;
if (fromState == endState) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewCommandHelper.java
index 6cdcb39..150c44d 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewCommandHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewCommandHelper.java
@@ -98,14 +98,14 @@
@Override
protected boolean handleCommand(long elapsedTime) {
// TODO: Go to the next page if started from alt-tab.
- return mHelper.getVisibleRecentsView() != null;
+ return mActivityInterface.getVisibleRecentsView() != null;
}
@Override
protected void onTransitionComplete() {
// TODO(b/138729100) This doesn't execute first time launcher is run
if (mTriggeredFromAltTab) {
- RecentsView rv = (RecentsView) mHelper.getVisibleRecentsView();
+ RecentsView rv = (RecentsView) mActivityInterface.getVisibleRecentsView();
if (rv == null) {
return;
}
@@ -130,7 +130,7 @@
@Override
protected boolean handleCommand(long elapsedTime) {
- RecentsView recents = (RecentsView) mHelper.getVisibleRecentsView();
+ RecentsView recents = (RecentsView) mActivityInterface.getVisibleRecentsView();
if (recents == null) {
return false;
}
@@ -146,7 +146,7 @@
private class RecentsActivityCommand<T extends BaseDraggingActivity> implements Runnable {
- protected final ActivityControlHelper<T> mHelper;
+ protected final BaseActivityInterface<T> mActivityInterface;
private final long mCreateTime;
private final AppToOverviewAnimationProvider<T> mAnimationProvider;
@@ -155,10 +155,10 @@
private ActivityInitListener mListener;
public RecentsActivityCommand() {
- mHelper = mOverviewComponentObserver.getActivityControlHelper();
+ mActivityInterface = mOverviewComponentObserver.getActivityInterface();
mCreateTime = SystemClock.elapsedRealtime();
- mAnimationProvider =
- new AppToOverviewAnimationProvider<>(mHelper, RecentsModel.getRunningTaskId());
+ mAnimationProvider = new AppToOverviewAnimationProvider<>(mActivityInterface,
+ RecentsModel.getRunningTaskId());
// Preload the plan
mRecentsModel.getTasks(null);
@@ -174,13 +174,13 @@
return;
}
- if (mHelper.switchToRecentsIfVisible(this::onTransitionComplete)) {
+ if (mActivityInterface.switchToRecentsIfVisible(this::onTransitionComplete)) {
// If successfully switched, then return
return;
}
// Otherwise, start overview.
- mListener = mHelper.createActivityInitListener(this::onActivityReady);
+ mListener = mActivityInterface.createActivityInitListener(this::onActivityReady);
mListener.registerAndStartActivity(mOverviewComponentObserver.getOverviewIntent(),
this::createWindowAnimation, mContext, MAIN_EXECUTOR.getHandler(),
mAnimationProvider.getRecentsLaunchDuration());
@@ -190,7 +190,7 @@
// TODO: We need to fix this case with PIP, when an activity first enters PIP, it shows
// the menu activity which takes window focus, preventing the right condition from
// being run below
- RecentsView recents = mHelper.getVisibleRecentsView();
+ RecentsView recents = mActivityInterface.getVisibleRecentsView();
if (recents != null) {
// Launch the next task
recents.showNextTask();
@@ -207,7 +207,7 @@
if (!mUserEventLogged) {
activity.getUserEventDispatcher().logActionCommand(
LauncherLogProto.Action.Command.RECENTS_BUTTON,
- mHelper.getContainerType(),
+ mActivityInterface.getContainerType(),
LauncherLogProto.ContainerType.TASKSWITCHER);
mUserEventLogged = true;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java
index 6ac7546..1bbeca4 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java
@@ -83,7 +83,7 @@
OverviewComponentObserver observer = new OverviewComponentObserver(mContext,
new RecentsAnimationDeviceState(mContext));
try {
- return observer.getActivityControlHelper().getCreatedActivity().getOverviewPanel();
+ return observer.getActivityInterface().getCreatedActivity().getOverviewPanel();
} finally {
observer.onDestroy();
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeSharedState.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeSharedState.java
index 7beab5b..cd8e1a4 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeSharedState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeSharedState.java
@@ -65,7 +65,7 @@
@Override
public final void onRecentsAnimationCanceled(ThumbnailData thumbnailData) {
if (thumbnailData != null) {
- mOverviewComponentObserver.getActivityControlHelper().switchToScreenshot(thumbnailData,
+ mOverviewComponentObserver.getActivityInterface().switchToScreenshot(thumbnailData,
() -> {
mLastRecentsAnimationController.cleanupScreenshot();
clearAnimationState();
@@ -129,7 +129,7 @@
clearListenerState(false /* finishAnimation */);
boolean shouldMinimiseSplitScreen = mOverviewComponentObserver == null ? false
- : mOverviewComponentObserver.getActivityControlHelper().shouldMinimizeSplitScreen();
+ : mOverviewComponentObserver.getActivityInterface().shouldMinimizeSplitScreen();
mRecentsAnimationListener = new RecentsAnimationCallbacks(shouldMinimiseSplitScreen);
mRecentsAnimationListener.addListener(this);
return mRecentsAnimationListener;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
index 2616d0d..4b7ae6f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -182,10 +182,10 @@
return;
}
- final ActivityControlHelper activityControl =
- mOverviewComponentObserver.getActivityControlHelper();
+ final BaseActivityInterface activityInterface =
+ mOverviewComponentObserver.getActivityInterface();
UserEventDispatcher.newInstance(getBaseContext()).logActionBack(completed, downX, downY,
- isButton, gestureSwipeLeft, activityControl.getContainerType());
+ isButton, gestureSwipeLeft, activityInterface.getContainerType());
if (completed && !isButton && shouldNotifyBackGesture()) {
UI_HELPER_EXECUTOR.execute(TouchInteractionService.this::tryNotifyBackGesture);
@@ -373,7 +373,7 @@
@UiThread
private void onAssistantVisibilityChanged() {
if (mDeviceState.isUserUnlocked()) {
- mOverviewComponentObserver.getActivityControlHelper().onAssistantVisibilityChanged(
+ mOverviewComponentObserver.getActivityInterface().onAssistantVisibilityChanged(
mDeviceState.getAssistantVisibility());
}
}
@@ -412,13 +412,16 @@
MotionEvent event = (MotionEvent) ev;
if (event.getAction() == ACTION_DOWN) {
+ GestureState newGestureState = new GestureState(
+ mOverviewComponentObserver.getActivityInterface());
+
mLogId = ActiveGestureLog.INSTANCE.generateAndSetLogId();
sSwipeSharedState.setLogTraceId(mLogId);
if (mDeviceState.isInSwipeUpTouchRegion(event)) {
boolean useSharedState = mConsumer.useSharedSwipeState();
mConsumer.onConsumerAboutToBeSwitched();
- mConsumer = newConsumer(useSharedState, event);
+ mConsumer = newConsumer(newGestureState, useSharedState, event);
ActiveGestureLog.INSTANCE.addLog("setInputConsumer", mConsumer.getType());
mUncheckedConsumer = mConsumer;
} else if (mDeviceState.isUserUnlocked() && mMode == Mode.NO_BUTTON
@@ -426,8 +429,7 @@
// Do not change mConsumer as if there is an ongoing QuickSwitch gesture, we should
// not interrupt it. QuickSwitch assumes that interruption can only happen if the
// next gesture is also quick switch.
- mUncheckedConsumer = new AssistantInputConsumer(this,
- mOverviewComponentObserver.getActivityControlHelper(),
+ mUncheckedConsumer = new AssistantInputConsumer(this, newGestureState,
InputConsumer.NO_OP, mInputMonitorCompat);
} else {
mUncheckedConsumer = InputConsumer.NO_OP;
@@ -439,14 +441,16 @@
DejankBinderTracker.disallowBinderTrackingInTests();
}
- private InputConsumer newConsumer(boolean useSharedState, MotionEvent event) {
+ private InputConsumer newConsumer(GestureState gestureState, boolean useSharedState,
+ MotionEvent event) {
boolean canStartSystemGesture = mDeviceState.canStartSystemGesture();
if (!mDeviceState.isUserUnlocked()) {
if (canStartSystemGesture) {
// This handles apps launched in direct boot mode (e.g. dialer) as well as apps
// launched while device is locked even after exiting direct boot mode (e.g. camera).
- return createDeviceLockedInputConsumer(mAM.getRunningTask(ACTIVITY_TYPE_ASSISTANT));
+ return createDeviceLockedInputConsumer(gestureState,
+ mAM.getRunningTask(ACTIVITY_TYPE_ASSISTANT));
} else {
return mResetGestureInputConsumer;
}
@@ -455,24 +459,21 @@
// When using sharedState, bypass systemState check as this is a followup gesture and the
// first gesture started in a valid system state.
InputConsumer base = canStartSystemGesture || useSharedState
- ? newBaseConsumer(useSharedState, event) : mResetGestureInputConsumer;
+ ? newBaseConsumer(gestureState, useSharedState, event) : mResetGestureInputConsumer;
if (mMode == Mode.NO_BUTTON) {
- final ActivityControlHelper activityControl =
- mOverviewComponentObserver.getActivityControlHelper();
if (mDeviceState.canTriggerAssistantAction(event)) {
- base = new AssistantInputConsumer(this, activityControl, base, mInputMonitorCompat);
+ base = new AssistantInputConsumer(this, gestureState, base, mInputMonitorCompat);
}
if (FeatureFlags.ENABLE_QUICK_CAPTURE_GESTURE.get()) {
// Put the Compose gesture as higher priority than the Assistant or base gestures
- base = new QuickCaptureInputConsumer(this, base, mInputMonitorCompat,
- activityControl);
+ base = new QuickCaptureInputConsumer(this, gestureState, base, mInputMonitorCompat);
}
if (mDeviceState.isScreenPinningActive()) {
// Note: we only allow accessibility to wrap this, and it replaces the previous
// base input consumer (which should be NO_OP anyway since topTaskLocked == true).
- base = new ScreenPinnedInputConsumer(this, activityControl);
+ base = new ScreenPinnedInputConsumer(this, gestureState);
}
if (mDeviceState.isAccessibilityMenuAvailable()) {
@@ -487,7 +488,8 @@
return base;
}
- private InputConsumer newBaseConsumer(boolean useSharedState, MotionEvent event) {
+ private InputConsumer newBaseConsumer(GestureState gestureState, boolean useSharedState,
+ MotionEvent event) {
RunningTaskInfo runningTaskInfo = DejankBinderTracker.whitelistIpcs(
() -> mAM.getRunningTask(0));
if (!useSharedState) {
@@ -495,12 +497,9 @@
}
if (mDeviceState.isKeyguardShowingOccluded()) {
// This handles apps showing over the lockscreen (e.g. camera)
- return createDeviceLockedInputConsumer(runningTaskInfo);
+ return createDeviceLockedInputConsumer(gestureState, runningTaskInfo);
}
- final ActivityControlHelper activityControl =
- mOverviewComponentObserver.getActivityControlHelper();
-
boolean forceOverviewInputConsumer = false;
if (isExcludedAssistant(runningTaskInfo)) {
// In the case where we are in the excluded assistant state, ignore it and treat the
@@ -523,16 +522,18 @@
// consumer but with the next task as the running task
RunningTaskInfo info = new ActivityManager.RunningTaskInfo();
info.id = sSwipeSharedState.nextRunningTaskId;
- return createOtherActivityInputConsumer(event, info);
- } else if (sSwipeSharedState.goingToLauncher || activityControl.isResumed()
+ return createOtherActivityInputConsumer(gestureState, event, info);
+ } else if (sSwipeSharedState.goingToLauncher
+ || gestureState.getActivityInterface().isResumed()
|| forceOverviewInputConsumer) {
- return createOverviewInputConsumer(event);
- } else if (ENABLE_QUICKSTEP_LIVE_TILE.get() && activityControl.isInLiveTileMode()) {
- return createOverviewInputConsumer(event);
+ return createOverviewInputConsumer(gestureState, event);
+ } else if (ENABLE_QUICKSTEP_LIVE_TILE.get()
+ && gestureState.getActivityInterface().isInLiveTileMode()) {
+ return createOverviewInputConsumer(gestureState, event);
} else if (mDeviceState.isGestureBlockedActivity(runningTaskInfo)) {
return mResetGestureInputConsumer;
} else {
- return createOtherActivityInputConsumer(event, runningTaskInfo);
+ return createOtherActivityInputConsumer(gestureState, event, runningTaskInfo);
}
}
@@ -542,52 +543,50 @@
&& (info.baseIntent.getFlags() & Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0;
}
- private InputConsumer createOtherActivityInputConsumer(MotionEvent event,
- RunningTaskInfo runningTaskInfo) {
+ private InputConsumer createOtherActivityInputConsumer(GestureState gestureState,
+ MotionEvent event, RunningTaskInfo runningTaskInfo) {
final boolean shouldDefer;
final BaseSwipeUpHandler.Factory factory;
- ActivityControlHelper activityControlHelper =
- mOverviewComponentObserver.getActivityControlHelper();
if (mMode == Mode.NO_BUTTON && !mOverviewComponentObserver.isHomeAndOverviewSame()) {
shouldDefer = !sSwipeSharedState.recentsAnimationFinishInterrupted;
factory = mFallbackNoButtonFactory;
} else {
- shouldDefer = activityControlHelper.deferStartingActivity(mDeviceState, event);
+ shouldDefer = gestureState.getActivityInterface().deferStartingActivity(mDeviceState,
+ event);
factory = mWindowTreansformFactory;
}
final boolean disableHorizontalSwipe = mDeviceState.isInExclusionRegion(event);
- return new OtherActivityInputConsumer(this, mDeviceState, runningTaskInfo, shouldDefer,
- this::onConsumerInactive, sSwipeSharedState, mInputMonitorCompat,
- disableHorizontalSwipe, activityControlHelper, factory, mLogId);
+ return new OtherActivityInputConsumer(this, mDeviceState, gestureState, runningTaskInfo,
+ shouldDefer, this::onConsumerInactive, sSwipeSharedState, mInputMonitorCompat,
+ disableHorizontalSwipe, factory, mLogId);
}
- private InputConsumer createDeviceLockedInputConsumer(RunningTaskInfo taskInfo) {
+ private InputConsumer createDeviceLockedInputConsumer(GestureState gestureState,
+ RunningTaskInfo taskInfo) {
if (mMode == Mode.NO_BUTTON && taskInfo != null) {
- return new DeviceLockedInputConsumer(this, mDeviceState, sSwipeSharedState,
- mInputMonitorCompat, taskInfo.taskId, mLogId);
+ return new DeviceLockedInputConsumer(this, mDeviceState, gestureState,
+ sSwipeSharedState, mInputMonitorCompat, taskInfo.taskId, mLogId);
} else {
return mResetGestureInputConsumer;
}
}
- public InputConsumer createOverviewInputConsumer(MotionEvent event) {
- final ActivityControlHelper activityControl =
- mOverviewComponentObserver.getActivityControlHelper();
- BaseDraggingActivity activity = activityControl.getCreatedActivity();
+ public InputConsumer createOverviewInputConsumer(GestureState gestureState, MotionEvent event) {
+ BaseDraggingActivity activity = gestureState.getActivityInterface().getCreatedActivity();
if (activity == null) {
return mResetGestureInputConsumer;
}
if (activity.getRootView().hasWindowFocus() || sSwipeSharedState.goingToLauncher) {
- return new OverviewInputConsumer(activity, mInputMonitorCompat,
- false /* startingInActivityBounds */, activityControl);
+ return new OverviewInputConsumer(gestureState, activity, mInputMonitorCompat,
+ false /* startingInActivityBounds */);
} else {
final boolean disableHorizontalSwipe = mDeviceState.isInExclusionRegion(event);
- return new OverviewWithoutFocusInputConsumer(activity, mInputMonitorCompat,
- activityControl, disableHorizontalSwipe);
+ return new OverviewWithoutFocusInputConsumer(activity, gestureState,
+ mInputMonitorCompat, disableHorizontalSwipe);
}
}
@@ -616,11 +615,11 @@
return;
}
- final ActivityControlHelper<BaseDraggingActivity> activityControl =
- mOverviewComponentObserver.getActivityControlHelper();
- if (activityControl.getCreatedActivity() == null) {
+ final BaseActivityInterface<BaseDraggingActivity> activityInterface =
+ mOverviewComponentObserver.getActivityInterface();
+ if (activityInterface.getCreatedActivity() == null) {
// Make sure that UI states will be initialized.
- activityControl.createActivityInitListener((activity, wasVisible) -> {
+ activityInterface.createActivityInitListener((activity, wasVisible) -> {
AppLaunchTracker.INSTANCE.get(activity);
return false;
}).register();
@@ -641,9 +640,9 @@
if (!mDeviceState.isUserUnlocked()) {
return;
}
- final ActivityControlHelper activityControl =
- mOverviewComponentObserver.getActivityControlHelper();
- final BaseDraggingActivity activity = activityControl.getCreatedActivity();
+ final BaseActivityInterface activityInterface =
+ mOverviewComponentObserver.getActivityInterface();
+ final BaseDraggingActivity activity = activityInterface.getCreatedActivity();
if (activity == null || activity.isStarted()) {
// We only care about the existing background activity.
return;
@@ -675,7 +674,7 @@
pw.println("TouchState:");
pw.println(" navMode=" + mMode);
boolean resumed = mOverviewComponentObserver != null
- && mOverviewComponentObserver.getActivityControlHelper().isResumed();
+ && mOverviewComponentObserver.getActivityInterface().isResumed();
pw.println(" resumed=" + resumed);
pw.println(" useSharedState=" + mConsumer.useSharedSwipeState());
if (mConsumer.useSharedSwipeState()) {
@@ -706,16 +705,20 @@
}
}
- private BaseSwipeUpHandler createWindowTransformSwipeHandler(RunningTaskInfo runningTask,
- long touchTimeMs, boolean continuingLastGesture, boolean isLikelyToStartNewTask) {
- return new WindowTransformSwipeHandler(mDeviceState, runningTask, this, touchTimeMs,
- mOverviewComponentObserver, continuingLastGesture, mInputConsumer, mRecentsModel);
+ private BaseSwipeUpHandler createWindowTransformSwipeHandler(GestureState gestureState,
+ RunningTaskInfo runningTask, long touchTimeMs, boolean continuingLastGesture,
+ boolean isLikelyToStartNewTask) {
+ return new WindowTransformSwipeHandler(this, mDeviceState, gestureState, runningTask,
+ touchTimeMs, mOverviewComponentObserver, continuingLastGesture, mInputConsumer,
+ mRecentsModel);
}
- private BaseSwipeUpHandler createFallbackNoButtonSwipeHandler(RunningTaskInfo runningTask,
- long touchTimeMs, boolean continuingLastGesture, boolean isLikelyToStartNewTask) {
- return new FallbackNoButtonInputConsumer(this, mOverviewComponentObserver, runningTask,
- mRecentsModel, mInputConsumer, isLikelyToStartNewTask, continuingLastGesture);
+ private BaseSwipeUpHandler createFallbackNoButtonSwipeHandler(GestureState gestureState,
+ RunningTaskInfo runningTask, long touchTimeMs, boolean continuingLastGesture,
+ boolean isLikelyToStartNewTask) {
+ return new FallbackNoButtonInputConsumer(this, gestureState, mOverviewComponentObserver,
+ runningTask, mRecentsModel, mInputConsumer, isLikelyToStartNewTask,
+ continuingLastGesture);
}
protected boolean shouldNotifyBackGesture() {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
index ccc41e3..e3b12cb 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -26,8 +26,8 @@
import static com.android.launcher3.util.RaceConditionTracker.ENTER;
import static com.android.launcher3.util.RaceConditionTracker.EXIT;
import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
-import static com.android.quickstep.ActivityControlHelper.AnimationFactory.ShelfAnimState.HIDE;
-import static com.android.quickstep.ActivityControlHelper.AnimationFactory.ShelfAnimState.PEEK;
+import static com.android.quickstep.BaseActivityInterface.AnimationFactory.ShelfAnimState.HIDE;
+import static com.android.quickstep.BaseActivityInterface.AnimationFactory.ShelfAnimState.PEEK;
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
import static com.android.quickstep.WindowTransformSwipeHandler.GestureEndTarget.HOME;
import static com.android.quickstep.WindowTransformSwipeHandler.GestureEndTarget.LAST_TASK;
@@ -71,9 +71,9 @@
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.util.RaceConditionTracker;
import com.android.launcher3.util.TraceHelper;
-import com.android.quickstep.ActivityControlHelper.AnimationFactory;
-import com.android.quickstep.ActivityControlHelper.AnimationFactory.ShelfAnimState;
-import com.android.quickstep.ActivityControlHelper.HomeAnimationFactory;
+import com.android.quickstep.BaseActivityInterface.AnimationFactory;
+import com.android.quickstep.BaseActivityInterface.AnimationFactory.ShelfAnimState;
+import com.android.quickstep.BaseActivityInterface.HomeAnimationFactory;
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.inputconsumers.OverviewInputConsumer;
import com.android.quickstep.util.ActiveGestureLog;
@@ -195,7 +195,8 @@
*/
private static final int LOG_NO_OP_PAGE_INDEX = -1;
- private RecentsAnimationDeviceState mDeviceState;
+ private final RecentsAnimationDeviceState mDeviceState;
+ private final GestureState mGestureState;
private GestureEndTarget mGestureEndTarget;
// Either RectFSpringAnim (if animating home) or ObjectAnimator (from mCurrentShift) otherwise
@@ -228,12 +229,13 @@
private final long mTouchTimeMs;
private long mLauncherFrameDrawnTime;
- public WindowTransformSwipeHandler(RecentsAnimationDeviceState deviceState,
- RunningTaskInfo runningTaskInfo, Context context, long touchTimeMs,
+ public WindowTransformSwipeHandler(Context context, RecentsAnimationDeviceState deviceState,
+ GestureState gestureState, RunningTaskInfo runningTaskInfo, long touchTimeMs,
OverviewComponentObserver overviewComponentObserver, boolean continuingLastGesture,
InputConsumerController inputConsumer, RecentsModel recentsModel) {
- super(context, overviewComponentObserver, recentsModel, inputConsumer, runningTaskInfo.id);
+ super(context, gestureState, overviewComponentObserver, recentsModel, inputConsumer, runningTaskInfo.id);
mDeviceState = deviceState;
+ mGestureState = gestureState;
mTouchTimeMs = touchTimeMs;
mContinuingLastGesture = continuingLastGesture;
initStateCallbacks();
@@ -349,7 +351,7 @@
// as that will set the state as BACKGROUND_APP, overriding the animation to NORMAL.
if (mGestureEndTarget != HOME) {
Runnable initAnimFactory = () -> {
- mAnimationFactory = mActivityControlHelper.prepareRecentsUI(mActivity,
+ mAnimationFactory = mActivityInterface.prepareRecentsUI(mActivity,
mWasLauncherAlreadyVisible, true,
this::onAnimatorPlaybackControllerCreated);
maybeUpdateRecentsAttachedState(false /* animate */);
@@ -518,7 +520,7 @@
return;
}
initTransitionEndpoints(mActivity.getDeviceProfile());
- mAnimationFactory.createActivityController(mTransitionDragLength);
+ mAnimationFactory.createActivityInterface(mTransitionDragLength);
}
@Override
@@ -688,9 +690,9 @@
setTargetAlphaProvider(WindowTransformSwipeHandler::getHiddenTargetAlpha);
}
- BaseDraggingActivity activity = mActivityControlHelper.getCreatedActivity();
+ BaseDraggingActivity activity = mActivityInterface.getCreatedActivity();
return activity == null ? InputConsumer.NO_OP
- : new OverviewInputConsumer(activity, null, true, mActivityControlHelper);
+ : new OverviewInputConsumer(mGestureState, activity, null, true);
}
private void endRunningWindowAnim(boolean cancel) {
@@ -882,7 +884,7 @@
if (mGestureEndTarget == HOME) {
HomeAnimationFactory homeAnimFactory;
if (mActivity != null) {
- homeAnimFactory = mActivityControlHelper.prepareHomeUI(mActivity);
+ homeAnimFactory = mActivityInterface.prepareHomeUI(mActivity);
} else {
homeAnimFactory = new HomeAnimationFactory() {
@NonNull
@@ -994,7 +996,7 @@
}
// Make sure recents is in its final state
maybeUpdateRecentsAttachedState(false);
- mActivityControlHelper.onSwipeUpToHomeComplete(mActivity);
+ mActivityInterface.onSwipeUpToHomeComplete(mActivity);
}
});
return anim;
@@ -1103,7 +1105,7 @@
private void resetStateForAnimationCancel() {
boolean wasVisible = mWasLauncherAlreadyVisible || mGestureStarted;
- mActivityControlHelper.onTransitionCancelled(mActivity, wasVisible);
+ mActivityInterface.onTransitionCancelled(mActivity, wasVisible);
// Leave the pending invisible flag, as it may be used by wallpaper open animation.
mActivity.clearForceInvisibleFlag(INVISIBLE_BY_STATE_HANDLER);
@@ -1180,7 +1182,7 @@
private void setupLauncherUiAfterSwipeUpToRecentsAnimation() {
endLauncherTransitionController();
- mActivityControlHelper.onSwipeUpToRecentsComplete(mActivity);
+ mActivityInterface.onSwipeUpToRecentsComplete(mActivity);
if (mRecentsAnimationController != null) {
mRecentsAnimationController.setDeferCancelUntilNextTransition(true /* defer */,
true /* screenshot */);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java
index d60b927..94126ff 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java
@@ -48,7 +48,8 @@
import com.android.launcher3.R;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.logging.UserEventDispatcher;
-import com.android.quickstep.ActivityControlHelper;
+import com.android.quickstep.BaseActivityInterface;
+import com.android.quickstep.GestureState;
import com.android.quickstep.InputConsumer;
import com.android.quickstep.SystemUiProxy;
import com.android.systemui.shared.system.InputMonitorCompat;
@@ -80,7 +81,7 @@
private long mDragTime;
private float mLastProgress;
private int mDirection;
- private ActivityControlHelper mActivityControlHelper;
+ private BaseActivityInterface mActivityInterface;
private final float mDragDistThreshold;
private final float mFlingDistThreshold;
@@ -90,7 +91,7 @@
private final Context mContext;
private final GestureDetector mGestureDetector;
- public AssistantInputConsumer(Context context, ActivityControlHelper activityControlHelper,
+ public AssistantInputConsumer(Context context, GestureState gestureState,
InputConsumer delegate, InputMonitorCompat inputMonitor) {
super(delegate, inputMonitor);
final Resources res = context.getResources();
@@ -103,7 +104,7 @@
float slop = ViewConfiguration.get(context).getScaledTouchSlop();
mSquaredSlop = slop * slop;
- mActivityControlHelper = activityControlHelper;
+ mActivityInterface = gestureState.getActivityInterface();
mGestureDetector = new GestureDetector(context, new AssistantGestureListener());
}
@@ -233,8 +234,7 @@
UserEventDispatcher.newInstance(mContext)
.logActionOnContainer(gestureType, mDirection, NAVBAR);
- BaseDraggingActivity launcherActivity = mActivityControlHelper
- .getCreatedActivity();
+ BaseDraggingActivity launcherActivity = mActivityInterface.getCreatedActivity();
if (launcherActivity != null) {
launcherActivity.getRootView().performHapticFeedback(
13, // HapticFeedbackConstants.GESTURE_END
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java
index cdf2e26..12b7c26 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java
@@ -39,6 +39,7 @@
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.DefaultDisplay;
+import com.android.quickstep.GestureState;
import com.android.quickstep.InputConsumer;
import com.android.quickstep.LockScreenRecentsActivity;
import com.android.quickstep.MultiStateCallback;
@@ -75,6 +76,7 @@
private final Context mContext;
private final RecentsAnimationDeviceState mDeviceState;
+ private final GestureState mGestureState;
private final float mTouchSlopSquared;
private final SwipeSharedState mSwipeSharedState;
private final InputMonitorCompat mInputMonitorCompat;
@@ -96,10 +98,11 @@
private RecentsAnimationTargets mRecentsAnimationTargets;
public DeviceLockedInputConsumer(Context context, RecentsAnimationDeviceState deviceState,
- SwipeSharedState swipeSharedState, InputMonitorCompat inputMonitorCompat,
- int runningTaskId, int logId) {
+ GestureState gestureState, SwipeSharedState swipeSharedState,
+ InputMonitorCompat inputMonitorCompat, int runningTaskId, int logId) {
mContext = context;
mDeviceState = deviceState;
+ mGestureState = gestureState;
mTouchSlopSquared = squaredTouchSlop(context);
mSwipeSharedState = swipeSharedState;
mAppWindowAnimationHelper = new AppWindowAnimationHelper(context);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/FallbackNoButtonInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/FallbackNoButtonInputConsumer.java
index 29357f2..370b487 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/FallbackNoButtonInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/FallbackNoButtonInputConsumer.java
@@ -39,9 +39,10 @@
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.util.ObjectWrapper;
-import com.android.quickstep.ActivityControlHelper.HomeAnimationFactory;
+import com.android.quickstep.BaseActivityInterface.HomeAnimationFactory;
import com.android.quickstep.AnimatedFloat;
import com.android.quickstep.BaseSwipeUpHandler;
+import com.android.quickstep.GestureState;
import com.android.quickstep.InputConsumer;
import com.android.quickstep.MultiStateCallback;
import com.android.quickstep.OverviewComponentObserver;
@@ -114,12 +115,13 @@
private final PointF mEndVelocityPxPerMs = new PointF(0, 0.5f);
private RunningWindowAnim mFinishAnimation;
- public FallbackNoButtonInputConsumer(Context context,
+ public FallbackNoButtonInputConsumer(Context context, GestureState gestureState,
OverviewComponentObserver overviewComponentObserver,
RunningTaskInfo runningTaskInfo, RecentsModel recentsModel,
InputConsumerController inputConsumer,
boolean isLikelyToStartNewTask, boolean continuingLastGesture) {
- super(context, overviewComponentObserver, recentsModel, inputConsumer, runningTaskInfo.id);
+ super(context, gestureState, overviewComponentObserver, recentsModel, inputConsumer,
+ runningTaskInfo.id);
mLauncherAlpha.value = 1;
mRunningTaskInfo = runningTaskInfo;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
index d5a1804..fbedc0f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
@@ -50,9 +50,10 @@
import com.android.launcher3.util.Preconditions;
import com.android.launcher3.util.RaceConditionTracker;
import com.android.launcher3.util.TraceHelper;
-import com.android.quickstep.ActivityControlHelper;
+import com.android.quickstep.BaseActivityInterface;
import com.android.quickstep.BaseSwipeUpHandler;
import com.android.quickstep.BaseSwipeUpHandler.Factory;
+import com.android.quickstep.GestureState;
import com.android.quickstep.InputConsumer;
import com.android.quickstep.RecentsAnimationDeviceState;
import com.android.quickstep.SwipeSharedState;
@@ -81,12 +82,13 @@
public static final float QUICKSTEP_TOUCH_SLOP_RATIO = 3;
private final RecentsAnimationDeviceState mDeviceState;
+ private final GestureState mGestureState;
private final CachedEventDispatcher mRecentsViewDispatcher = new CachedEventDispatcher();
private final RunningTaskInfo mRunningTask;
private final SwipeSharedState mSwipeSharedState;
private final InputMonitorCompat mInputMonitorCompat;
private final SysUINavigationMode.Mode mMode;
- private final ActivityControlHelper mActivityControlHelper;
+ private final BaseActivityInterface mActivityInterface;
private final BaseSwipeUpHandler.Factory mHandlerFactory;
@@ -126,20 +128,19 @@
private int mLogId;
public OtherActivityInputConsumer(Context base, RecentsAnimationDeviceState deviceState,
- RunningTaskInfo runningTaskInfo, boolean isDeferredDownTarget,
- Consumer<OtherActivityInputConsumer> onCompleteCallback,
+ GestureState gestureState, RunningTaskInfo runningTaskInfo,
+ boolean isDeferredDownTarget, Consumer<OtherActivityInputConsumer> onCompleteCallback,
SwipeSharedState swipeSharedState, InputMonitorCompat inputMonitorCompat,
- boolean disableHorizontalSwipe, ActivityControlHelper activityControlHelper,
- Factory handlerFactory, int logId) {
+ boolean disableHorizontalSwipe, Factory handlerFactory, int logId) {
super(base);
mLogId = logId;
-
mDeviceState = deviceState;
+ mGestureState = gestureState;
mMainThreadHandler = new Handler(Looper.getMainLooper());
mRunningTask = runningTaskInfo;
mMode = SysUINavigationMode.getMode(base);
mHandlerFactory = handlerFactory;
- mActivityControlHelper = activityControlHelper;
+ mActivityInterface = mGestureState.getActivityInterface();
mMotionPauseDetector = new MotionPauseDetector(base);
mMotionPauseMinDisplacement = base.getResources().getDimension(
@@ -318,7 +319,7 @@
}
mInputMonitorCompat.pilferPointers();
- mActivityControlHelper.closeOverlay();
+ mActivityInterface.closeOverlay();
ActivityManagerWrapper.getInstance().closeSystemWindows(
CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
@@ -331,8 +332,8 @@
ActiveGestureLog.INSTANCE.addLog("startRecentsAnimation");
RecentsAnimationCallbacks listenerSet = mSwipeSharedState.getActiveListener();
- final BaseSwipeUpHandler handler = mHandlerFactory.newHandler(mRunningTask, touchTimeMs,
- listenerSet != null, isLikelyToStartNewTask);
+ final BaseSwipeUpHandler handler = mHandlerFactory.newHandler(mGestureState, mRunningTask,
+ touchTimeMs, listenerSet != null, isLikelyToStartNewTask);
mInteractionHandler = handler;
handler.setGestureEndCallback(this::onInteractionGestureFinished);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
index b09a5ac..c19754f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
@@ -26,7 +26,8 @@
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.Utilities;
import com.android.launcher3.views.BaseDragLayer;
-import com.android.quickstep.ActivityControlHelper;
+import com.android.quickstep.BaseActivityInterface;
+import com.android.quickstep.GestureState;
import com.android.quickstep.InputConsumer;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -41,7 +42,7 @@
implements InputConsumer {
private final T mActivity;
- private final ActivityControlHelper<T> mActivityControlHelper;
+ private final BaseActivityInterface<T> mActivityInterface;
private final BaseDragLayer mTarget;
private final InputMonitorCompat mInputMonitor;
@@ -52,13 +53,12 @@
private final boolean mStartingInActivityBounds;
private boolean mTargetHandledTouch;
- public OverviewInputConsumer(T activity, @Nullable InputMonitorCompat inputMonitor,
- boolean startingInActivityBounds,
- ActivityControlHelper<T> activityControlHelper) {
+ public OverviewInputConsumer(GestureState gestureState, T activity,
+ @Nullable InputMonitorCompat inputMonitor, boolean startingInActivityBounds) {
mActivity = activity;
mInputMonitor = inputMonitor;
mStartingInActivityBounds = startingInActivityBounds;
- mActivityControlHelper = activityControlHelper;
+ mActivityInterface = gestureState.getActivityInterface();
mTarget = activity.getDragLayer();
if (startingInActivityBounds) {
@@ -100,7 +100,7 @@
if (!mTargetHandledTouch && handled) {
mTargetHandledTouch = true;
if (!mStartingInActivityBounds) {
- mActivityControlHelper.closeOverlay();
+ mActivityInterface.closeOverlay();
ActivityManagerWrapper.getInstance()
.closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
ActiveGestureLog.INSTANCE.addLog("startQuickstep");
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
index c256094..50069ea 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
@@ -35,8 +35,9 @@
import com.android.launcher3.logging.StatsLogUtils;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
-import com.android.quickstep.ActivityControlHelper;
+import com.android.quickstep.BaseActivityInterface;
import com.android.quickstep.InputConsumer;
+import com.android.quickstep.GestureState;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.util.NavBarPosition;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -50,17 +51,17 @@
private final float mSquaredTouchSlop;
private final Context mContext;
private final NavBarPosition mNavBarPosition;
- private final ActivityControlHelper mActivityControlHelper;
+ private final BaseActivityInterface mActivityInterface;
private boolean mInterceptedTouch;
private VelocityTracker mVelocityTracker;
- public OverviewWithoutFocusInputConsumer(Context context, InputMonitorCompat inputMonitor,
- ActivityControlHelper activityControlHelper, boolean disableHorizontalSwipe) {
+ public OverviewWithoutFocusInputConsumer(Context context, GestureState gestureState,
+ InputMonitorCompat inputMonitor, boolean disableHorizontalSwipe) {
mInputMonitor = inputMonitor;
mDisableHorizontalSwipe = disableHorizontalSwipe;
mContext = context;
- mActivityControlHelper = activityControlHelper;
+ mActivityInterface = gestureState.getActivityInterface();
mSquaredTouchSlop = Utilities.squaredTouchSlop(context);
mNavBarPosition = new NavBarPosition(context);
@@ -149,7 +150,7 @@
}
if (triggerQuickstep) {
- mActivityControlHelper.closeOverlay();
+ mActivityInterface.closeOverlay();
ActivityManagerWrapper.getInstance()
.closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
ActiveGestureLog.INSTANCE.addLog("startQuickstep");
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/QuickCaptureInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/QuickCaptureInputConsumer.java
index ea80a38..97ca730 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/QuickCaptureInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/QuickCaptureInputConsumer.java
@@ -35,7 +35,7 @@
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.R;
-import com.android.quickstep.ActivityControlHelper;
+import com.android.quickstep.GestureState;
import com.android.quickstep.InputConsumer;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.system.InputMonitorCompat;
@@ -73,15 +73,16 @@
private RecentsView mRecentsView;
- public QuickCaptureInputConsumer(Context context, InputConsumer delegate,
- InputMonitorCompat inputMonitor, ActivityControlHelper<T> activityControlHelper) {
+ public QuickCaptureInputConsumer(Context context, GestureState gestureState,
+ InputConsumer delegate, InputMonitorCompat inputMonitor) {
super(delegate, inputMonitor);
mContext = context;
float slop = ViewConfiguration.get(context).getScaledTouchSlop();
mSquaredSlop = slop * slop;
- activityControlHelper.createActivityInitListener(this::onActivityInit).register();
+ gestureState.getActivityInterface().createActivityInitListener(this::onActivityInit)
+ .register();
}
@Override
@@ -89,7 +90,7 @@
return TYPE_QUICK_CAPTURE | mDelegate.getType();
}
- private boolean onActivityInit(final T activity, Boolean alreadyOnHome) {
+ private boolean onActivityInit(final BaseDraggingActivity activity, Boolean alreadyOnHome) {
mRecentsView = activity.getOverviewPanel();
return true;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ScreenPinnedInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ScreenPinnedInputConsumer.java
index d8b1bfd..d5ed321 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ScreenPinnedInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ScreenPinnedInputConsumer.java
@@ -21,7 +21,7 @@
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.R;
-import com.android.quickstep.ActivityControlHelper;
+import com.android.quickstep.GestureState;
import com.android.quickstep.InputConsumer;
import com.android.quickstep.util.MotionPauseDetector;
import com.android.quickstep.SystemUiProxy;
@@ -38,14 +38,15 @@
private float mTouchDownY;
- public ScreenPinnedInputConsumer(Context context, ActivityControlHelper activityControl) {
+ public ScreenPinnedInputConsumer(Context context, GestureState gestureState) {
mMotionPauseMinDisplacement = context.getResources().getDimension(
R.dimen.motion_pause_detector_min_displacement_from_app);
mMotionPauseDetector = new MotionPauseDetector(context, true /* makePauseHarderToTrigger*/);
mMotionPauseDetector.setOnMotionPauseListener(isPaused -> {
if (isPaused) {
SystemUiProxy.INSTANCE.get(context).stopScreenPinning();
- BaseDraggingActivity launcherActivity = activityControl.getCreatedActivity();
+ BaseDraggingActivity launcherActivity = gestureState.getActivityInterface()
+ .getCreatedActivity();
if (launcherActivity != null) {
launcherActivity.getRootView().performHapticFeedback(
HapticFeedbackConstants.LONG_PRESS,
diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
similarity index 97%
rename from quickstep/src/com/android/quickstep/ActivityControlHelper.java
rename to quickstep/src/com/android/quickstep/BaseActivityInterface.java
index 382232c..409bec6 100644
--- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -42,7 +42,7 @@
* Utility class which abstracts out the logical differences between Launcher and RecentsActivity.
*/
@TargetApi(Build.VERSION_CODES.P)
-public interface ActivityControlHelper<T extends BaseDraggingActivity> {
+public interface BaseActivityInterface<T extends BaseDraggingActivity> {
void onTransitionCancelled(T activity, boolean activityVisible);
@@ -112,7 +112,7 @@
default void onRemoteAnimationReceived(RemoteAnimationTargets targets) { }
- void createActivityController(long transitionLength);
+ void createActivityInterface(long transitionLength);
default void adjustActivityControllerInterpolators() { }
diff --git a/quickstep/src/com/android/quickstep/GestureState.java b/quickstep/src/com/android/quickstep/GestureState.java
new file mode 100644
index 0000000..de64227
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/GestureState.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.quickstep;
+
+import com.android.launcher3.BaseDraggingActivity;
+
+/**
+ * Manages the state for an active system gesture, listens for events from the system and Launcher,
+ * and fires events when the states change.
+ */
+public class GestureState {
+
+ // Needed to interact with the current activity
+ private BaseActivityInterface mActivityInterface;
+
+ public GestureState(BaseActivityInterface activityInterface) {
+ mActivityInterface = activityInterface;
+ }
+
+ public <T extends BaseDraggingActivity> BaseActivityInterface<T> getActivityInterface() {
+ return mActivityInterface;
+ }
+}
diff --git a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
index 331183a..73b78db 100644
--- a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
+++ b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
@@ -62,7 +62,7 @@
private final Intent mFallbackIntent;
private final SparseIntArray mConfigChangesMap = new SparseIntArray();
private String mUpdateRegisteredPackage;
- private ActivityControlHelper mActivityControlHelper;
+ private BaseActivityInterface mActivityInterface;
private Intent mOverviewIntent;
private boolean mIsHomeAndOverviewSame;
private boolean mIsDefaultHome;
@@ -106,7 +106,7 @@
}
/**
- * Update overview intent and {@link ActivityControlHelper} based off the current launcher home
+ * Update overview intent and {@link BaseActivityInterface} based off the current launcher home
* component.
*/
private void updateOverviewTargets() {
@@ -119,13 +119,13 @@
// Set assistant visibility to 0 from launcher's perspective, ensures any elements that
// launcher made invisible become visible again before the new activity control helper
// becomes active.
- if (mActivityControlHelper != null) {
- mActivityControlHelper.onAssistantVisibilityChanged(0.f);
+ if (mActivityInterface != null) {
+ mActivityInterface.onAssistantVisibilityChanged(0.f);
}
if (!mDeviceState.isHomeDisabled() && (defaultHome == null || mIsDefaultHome)) {
// User default home is same as out home app. Use Overview integrated in Launcher.
- mActivityControlHelper = new LauncherActivityControllerHelper();
+ mActivityInterface = new LauncherActivityInterface();
mIsHomeAndOverviewSame = true;
mOverviewIntent = mMyHomeIntent;
mCurrentHomeIntent.setComponent(mMyHomeIntent.getComponent());
@@ -138,7 +138,7 @@
} else {
// The default home app is a different launcher. Use the fallback Overview instead.
- mActivityControlHelper = new FallbackActivityControllerHelper();
+ mActivityInterface = new FallbackActivityInterface();
mIsHomeAndOverviewSame = false;
mOverviewIntent = mFallbackIntent;
mCurrentHomeIntent.setComponent(defaultHome);
@@ -230,7 +230,7 @@
*
* @return the current activity control helper
*/
- public ActivityControlHelper getActivityControlHelper() {
- return mActivityControlHelper;
+ public BaseActivityInterface getActivityInterface() {
+ return mActivityInterface;
}
}