Merge "Removing RotationTouchHelper state management from RecentsAnimationDeviceState" into main
This commit is contained in:
@@ -170,7 +170,6 @@ import com.android.launcher3.widget.LauncherWidgetHolder;
|
||||
import com.android.quickstep.OverviewCommandHelper;
|
||||
import com.android.quickstep.OverviewComponentObserver;
|
||||
import com.android.quickstep.OverviewComponentObserver.OverviewChangeListener;
|
||||
import com.android.quickstep.RecentsAnimationDeviceState;
|
||||
import com.android.quickstep.RecentsModel;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.TaskUtils;
|
||||
@@ -282,7 +281,6 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
getDepthController(), getStatsLogManager(),
|
||||
systemUiProxy, RecentsModel.INSTANCE.get(this),
|
||||
() -> onStateBack());
|
||||
RecentsAnimationDeviceState deviceState = new RecentsAnimationDeviceState(asContext());
|
||||
if (DesktopModeStatus.canEnterDesktopMode(this)) {
|
||||
mDesktopRecentsTransitionController = new DesktopRecentsTransitionController(
|
||||
getStateManager(), systemUiProxy, getIApplicationThread(),
|
||||
@@ -290,8 +288,8 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
}
|
||||
overviewPanel.init(mActionsView, mSplitSelectStateController,
|
||||
mDesktopRecentsTransitionController);
|
||||
mSplitWithKeyboardShortcutController = new SplitWithKeyboardShortcutController(this,
|
||||
mSplitSelectStateController, deviceState);
|
||||
mSplitWithKeyboardShortcutController = new SplitWithKeyboardShortcutController(
|
||||
this, mSplitSelectStateController);
|
||||
mSplitToWorkspaceController = new SplitToWorkspaceController(this,
|
||||
mSplitSelectStateController);
|
||||
mActionsView.updateDimension(getDeviceProfile(), overviewPanel.getLastComputedTaskSize());
|
||||
@@ -566,7 +564,6 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
|
||||
super.onDestroy();
|
||||
mHotseatPredictionController.destroy();
|
||||
mSplitWithKeyboardShortcutController.onDestroy();
|
||||
if (mViewCapture != null) mViewCapture.close();
|
||||
removeBackAnimationCallback(mSplitSelectStateController.getSplitBackHandler());
|
||||
}
|
||||
|
||||
@@ -199,6 +199,7 @@ public abstract class AbsSwipeUpHandler<
|
||||
// Fraction of the scroll and transform animation in which the current task fades out
|
||||
private static final float KQS_TASK_FADE_ANIMATION_FRACTION = 0.4f;
|
||||
|
||||
protected final RecentsAnimationDeviceState mDeviceState;
|
||||
protected final BaseContainerInterface<STATE, RECENTS_CONTAINER> mContainerInterface;
|
||||
protected final InputConsumerProxy mInputConsumerProxy;
|
||||
protected final ContextInitListener mContextInitListener;
|
||||
@@ -374,12 +375,13 @@ public abstract class AbsSwipeUpHandler<
|
||||
|
||||
private final MSDLPlayerWrapper mMSDLPlayerWrapper;
|
||||
|
||||
public AbsSwipeUpHandler(Context context, RecentsAnimationDeviceState deviceState,
|
||||
public AbsSwipeUpHandler(Context context,
|
||||
TaskAnimationManager taskAnimationManager, GestureState gestureState,
|
||||
long touchTimeMs, boolean continuingLastGesture,
|
||||
InputConsumerController inputConsumer,
|
||||
MSDLPlayerWrapper msdlPlayerWrapper) {
|
||||
super(context, deviceState, gestureState);
|
||||
super(context, gestureState);
|
||||
mDeviceState = RecentsAnimationDeviceState.INSTANCE.get(mContext);
|
||||
mContainerInterface = gestureState.getContainerInterface();
|
||||
mContextInitListener =
|
||||
mContainerInterface.createActivityInitListener(this::onActivityInit);
|
||||
@@ -597,7 +599,7 @@ public abstract class AbsSwipeUpHandler<
|
||||
// as that will set the state as BACKGROUND_APP, overriding the animation to NORMAL.
|
||||
if (mGestureState.getEndTarget() != HOME) {
|
||||
Runnable initAnimFactory = () -> {
|
||||
mAnimationFactory = mContainerInterface.prepareRecentsUI(mDeviceState,
|
||||
mAnimationFactory = mContainerInterface.prepareRecentsUI(
|
||||
mWasLauncherAlreadyVisible, this::onAnimatorPlaybackControllerCreated);
|
||||
maybeUpdateRecentsAttachedState(false /* animate */);
|
||||
if (mGestureState.getEndTarget() != null) {
|
||||
@@ -663,12 +665,9 @@ public abstract class AbsSwipeUpHandler<
|
||||
mGestureState.getContainerInterface().setOnDeferredActivityLaunchCallback(
|
||||
mOnDeferredActivityLaunch);
|
||||
|
||||
mGestureState.runOnceAtState(STATE_END_TARGET_SET,
|
||||
() -> {
|
||||
mDeviceState.getRotationTouchHelper()
|
||||
.onEndTargetCalculated(mGestureState.getEndTarget(),
|
||||
mContainerInterface);
|
||||
});
|
||||
mGestureState.runOnceAtState(STATE_END_TARGET_SET, () ->
|
||||
RotationTouchHelper.INSTANCE.get(mContext)
|
||||
.onEndTargetCalculated(mGestureState.getEndTarget(), mContainerInterface));
|
||||
|
||||
notifyGestureStarted();
|
||||
}
|
||||
@@ -708,7 +707,7 @@ public abstract class AbsSwipeUpHandler<
|
||||
if (mRecentsView == null) {
|
||||
return;
|
||||
}
|
||||
mRecentsView.onGestureAnimationStart(runningTasks, mDeviceState.getRotationTouchHelper());
|
||||
mRecentsView.onGestureAnimationStart(runningTasks);
|
||||
TaskView currentPageTaskView = mRecentsView.getCurrentPageTaskView();
|
||||
if (currentPageTaskView != null) {
|
||||
mPreviousTaskViewType = currentPageTaskView.getType();
|
||||
@@ -1985,7 +1984,7 @@ public abstract class AbsSwipeUpHandler<
|
||||
}
|
||||
// Make sure recents is in its final state
|
||||
maybeUpdateRecentsAttachedState(false);
|
||||
mContainerInterface.onSwipeUpToHomeComplete(mDeviceState);
|
||||
mContainerInterface.onSwipeUpToHomeComplete();
|
||||
}
|
||||
});
|
||||
if (mRecentsAnimationTargets != null) {
|
||||
|
||||
@@ -131,7 +131,7 @@ public abstract class BaseContainerInterface<STATE_TYPE extends BaseState<STATE_
|
||||
}
|
||||
|
||||
public abstract BaseContainerInterface.AnimationFactory prepareRecentsUI(
|
||||
RecentsAnimationDeviceState deviceState, boolean activityVisible,
|
||||
boolean activityVisible,
|
||||
Consumer<AnimatorControllerWithResistance> callback);
|
||||
|
||||
public abstract ContextInitListener createActivityInitListener(
|
||||
@@ -151,11 +151,10 @@ public abstract class BaseContainerInterface<STATE_TYPE extends BaseState<STATE_
|
||||
|
||||
public abstract void onLaunchTaskFailed();
|
||||
|
||||
public abstract void onExitOverview(RotationTouchHelper deviceState,
|
||||
Runnable exitRunnable);
|
||||
public abstract void onExitOverview(Runnable exitRunnable);
|
||||
|
||||
/** Called when the animation to home has fully settled. */
|
||||
public void onSwipeUpToHomeComplete(RecentsAnimationDeviceState deviceState) {}
|
||||
public void onSwipeUpToHomeComplete() {}
|
||||
|
||||
/**
|
||||
* Sets a callback to be run when an activity launch happens while launcher is not yet resumed.
|
||||
|
||||
@@ -79,9 +79,9 @@ public final class FallbackActivityInterface extends
|
||||
|
||||
/** 6 */
|
||||
@Override
|
||||
public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
|
||||
public AnimationFactory prepareRecentsUI(
|
||||
boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback) {
|
||||
notifyRecentsOfOrientation(deviceState.getRotationTouchHelper());
|
||||
notifyRecentsOfOrientation();
|
||||
DefaultAnimationFactory factory = new DefaultAnimationFactory(callback);
|
||||
factory.initBackgroundStateUI();
|
||||
return factory;
|
||||
@@ -142,12 +142,12 @@ public final class FallbackActivityInterface extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExitOverview(RotationTouchHelper deviceState, Runnable exitRunnable) {
|
||||
public void onExitOverview(Runnable exitRunnable) {
|
||||
final StateManager<RecentsState, RecentsActivity> stateManager =
|
||||
getCreatedContainer().getStateManager();
|
||||
if (stateManager.getState() == HOME) {
|
||||
exitRunnable.run();
|
||||
notifyRecentsOfOrientation(deviceState);
|
||||
notifyRecentsOfOrientation();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public final class FallbackActivityInterface extends
|
||||
// Are we going from Recents to Workspace?
|
||||
if (toState == HOME) {
|
||||
exitRunnable.run();
|
||||
notifyRecentsOfOrientation(deviceState);
|
||||
notifyRecentsOfOrientation();
|
||||
stateManager.removeStateListener(this);
|
||||
}
|
||||
}
|
||||
@@ -197,11 +197,9 @@ public final class FallbackActivityInterface extends
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyRecentsOfOrientation(RotationTouchHelper rotationTouchHelper) {
|
||||
private void notifyRecentsOfOrientation() {
|
||||
// reset layout on swipe to home
|
||||
RecentsView recentsView = getCreatedContainer().getOverviewPanel();
|
||||
recentsView.setLayoutRotation(rotationTouchHelper.getCurrentActiveRotation(),
|
||||
rotationTouchHelper.getDisplayRotation());
|
||||
getCreatedContainer().getOverviewPanel().reapplyActiveRotation();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -101,11 +101,11 @@ public class FallbackSwipeHandler extends
|
||||
|
||||
private boolean mAppCanEnterPip;
|
||||
|
||||
public FallbackSwipeHandler(Context context, RecentsAnimationDeviceState deviceState,
|
||||
public FallbackSwipeHandler(Context context,
|
||||
TaskAnimationManager taskAnimationManager, GestureState gestureState, long touchTimeMs,
|
||||
boolean continuingLastGesture, InputConsumerController inputConsumer,
|
||||
MSDLPlayerWrapper msdlPlayerWrapper) {
|
||||
super(context, deviceState, taskAnimationManager, gestureState, touchTimeMs,
|
||||
super(context, taskAnimationManager, gestureState, touchTimeMs,
|
||||
continuingLastGesture, inputConsumer, msdlPlayerWrapper);
|
||||
|
||||
mRunningOverHome = mGestureState.getRunningTask() != null
|
||||
@@ -216,8 +216,7 @@ public class FallbackSwipeHandler extends
|
||||
if (mRunningOverHome) {
|
||||
if (DisplayController.getNavigationMode(mContext).hasGestures) {
|
||||
mRecentsView.onGestureAnimationStartOnHome(
|
||||
mGestureState.getRunningTask().getPlaceholderTasks(),
|
||||
mDeviceState.getRotationTouchHelper());
|
||||
mGestureState.getRunningTask().getPlaceholderTasks());
|
||||
}
|
||||
} else {
|
||||
super.notifyGestureAnimationStartToRecents();
|
||||
|
||||
@@ -80,10 +80,9 @@ public final class FallbackWindowInterface extends BaseWindowInterface{
|
||||
|
||||
/** 6 */
|
||||
@Override
|
||||
public BaseWindowInterface.AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState
|
||||
deviceState, boolean activityVisible,
|
||||
public BaseWindowInterface.AnimationFactory prepareRecentsUI(boolean activityVisible,
|
||||
Consumer<AnimatorControllerWithResistance> callback) {
|
||||
notifyRecentsOfOrientation(deviceState.getRotationTouchHelper());
|
||||
notifyRecentsOfOrientation();
|
||||
BaseWindowInterface.DefaultAnimationFactory factory =
|
||||
new BaseWindowInterface.DefaultAnimationFactory(callback);
|
||||
factory.initBackgroundStateUI();
|
||||
@@ -153,12 +152,12 @@ public final class FallbackWindowInterface extends BaseWindowInterface{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExitOverview(RotationTouchHelper deviceState, Runnable exitRunnable) {
|
||||
public void onExitOverview(Runnable exitRunnable) {
|
||||
final StateManager<RecentsState, RecentsWindowManager> stateManager =
|
||||
getCreatedContainer().getStateManager();
|
||||
if (stateManager.getState() == HOME) {
|
||||
exitRunnable.run();
|
||||
notifyRecentsOfOrientation(deviceState);
|
||||
notifyRecentsOfOrientation();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -169,7 +168,7 @@ public final class FallbackWindowInterface extends BaseWindowInterface{
|
||||
// Are we going from Recents to Workspace?
|
||||
if (toState == HOME) {
|
||||
exitRunnable.run();
|
||||
notifyRecentsOfOrientation(deviceState);
|
||||
notifyRecentsOfOrientation();
|
||||
stateManager.removeStateListener(this);
|
||||
}
|
||||
}
|
||||
@@ -208,11 +207,9 @@ public final class FallbackWindowInterface extends BaseWindowInterface{
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyRecentsOfOrientation(RotationTouchHelper rotationTouchHelper) {
|
||||
private void notifyRecentsOfOrientation() {
|
||||
// reset layout on swipe to home
|
||||
RecentsView recentsView = getCreatedContainer().getOverviewPanel();
|
||||
recentsView.setLayoutRotation(rotationTouchHelper.getCurrentActiveRotation(),
|
||||
rotationTouchHelper.getDisplayRotation());
|
||||
((RecentsView) getCreatedContainer().getOverviewPanel()).reapplyActiveRotation();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -332,14 +332,7 @@ object InputConsumerUtils {
|
||||
reasonPrefix,
|
||||
SUBSTRING_PREFIX,
|
||||
)
|
||||
base =
|
||||
AccessibilityInputConsumer(
|
||||
context,
|
||||
deviceState,
|
||||
gestureState,
|
||||
base,
|
||||
inputMonitorCompat,
|
||||
)
|
||||
base = AccessibilityInputConsumer(context, deviceState, base, inputMonitorCompat)
|
||||
}
|
||||
} else {
|
||||
val reasonPrefix = "device is not in gesture navigation mode"
|
||||
|
||||
@@ -80,7 +80,7 @@ public final class LauncherActivityInterface extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSwipeUpToHomeComplete(RecentsAnimationDeviceState deviceState) {
|
||||
public void onSwipeUpToHomeComplete() {
|
||||
QuickstepLauncher launcher = getCreatedContainer();
|
||||
if (launcher == null) {
|
||||
return;
|
||||
@@ -93,7 +93,7 @@ public final class LauncherActivityInterface extends
|
||||
MAIN_EXECUTOR.getHandler().post(launcher.getStateManager()::reapplyState);
|
||||
|
||||
launcher.getRootView().setForceHideBackArrow(false);
|
||||
notifyRecentsOfOrientation(deviceState.getRotationTouchHelper());
|
||||
notifyRecentsOfOrientation();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,9 +106,9 @@ public final class LauncherActivityInterface extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
|
||||
public AnimationFactory prepareRecentsUI(
|
||||
boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback) {
|
||||
notifyRecentsOfOrientation(deviceState.getRotationTouchHelper());
|
||||
notifyRecentsOfOrientation();
|
||||
DefaultAnimationFactory factory = new DefaultAnimationFactory(callback) {
|
||||
@Override
|
||||
protected void createBackgroundToOverviewAnim(QuickstepLauncher activity,
|
||||
@@ -227,7 +227,7 @@ public final class LauncherActivityInterface extends
|
||||
|
||||
|
||||
@Override
|
||||
public void onExitOverview(RotationTouchHelper deviceState, Runnable exitRunnable) {
|
||||
public void onExitOverview(Runnable exitRunnable) {
|
||||
final StateManager<LauncherState, Launcher> stateManager =
|
||||
getCreatedContainer().getStateManager();
|
||||
stateManager.addStateListener(
|
||||
@@ -237,18 +237,16 @@ public final class LauncherActivityInterface extends
|
||||
// Are we going from Recents to Workspace?
|
||||
if (toState == LauncherState.NORMAL) {
|
||||
exitRunnable.run();
|
||||
notifyRecentsOfOrientation(deviceState);
|
||||
notifyRecentsOfOrientation();
|
||||
stateManager.removeStateListener(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void notifyRecentsOfOrientation(RotationTouchHelper rotationTouchHelper) {
|
||||
private void notifyRecentsOfOrientation() {
|
||||
// reset layout on swipe to home
|
||||
RecentsView recentsView = getCreatedContainer().getOverviewPanel();
|
||||
recentsView.setLayoutRotation(rotationTouchHelper.getCurrentActiveRotation(),
|
||||
rotationTouchHelper.getDisplayRotation());
|
||||
((RecentsView) getCreatedContainer().getOverviewPanel()).reapplyActiveRotation();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -67,11 +67,10 @@ import java.util.List;
|
||||
public class LauncherSwipeHandlerV2 extends AbsSwipeUpHandler<
|
||||
QuickstepLauncher, RecentsView<QuickstepLauncher, LauncherState>, LauncherState> {
|
||||
|
||||
public LauncherSwipeHandlerV2(Context context, RecentsAnimationDeviceState deviceState,
|
||||
TaskAnimationManager taskAnimationManager, GestureState gestureState, long touchTimeMs,
|
||||
boolean continuingLastGesture, InputConsumerController inputConsumer,
|
||||
MSDLPlayerWrapper msdlPlayerWrapper) {
|
||||
super(context, deviceState, taskAnimationManager, gestureState, touchTimeMs,
|
||||
public LauncherSwipeHandlerV2(Context context, TaskAnimationManager taskAnimationManager,
|
||||
GestureState gestureState, long touchTimeMs, boolean continuingLastGesture,
|
||||
InputConsumerController inputConsumer, MSDLPlayerWrapper msdlPlayerWrapper) {
|
||||
super(context, taskAnimationManager, gestureState, touchTimeMs,
|
||||
continuingLastGesture, inputConsumer, msdlPlayerWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,9 @@ import androidx.annotation.VisibleForTesting;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.DisplayController.DisplayInfoChangeListener;
|
||||
import com.android.launcher3.util.DisplayController.Info;
|
||||
import com.android.launcher3.util.MainThreadInitializedObject;
|
||||
import com.android.launcher3.util.NavigationMode;
|
||||
import com.android.launcher3.util.SafeCloseable;
|
||||
import com.android.launcher3.util.SettingsCache;
|
||||
import com.android.quickstep.TopTaskTracker.CachedTaskInfo;
|
||||
import com.android.quickstep.util.ActiveGestureLog;
|
||||
@@ -88,9 +90,8 @@ import java.util.ArrayList;
|
||||
/**
|
||||
* Manages the state of the system during a swipe up gesture.
|
||||
*/
|
||||
public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, ExclusionListener {
|
||||
|
||||
private static final String TAG = "RecentsAnimationDeviceState";
|
||||
public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, ExclusionListener,
|
||||
SafeCloseable {
|
||||
|
||||
static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode";
|
||||
|
||||
@@ -98,6 +99,9 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
private static final float QUICKSTEP_TOUCH_SLOP_RATIO_TWO_BUTTON = 3f;
|
||||
private static final float QUICKSTEP_TOUCH_SLOP_RATIO_GESTURAL = 1.414f;
|
||||
|
||||
public static MainThreadInitializedObject<RecentsAnimationDeviceState> INSTANCE =
|
||||
new MainThreadInitializedObject<>(RecentsAnimationDeviceState::new);
|
||||
|
||||
private final Context mContext;
|
||||
private final DisplayController mDisplayController;
|
||||
|
||||
@@ -130,41 +134,21 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
private @NonNull Region mExclusionRegion = GestureExclusionManager.EMPTY_REGION;
|
||||
private boolean mExclusionListenerRegistered;
|
||||
|
||||
public RecentsAnimationDeviceState(Context context) {
|
||||
this(context, false, GestureExclusionManager.INSTANCE);
|
||||
}
|
||||
|
||||
public RecentsAnimationDeviceState(Context context, boolean isInstanceForTouches) {
|
||||
this(context, isInstanceForTouches, GestureExclusionManager.INSTANCE);
|
||||
private RecentsAnimationDeviceState(Context context) {
|
||||
this(context, GestureExclusionManager.INSTANCE);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
RecentsAnimationDeviceState(Context context, GestureExclusionManager exclusionManager) {
|
||||
this(context, false, exclusionManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isInstanceForTouches {@code true} if this is the persistent instance being used for
|
||||
* gesture touch handling
|
||||
*/
|
||||
RecentsAnimationDeviceState(
|
||||
Context context, boolean isInstanceForTouches,
|
||||
GestureExclusionManager exclusionManager) {
|
||||
mContext = context;
|
||||
mDisplayController = DisplayController.INSTANCE.get(context);
|
||||
mExclusionManager = exclusionManager;
|
||||
mContextualSearchStateManager = ContextualSearchStateManager.INSTANCE.get(context);
|
||||
mIsOneHandedModeSupported = SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false);
|
||||
mRotationTouchHelper = RotationTouchHelper.INSTANCE.get(context);
|
||||
if (isInstanceForTouches) {
|
||||
// rotationTouchHelper doesn't get initialized after being destroyed, so only destroy
|
||||
// if primary TouchInteractionService instance needs to be destroyed.
|
||||
mRotationTouchHelper.init();
|
||||
runOnDestroy(mRotationTouchHelper::destroy);
|
||||
}
|
||||
|
||||
// Register for exclusion updates
|
||||
runOnDestroy(() -> unregisterExclusionListener());
|
||||
runOnDestroy(this::unregisterExclusionListener);
|
||||
|
||||
// Register for display changes changes
|
||||
mDisplayController.addChangeListener(this);
|
||||
@@ -225,10 +209,8 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
mOnDestroyActions.add(action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up all the registered listeners and receivers.
|
||||
*/
|
||||
public void destroy() {
|
||||
@Override
|
||||
public void close() {
|
||||
for (Runnable r : mOnDestroyActions) {
|
||||
r.run();
|
||||
}
|
||||
@@ -603,10 +585,6 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
return mPipIsActive;
|
||||
}
|
||||
|
||||
public RotationTouchHelper getRotationTouchHelper() {
|
||||
return mRotationTouchHelper;
|
||||
}
|
||||
|
||||
/** Returns whether IME is rendering nav buttons, and IME is currently showing. */
|
||||
public boolean isImeRenderingNavButtons() {
|
||||
return mCanImeRenderGesturalNavButtons && mMode == NO_BUTTON
|
||||
|
||||
@@ -47,7 +47,6 @@ import com.android.systemui.shared.system.TaskStackChangeListener;
|
||||
import com.android.systemui.shared.system.TaskStackChangeListeners;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Helper class for transforming touch events
|
||||
@@ -57,16 +56,14 @@ public class RotationTouchHelper implements DisplayInfoChangeListener, SafeClose
|
||||
public static final MainThreadInitializedObject<RotationTouchHelper> INSTANCE =
|
||||
new MainThreadInitializedObject<>(RotationTouchHelper::new);
|
||||
|
||||
private OrientationTouchTransformer mOrientationTouchTransformer;
|
||||
private DisplayController mDisplayController;
|
||||
private int mDisplayId;
|
||||
private final OrientationTouchTransformer mOrientationTouchTransformer;
|
||||
private final DisplayController mDisplayController;
|
||||
private final int mDisplayId;
|
||||
private int mDisplayRotation;
|
||||
|
||||
private final ArrayList<Runnable> mOnDestroyActions = new ArrayList<>();
|
||||
|
||||
private NavigationMode mMode = THREE_BUTTONS;
|
||||
|
||||
private TaskStackChangeListener mFrozenTaskListener = new TaskStackChangeListener() {
|
||||
private final TaskStackChangeListener mFrozenTaskListener = new TaskStackChangeListener() {
|
||||
@Override
|
||||
public void onRecentTaskListFrozenChanged(boolean frozen) {
|
||||
mTaskListFrozen = frozen;
|
||||
@@ -93,7 +90,7 @@ public class RotationTouchHelper implements DisplayInfoChangeListener, SafeClose
|
||||
}
|
||||
};
|
||||
|
||||
private Runnable mExitOverviewRunnable = new Runnable() {
|
||||
private final Runnable mExitOverviewRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mInOverview = false;
|
||||
@@ -107,7 +104,7 @@ public class RotationTouchHelper implements DisplayInfoChangeListener, SafeClose
|
||||
* rotates rotates the device to match that orientation, this triggers calls to sysui to adjust
|
||||
* the navbar.
|
||||
*/
|
||||
private OrientationEventListener mOrientationListener;
|
||||
private final OrientationEventListener mOrientationListener;
|
||||
private int mSensorRotation = ROTATION_0;
|
||||
/**
|
||||
* This is the configuration of the foreground app or the app that will be in the foreground
|
||||
@@ -120,7 +117,6 @@ public class RotationTouchHelper implements DisplayInfoChangeListener, SafeClose
|
||||
* would indicate the user's intention to rotate the foreground app.
|
||||
*/
|
||||
private boolean mPrioritizeDeviceRotation = false;
|
||||
private Runnable mOnDestroyFrozenTaskRunnable;
|
||||
/**
|
||||
* Set to true when user swipes to recents. In recents, we ignore the state of the recents
|
||||
* task list being frozen or not to allow the user to keep interacting with nav bar rotation
|
||||
@@ -131,23 +127,8 @@ public class RotationTouchHelper implements DisplayInfoChangeListener, SafeClose
|
||||
private boolean mTaskListFrozen;
|
||||
private final Context mContext;
|
||||
|
||||
/**
|
||||
* Keeps track of whether destroy has been called for this instance. Mainly used for TAPL tests
|
||||
* where multiple instances of RotationTouchHelper are being created. b/177316094
|
||||
*/
|
||||
private boolean mNeedsInit = true;
|
||||
|
||||
private RotationTouchHelper(Context context) {
|
||||
mContext = context;
|
||||
if (mNeedsInit) {
|
||||
init();
|
||||
}
|
||||
}
|
||||
|
||||
public void init() {
|
||||
if (!mNeedsInit) {
|
||||
return;
|
||||
}
|
||||
mDisplayController = DisplayController.INSTANCE.get(mContext);
|
||||
Resources resources = mContext.getResources();
|
||||
mDisplayId = DEFAULT_DISPLAY;
|
||||
@@ -158,8 +139,7 @@ public class RotationTouchHelper implements DisplayInfoChangeListener, SafeClose
|
||||
// Register for navigation mode changes
|
||||
mDisplayController.addChangeListener(this);
|
||||
DisplayController.Info info = mDisplayController.getInfo();
|
||||
onDisplayInfoChangedInternal(info, CHANGE_ALL, hasGestures(info.getNavigationMode()));
|
||||
runOnDestroy(() -> mDisplayController.removeChangeListener(this));
|
||||
onDisplayInfoChanged(context, info, CHANGE_ALL);
|
||||
|
||||
mOrientationListener = new OrientationEventListener(mContext) {
|
||||
@Override
|
||||
@@ -180,40 +160,14 @@ public class RotationTouchHelper implements DisplayInfoChangeListener, SafeClose
|
||||
}
|
||||
}
|
||||
};
|
||||
runOnDestroy(() -> mOrientationListener.disable());
|
||||
mNeedsInit = false;
|
||||
}
|
||||
|
||||
private void setupOrientationSwipeHandler() {
|
||||
TaskStackChangeListeners.getInstance().registerTaskStackListener(mFrozenTaskListener);
|
||||
mOnDestroyFrozenTaskRunnable = () -> TaskStackChangeListeners.getInstance()
|
||||
.unregisterTaskStackListener(mFrozenTaskListener);
|
||||
runOnDestroy(mOnDestroyFrozenTaskRunnable);
|
||||
}
|
||||
|
||||
private void destroyOrientationSwipeHandlerCallback() {
|
||||
TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mFrozenTaskListener);
|
||||
mOnDestroyActions.remove(mOnDestroyFrozenTaskRunnable);
|
||||
}
|
||||
|
||||
private void runOnDestroy(Runnable action) {
|
||||
mOnDestroyActions.add(action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up all the registered listeners and receivers.
|
||||
*/
|
||||
public void destroy() {
|
||||
for (Runnable r : mOnDestroyActions) {
|
||||
r.run();
|
||||
}
|
||||
mNeedsInit = true;
|
||||
mOnDestroyActions.clear();
|
||||
mDisplayController.removeChangeListener(this);
|
||||
mOrientationListener.disable();
|
||||
TaskStackChangeListeners.getInstance()
|
||||
.unregisterTaskStackListener(mFrozenTaskListener);
|
||||
}
|
||||
|
||||
public boolean isTaskListFrozen() {
|
||||
@@ -264,10 +218,6 @@ public class RotationTouchHelper implements DisplayInfoChangeListener, SafeClose
|
||||
|
||||
@Override
|
||||
public void onDisplayInfoChanged(Context context, Info info, int flags) {
|
||||
onDisplayInfoChangedInternal(info, flags, false);
|
||||
}
|
||||
|
||||
private void onDisplayInfoChangedInternal(Info info, int flags, boolean forceRegister) {
|
||||
if ((flags & (CHANGE_ROTATION | CHANGE_ACTIVE_SCREEN | CHANGE_NAVIGATION_MODE
|
||||
| CHANGE_SUPPORTED_BOUNDS)) != 0) {
|
||||
mDisplayRotation = info.rotation;
|
||||
@@ -300,12 +250,12 @@ public class RotationTouchHelper implements DisplayInfoChangeListener, SafeClose
|
||||
mOrientationTouchTransformer.setNavigationMode(newMode, mDisplayController.getInfo(),
|
||||
mContext.getResources());
|
||||
|
||||
if (forceRegister || (!hasGestures(mMode) && hasGestures(newMode))) {
|
||||
setupOrientationSwipeHandler();
|
||||
} else if (hasGestures(mMode) && !hasGestures(newMode)) {
|
||||
destroyOrientationSwipeHandlerCallback();
|
||||
TaskStackChangeListeners.getInstance()
|
||||
.unregisterTaskStackListener(mFrozenTaskListener);
|
||||
if (hasGestures(newMode)) {
|
||||
TaskStackChangeListeners.getInstance()
|
||||
.registerTaskStackListener(mFrozenTaskListener);
|
||||
}
|
||||
|
||||
mMode = newMode;
|
||||
}
|
||||
}
|
||||
@@ -363,7 +313,7 @@ public class RotationTouchHelper implements DisplayInfoChangeListener, SafeClose
|
||||
// If we're in landscape w/o ever quickswitching, show the navbar in landscape
|
||||
enableMultipleRegions(true);
|
||||
}
|
||||
containerInterface.onExitOverview(this, mExitOverviewRunnable);
|
||||
containerInterface.onExitOverview(mExitOverviewRunnable);
|
||||
} else if (endTarget == GestureState.GestureEndTarget.HOME
|
||||
|| endTarget == GestureState.GestureEndTarget.ALL_APPS) {
|
||||
enableMultipleRegions(false);
|
||||
|
||||
@@ -58,7 +58,7 @@ import java.util.Arrays;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public abstract class SwipeUpAnimationLogic implements
|
||||
RecentsAnimationCallbacks.RecentsAnimationListener{
|
||||
RecentsAnimationCallbacks.RecentsAnimationListener {
|
||||
|
||||
protected static final Rect TEMP_RECT = new Rect();
|
||||
protected final RemoteTargetGluer mTargetGluer;
|
||||
@@ -66,7 +66,6 @@ public abstract class SwipeUpAnimationLogic implements
|
||||
protected DeviceProfile mDp;
|
||||
|
||||
protected final Context mContext;
|
||||
protected final RecentsAnimationDeviceState mDeviceState;
|
||||
protected final GestureState mGestureState;
|
||||
|
||||
protected RemoteTargetHandle[] mRemoteTargetHandles;
|
||||
@@ -85,20 +84,19 @@ public abstract class SwipeUpAnimationLogic implements
|
||||
|
||||
protected boolean mIsSwipeForSplit;
|
||||
|
||||
public SwipeUpAnimationLogic(Context context, RecentsAnimationDeviceState deviceState,
|
||||
GestureState gestureState) {
|
||||
public SwipeUpAnimationLogic(Context context, GestureState gestureState) {
|
||||
mContext = context;
|
||||
mDeviceState = deviceState;
|
||||
mGestureState = gestureState;
|
||||
updateIsGestureForSplit(TopTaskTracker.INSTANCE.get(context)
|
||||
.getRunningSplitTaskIds().length);
|
||||
|
||||
mTargetGluer = new RemoteTargetGluer(mContext, mGestureState.getContainerInterface());
|
||||
mRemoteTargetHandles = mTargetGluer.getRemoteTargetHandles();
|
||||
RotationTouchHelper rotationTouchHelper = RotationTouchHelper.INSTANCE.get(context);
|
||||
runActionOnRemoteHandles(remoteTargetHandle ->
|
||||
remoteTargetHandle.getTaskViewSimulator().getOrientationState().update(
|
||||
mDeviceState.getRotationTouchHelper().getCurrentActiveRotation(),
|
||||
mDeviceState.getRotationTouchHelper().getDisplayRotation()
|
||||
rotationTouchHelper.getCurrentActiveRotation(),
|
||||
rotationTouchHelper.getDisplayRotation()
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -552,8 +552,8 @@ public class TouchInteractionService extends Service {
|
||||
// Initialize anything here that is needed in direct boot mode.
|
||||
// Everything else should be initialized in onUserUnlocked() below.
|
||||
mMainChoreographer = Choreographer.getInstance();
|
||||
mDeviceState = new RecentsAnimationDeviceState(this, true);
|
||||
mRotationTouchHelper = mDeviceState.getRotationTouchHelper();
|
||||
mDeviceState = RecentsAnimationDeviceState.INSTANCE.get(this);
|
||||
mRotationTouchHelper = RotationTouchHelper.INSTANCE.get(this);
|
||||
mAllAppsActionManager = new AllAppsActionManager(
|
||||
this, UI_HELPER_EXECUTOR, this::createAllAppsPendingIntent);
|
||||
mTrackpadsConnected = new ActiveTrackpadList(this, () -> {
|
||||
@@ -715,7 +715,6 @@ public class TouchInteractionService extends Service {
|
||||
mOverviewComponentObserver.removeOverviewChangeListener(mOverviewChangeListener);
|
||||
}
|
||||
disposeEventHandlers("TouchInteractionService onDestroy()");
|
||||
mDeviceState.destroy();
|
||||
SystemUiProxy.INSTANCE.get(this).clearProxy();
|
||||
|
||||
mAllAppsActionManager.onDestroy();
|
||||
@@ -1158,21 +1157,21 @@ public class TouchInteractionService extends Service {
|
||||
|
||||
private AbsSwipeUpHandler createLauncherSwipeHandler(
|
||||
GestureState gestureState, long touchTimeMs) {
|
||||
return new LauncherSwipeHandlerV2(this, mDeviceState, mTaskAnimationManager,
|
||||
return new LauncherSwipeHandlerV2(this, mTaskAnimationManager,
|
||||
gestureState, touchTimeMs, mTaskAnimationManager.isRecentsAnimationRunning(),
|
||||
mInputConsumer, MSDLPlayerWrapper.INSTANCE.get(this));
|
||||
}
|
||||
|
||||
private AbsSwipeUpHandler createFallbackSwipeHandler(
|
||||
GestureState gestureState, long touchTimeMs) {
|
||||
return new FallbackSwipeHandler(this, mDeviceState, mTaskAnimationManager,
|
||||
return new FallbackSwipeHandler(this, mTaskAnimationManager,
|
||||
gestureState, touchTimeMs, mTaskAnimationManager.isRecentsAnimationRunning(),
|
||||
mInputConsumer, MSDLPlayerWrapper.INSTANCE.get(this));
|
||||
}
|
||||
|
||||
private AbsSwipeUpHandler createRecentsWindowSwipeHandler(
|
||||
GestureState gestureState, long touchTimeMs) {
|
||||
return new RecentsWindowSwipeHandler(this, mDeviceState, mTaskAnimationManager,
|
||||
return new RecentsWindowSwipeHandler(this, mTaskAnimationManager,
|
||||
gestureState, touchTimeMs, mTaskAnimationManager.isRecentsAnimationRunning(),
|
||||
mInputConsumer, MSDLPlayerWrapper.INSTANCE.get(this));
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource;
|
||||
import com.android.quickstep.BaseContainerInterface;
|
||||
import com.android.quickstep.FallbackActivityInterface;
|
||||
import com.android.quickstep.GestureState;
|
||||
import com.android.quickstep.RotationTouchHelper;
|
||||
import com.android.quickstep.fallback.window.RecentsDisplayModel;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.quickstep.util.SplitSelectStateController;
|
||||
@@ -114,12 +113,11 @@ public class FallbackRecentsView<CONTAINER_TYPE extends Context & RecentsViewCon
|
||||
* to the home task. This allows us to handle quick-switch similarly to a quick-switching
|
||||
* from a foreground task.
|
||||
*/
|
||||
public void onGestureAnimationStartOnHome(Task[] homeTask,
|
||||
RotationTouchHelper rotationTouchHelper) {
|
||||
public void onGestureAnimationStartOnHome(Task[] homeTask) {
|
||||
// TODO(b/195607777) General fallback love, but this might be correct
|
||||
// Home task should be defined as the front-most task info I think?
|
||||
mHomeTask = homeTask.length > 0 ? homeTask[0] : null;
|
||||
onGestureAnimationStart(homeTask, rotationTouchHelper);
|
||||
onGestureAnimationStart(homeTask);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -66,7 +66,6 @@ import com.android.launcher3.util.MSDLPlayerWrapper;
|
||||
import com.android.quickstep.AbsSwipeUpHandler;
|
||||
import com.android.quickstep.GestureState;
|
||||
import com.android.quickstep.RecentsAnimationController;
|
||||
import com.android.quickstep.RecentsAnimationDeviceState;
|
||||
import com.android.quickstep.RecentsAnimationTargets;
|
||||
import com.android.quickstep.TaskAnimationManager;
|
||||
import com.android.quickstep.fallback.FallbackRecentsView;
|
||||
@@ -110,11 +109,10 @@ public class RecentsWindowSwipeHandler extends AbsSwipeUpHandler<RecentsWindowMa
|
||||
|
||||
private boolean mAppCanEnterPip;
|
||||
|
||||
public RecentsWindowSwipeHandler(Context context, RecentsAnimationDeviceState deviceState,
|
||||
TaskAnimationManager taskAnimationManager, GestureState gestureState, long touchTimeMs,
|
||||
boolean continuingLastGesture, InputConsumerController inputConsumer,
|
||||
MSDLPlayerWrapper msdlPlayerWrapper) {
|
||||
super(context, deviceState, taskAnimationManager, gestureState, touchTimeMs,
|
||||
public RecentsWindowSwipeHandler(Context context, TaskAnimationManager taskAnimationManager,
|
||||
GestureState gestureState, long touchTimeMs, boolean continuingLastGesture,
|
||||
InputConsumerController inputConsumer, MSDLPlayerWrapper msdlPlayerWrapper) {
|
||||
super(context, taskAnimationManager, gestureState, touchTimeMs,
|
||||
continuingLastGesture, inputConsumer, msdlPlayerWrapper);
|
||||
|
||||
mRecentsDisplayModel = RecentsDisplayModel.getINSTANCE().get(context);
|
||||
@@ -257,8 +255,7 @@ public class RecentsWindowSwipeHandler extends AbsSwipeUpHandler<RecentsWindowMa
|
||||
if (mRunningOverHome) {
|
||||
if (DisplayController.getNavigationMode(mContext).hasGestures) {
|
||||
mRecentsView.onGestureAnimationStartOnHome(
|
||||
mGestureState.getRunningTask().getPlaceholderTasks(),
|
||||
mDeviceState.getRotationTouchHelper());
|
||||
mGestureState.getRunningTask().getPlaceholderTasks());
|
||||
}
|
||||
} else {
|
||||
super.notifyGestureAnimationStartToRecents();
|
||||
|
||||
@@ -29,9 +29,9 @@ import android.view.VelocityTracker;
|
||||
import android.view.ViewConfiguration;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.quickstep.GestureState;
|
||||
import com.android.quickstep.InputConsumer;
|
||||
import com.android.quickstep.RecentsAnimationDeviceState;
|
||||
import com.android.quickstep.RotationTouchHelper;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.util.MotionPauseDetector;
|
||||
import com.android.systemui.shared.system.InputMonitorCompat;
|
||||
@@ -47,7 +47,7 @@ public class AccessibilityInputConsumer extends DelegateInputConsumer {
|
||||
private final VelocityTracker mVelocityTracker;
|
||||
private final MotionPauseDetector mMotionPauseDetector;
|
||||
private final RecentsAnimationDeviceState mDeviceState;
|
||||
private final GestureState mGestureState;
|
||||
private final RotationTouchHelper mRotationHelper;
|
||||
|
||||
private final float mMinGestureDistance;
|
||||
private final float mMinFlingVelocity;
|
||||
@@ -57,7 +57,7 @@ public class AccessibilityInputConsumer extends DelegateInputConsumer {
|
||||
private float mTotalY;
|
||||
|
||||
public AccessibilityInputConsumer(Context context, RecentsAnimationDeviceState deviceState,
|
||||
GestureState gestureState, InputConsumer delegate, InputMonitorCompat inputMonitor) {
|
||||
InputConsumer delegate, InputMonitorCompat inputMonitor) {
|
||||
super(delegate, inputMonitor);
|
||||
mContext = context;
|
||||
mVelocityTracker = VelocityTracker.obtain();
|
||||
@@ -65,7 +65,7 @@ public class AccessibilityInputConsumer extends DelegateInputConsumer {
|
||||
.getDimension(R.dimen.accessibility_gesture_min_swipe_distance);
|
||||
mMinFlingVelocity = ViewConfiguration.get(context).getScaledMinimumFlingVelocity();
|
||||
mDeviceState = deviceState;
|
||||
mGestureState = gestureState;
|
||||
mRotationHelper = RotationTouchHelper.INSTANCE.get(context);
|
||||
|
||||
mMotionPauseDetector = new MotionPauseDetector(context);
|
||||
}
|
||||
@@ -102,8 +102,8 @@ public class AccessibilityInputConsumer extends DelegateInputConsumer {
|
||||
case ACTION_POINTER_DOWN: {
|
||||
if (mState == STATE_INACTIVE) {
|
||||
int pointerIndex = ev.getActionIndex();
|
||||
if (mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev,
|
||||
pointerIndex) && mDelegate.allowInterceptByParent()) {
|
||||
if (mRotationHelper.isInSwipeUpTouchRegion(ev, pointerIndex)
|
||||
&& mDelegate.allowInterceptByParent()) {
|
||||
setActive(ev);
|
||||
|
||||
mActivePointerId = ev.getPointerId(pointerIndex);
|
||||
|
||||
@@ -52,6 +52,7 @@ import com.android.quickstep.RecentsAnimationController;
|
||||
import com.android.quickstep.RecentsAnimationDeviceState;
|
||||
import com.android.quickstep.RecentsAnimationTargets;
|
||||
import com.android.quickstep.RemoteAnimationTargets;
|
||||
import com.android.quickstep.RotationTouchHelper;
|
||||
import com.android.quickstep.TaskAnimationManager;
|
||||
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
|
||||
import com.android.quickstep.util.TransformParams;
|
||||
@@ -82,7 +83,7 @@ public class DeviceLockedInputConsumer implements InputConsumer,
|
||||
getFlagForIndex(1, "STATE_HANDLER_INVALIDATED");
|
||||
|
||||
private final Context mContext;
|
||||
private final RecentsAnimationDeviceState mDeviceState;
|
||||
private final RotationTouchHelper mRotationTouchHelper;
|
||||
private final TaskAnimationManager mTaskAnimationManager;
|
||||
private final GestureState mGestureState;
|
||||
private final float mTouchSlopSquared;
|
||||
@@ -110,14 +111,14 @@ public class DeviceLockedInputConsumer implements InputConsumer,
|
||||
TaskAnimationManager taskAnimationManager, GestureState gestureState,
|
||||
InputMonitorCompat inputMonitorCompat) {
|
||||
mContext = context;
|
||||
mDeviceState = deviceState;
|
||||
mTaskAnimationManager = taskAnimationManager;
|
||||
mGestureState = gestureState;
|
||||
mTouchSlopSquared = mDeviceState.getSquaredTouchSlop();
|
||||
mTouchSlopSquared = deviceState.getSquaredTouchSlop();
|
||||
mTransformParams = new TransformParams();
|
||||
mInputMonitorCompat = inputMonitorCompat;
|
||||
mMaxTranslationY = context.getResources().getDimensionPixelSize(
|
||||
R.dimen.device_locked_y_offset);
|
||||
mRotationTouchHelper = RotationTouchHelper.INSTANCE.get(mContext);
|
||||
|
||||
// Do not use DeviceProfile as the user data might be locked
|
||||
mDisplaySize = DisplayController.INSTANCE.get(context).getInfo().currentSize;
|
||||
@@ -152,7 +153,7 @@ public class DeviceLockedInputConsumer implements InputConsumer,
|
||||
if (!mThresholdCrossed) {
|
||||
// Cancel interaction in case of multi-touch interaction
|
||||
int ptrIdx = ev.getActionIndex();
|
||||
if (!mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev, ptrIdx)) {
|
||||
if (!mRotationTouchHelper.isInSwipeUpTouchRegion(ev, ptrIdx)) {
|
||||
int action = ev.getAction();
|
||||
ev.setAction(ACTION_CANCEL);
|
||||
finishTouchTracking(ev);
|
||||
|
||||
@@ -156,8 +156,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
|
||||
mPassedPilferInputSlop = mPassedWindowMoveSlop = continuingPreviousGesture;
|
||||
mStartDisplacement = continuingPreviousGesture ? 0 : -mTouchSlop;
|
||||
mDisableHorizontalSwipe = !mPassedPilferInputSlop && disableHorizontalSwipe;
|
||||
mRotationTouchHelper = mDeviceState.getRotationTouchHelper();
|
||||
|
||||
mRotationTouchHelper = RotationTouchHelper.INSTANCE.get(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-7
@@ -50,7 +50,6 @@ import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.quickstep.GestureState;
|
||||
import com.android.quickstep.OverviewComponentObserver;
|
||||
import com.android.quickstep.RecentsAnimationDeviceState;
|
||||
import com.android.quickstep.RemoteTargetGluer;
|
||||
import com.android.quickstep.SwipeUpAnimationLogic;
|
||||
import com.android.quickstep.SwipeUpAnimationLogic.RunningWindowAnim;
|
||||
@@ -85,10 +84,8 @@ abstract class SwipeUpGestureTutorialController extends TutorialController {
|
||||
|
||||
SwipeUpGestureTutorialController(TutorialFragment tutorialFragment, TutorialType tutorialType) {
|
||||
super(tutorialFragment, tutorialType);
|
||||
RecentsAnimationDeviceState deviceState = new RecentsAnimationDeviceState(mContext);
|
||||
mTaskViewSwipeUpAnimation = new ViewSwipeUpAnimation(mContext, deviceState,
|
||||
mTaskViewSwipeUpAnimation = new ViewSwipeUpAnimation(mContext,
|
||||
new GestureState(OverviewComponentObserver.INSTANCE.get(mContext), -1));
|
||||
deviceState.destroy();
|
||||
|
||||
DeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(mContext)
|
||||
.getDeviceProfile(mContext)
|
||||
@@ -311,9 +308,8 @@ abstract class SwipeUpGestureTutorialController extends TutorialController {
|
||||
|
||||
class ViewSwipeUpAnimation extends SwipeUpAnimationLogic {
|
||||
|
||||
ViewSwipeUpAnimation(Context context, RecentsAnimationDeviceState deviceState,
|
||||
GestureState gestureState) {
|
||||
super(context, deviceState, gestureState);
|
||||
ViewSwipeUpAnimation(Context context, GestureState gestureState) {
|
||||
super(context, gestureState);
|
||||
mRemoteTargetHandles[0] = new RemoteTargetGluer.RemoteTargetHandle(
|
||||
mRemoteTargetHandles[0].getTaskViewSimulator(), new FakeTransformParams());
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
import com.android.quickstep.OverviewComponentObserver;
|
||||
import com.android.quickstep.RecentsAnimationCallbacks;
|
||||
import com.android.quickstep.RecentsAnimationController;
|
||||
import com.android.quickstep.RecentsAnimationDeviceState;
|
||||
import com.android.quickstep.RecentsAnimationTargets;
|
||||
import com.android.quickstep.RecentsModel;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
@@ -55,18 +54,15 @@ public class SplitWithKeyboardShortcutController {
|
||||
|
||||
private final QuickstepLauncher mLauncher;
|
||||
private final SplitSelectStateController mController;
|
||||
private final RecentsAnimationDeviceState mDeviceState;
|
||||
private final OverviewComponentObserver mOverviewComponentObserver;
|
||||
|
||||
private final int mSplitPlaceholderSize;
|
||||
private final int mSplitPlaceholderInset;
|
||||
|
||||
public SplitWithKeyboardShortcutController(QuickstepLauncher launcher,
|
||||
SplitSelectStateController controller,
|
||||
RecentsAnimationDeviceState deviceState) {
|
||||
public SplitWithKeyboardShortcutController(
|
||||
QuickstepLauncher launcher, SplitSelectStateController controller) {
|
||||
mLauncher = launcher;
|
||||
mController = controller;
|
||||
mDeviceState = deviceState;
|
||||
mOverviewComponentObserver = OverviewComponentObserver.INSTANCE.get(launcher);
|
||||
|
||||
mSplitPlaceholderSize = mLauncher.getResources().getDimensionPixelSize(
|
||||
@@ -104,10 +100,6 @@ public class SplitWithKeyboardShortcutController {
|
||||
});
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
mDeviceState.destroy();
|
||||
}
|
||||
|
||||
private class SplitWithKeyboardShortcutRecentsAnimationListener implements
|
||||
RecentsAnimationCallbacks.RecentsAnimationListener {
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@ import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource;
|
||||
import com.android.quickstep.BaseContainerInterface;
|
||||
import com.android.quickstep.GestureState;
|
||||
import com.android.quickstep.LauncherActivityInterface;
|
||||
import com.android.quickstep.RotationTouchHelper;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.util.AnimUtils;
|
||||
import com.android.quickstep.util.SplitSelectStateController;
|
||||
@@ -264,9 +263,8 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGestureAnimationStart(Task[] runningTasks,
|
||||
RotationTouchHelper rotationTouchHelper) {
|
||||
super.onGestureAnimationStart(runningTasks, rotationTouchHelper);
|
||||
public void onGestureAnimationStart(Task[] runningTasks) {
|
||||
super.onGestureAnimationStart(runningTasks);
|
||||
if (!ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY.isTrue()) {
|
||||
// TODO: b/333533253 - Remove after flag rollout
|
||||
DesktopVisibilityController.INSTANCE.get(mContainer).setRecentsGestureStart();
|
||||
|
||||
@@ -2780,14 +2780,12 @@ public abstract class RecentsView<
|
||||
/**
|
||||
* Called when a gesture from an app is starting.
|
||||
*/
|
||||
public void onGestureAnimationStart(
|
||||
Task[] runningTasks, RotationTouchHelper rotationTouchHelper) {
|
||||
public void onGestureAnimationStart(Task[] runningTasks) {
|
||||
Log.d(TAG, "onGestureAnimationStart - runningTasks: " + Arrays.toString(runningTasks));
|
||||
mActiveGestureRunningTasks = runningTasks;
|
||||
// This needs to be called before the other states are set since it can create the task view
|
||||
if (mOrientationState.setGestureActive(true)) {
|
||||
setLayoutRotation(rotationTouchHelper.getCurrentActiveRotation(),
|
||||
rotationTouchHelper.getDisplayRotation());
|
||||
reapplyActiveRotation();
|
||||
// Force update to ensure the initial task size is computed even if the orientation has
|
||||
// not changed.
|
||||
updateSizeAndPadding();
|
||||
@@ -4675,6 +4673,12 @@ public abstract class RecentsView<
|
||||
}
|
||||
}
|
||||
|
||||
public void reapplyActiveRotation() {
|
||||
RotationTouchHelper rotationTouchHelper = RotationTouchHelper.INSTANCE.get(getContext());
|
||||
setLayoutRotation(rotationTouchHelper.getCurrentActiveRotation(),
|
||||
rotationTouchHelper.getDisplayRotation());
|
||||
}
|
||||
|
||||
public void setLayoutRotation(int touchRotation, int displayRotation) {
|
||||
if (mOrientationState.update(touchRotation, displayRotation)) {
|
||||
updateOrientationHandler();
|
||||
|
||||
+2
-8
@@ -118,7 +118,6 @@ public abstract class AbsSwipeUpHandlerTestCase<
|
||||
|
||||
protected RecentsAnimationTargets mRecentsAnimationTargets;
|
||||
protected TaskAnimationManager mTaskAnimationManager;
|
||||
protected RecentsAnimationDeviceState mRecentsAnimationDeviceState;
|
||||
|
||||
@Mock protected CONTAINER_INTERFACE mActivityInterface;
|
||||
@Mock protected ContextInitListener<?> mContextInitListener;
|
||||
@@ -180,7 +179,8 @@ public abstract class AbsSwipeUpHandlerTestCase<
|
||||
|
||||
@Before
|
||||
public void setUpRecentsContainer() {
|
||||
mTaskAnimationManager = new TaskAnimationManager(mContext, mRecentsAnimationDeviceState);
|
||||
mTaskAnimationManager = new TaskAnimationManager(mContext,
|
||||
RecentsAnimationDeviceState.INSTANCE.get(mContext));
|
||||
RecentsViewContainer recentsContainer = getRecentsContainer();
|
||||
RECENTS_VIEW recentsView = getRecentsView();
|
||||
|
||||
@@ -198,12 +198,6 @@ public abstract class AbsSwipeUpHandlerTestCase<
|
||||
}).when(recentsContainer).runOnBindToTouchInteractionService(any());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUpRecentsAnimationDeviceState() {
|
||||
runOnMainSync(() ->
|
||||
mRecentsAnimationDeviceState = new RecentsAnimationDeviceState(mContext, true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitWhenReady_registersActivityInitListener() {
|
||||
String reasonString = "because i said so";
|
||||
|
||||
-1
@@ -44,7 +44,6 @@ public class FallbackSwipeHandlerTestCase extends AbsSwipeUpHandlerTestCase<
|
||||
long touchTimeMs, boolean continuingLastGesture) {
|
||||
return new FallbackSwipeHandler(
|
||||
mContext,
|
||||
mRecentsAnimationDeviceState,
|
||||
mTaskAnimationManager,
|
||||
mGestureState,
|
||||
touchTimeMs,
|
||||
|
||||
+6
-4
@@ -40,7 +40,6 @@ import org.mockito.Mockito.spy
|
||||
import org.mockito.junit.MockitoJUnit
|
||||
import org.mockito.kotlin.eq
|
||||
import org.mockito.kotlin.verify
|
||||
import org.mockito.kotlin.whenever
|
||||
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@@ -72,15 +71,18 @@ class LauncherSwipeHandlerV2Test {
|
||||
.bindSystemUiProxy(systemUiProxy)
|
||||
.bindRecentsDisplayModel(RecentsDisplayModel(sandboxContext))
|
||||
)
|
||||
|
||||
sandboxContext.putObject(
|
||||
RotationTouchHelper.INSTANCE,
|
||||
mock(RotationTouchHelper::class.java),
|
||||
)
|
||||
val deviceState = mock(RecentsAnimationDeviceState::class.java)
|
||||
whenever(deviceState.rotationTouchHelper).thenReturn(mock(RotationTouchHelper::class.java))
|
||||
sandboxContext.putObject(RecentsAnimationDeviceState.INSTANCE, deviceState)
|
||||
|
||||
gestureState = spy(GestureState(OverviewComponentObserver.INSTANCE.get(sandboxContext), 0))
|
||||
|
||||
underTest =
|
||||
LauncherSwipeHandlerV2(
|
||||
sandboxContext,
|
||||
deviceState,
|
||||
taskAnimationManager,
|
||||
gestureState,
|
||||
0,
|
||||
|
||||
-1
@@ -73,7 +73,6 @@ public class LauncherSwipeHandlerV2TestCase extends AbsSwipeUpHandlerTestCase<
|
||||
long touchTimeMs, boolean continuingLastGesture) {
|
||||
return new LauncherSwipeHandlerV2(
|
||||
mContext,
|
||||
mRecentsAnimationDeviceState,
|
||||
mTaskAnimationManager,
|
||||
mGestureState,
|
||||
touchTimeMs,
|
||||
|
||||
-1
@@ -62,7 +62,6 @@ public class RecentsWindowSwipeHandlerTestCase extends AbsSwipeUpHandlerTestCase
|
||||
boolean continuingLastGesture) {
|
||||
return new RecentsWindowSwipeHandler(
|
||||
mContext,
|
||||
mRecentsAnimationDeviceState,
|
||||
mTaskAnimationManager,
|
||||
mGestureState,
|
||||
touchTimeMs,
|
||||
|
||||
@@ -333,13 +333,11 @@ public class FallbackRecentsTest {
|
||||
|
||||
private class OverviewUpdateHandler implements OverviewChangeListener {
|
||||
|
||||
final RecentsAnimationDeviceState mRads;
|
||||
final OverviewComponentObserver mObserver;
|
||||
final CountDownLatch mChangeCounter;
|
||||
|
||||
OverviewUpdateHandler() {
|
||||
Context ctx = getInstrumentation().getTargetContext();
|
||||
mRads = new RecentsAnimationDeviceState(ctx);
|
||||
mObserver = OverviewComponentObserver.INSTANCE.get(ctx);
|
||||
mChangeCounter = new CountDownLatch(1);
|
||||
if (mObserver.getHomeIntent().getComponent()
|
||||
@@ -358,7 +356,6 @@ public class FallbackRecentsTest {
|
||||
|
||||
void destroy() {
|
||||
mObserver.removeOverviewChangeListener(this);
|
||||
mRads.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +127,8 @@ public class InputConsumerUtilsTest {
|
||||
@Before
|
||||
public void setupMainThreadInitializedObjects() {
|
||||
mContext.putObject(LockedUserState.INSTANCE, mLockedUserState);
|
||||
mContext.putObject(RotationTouchHelper.INSTANCE, mock(RotationTouchHelper.class));
|
||||
mContext.putObject(RecentsAnimationDeviceState.INSTANCE, mDeviceState);
|
||||
}
|
||||
|
||||
@Before
|
||||
@@ -193,7 +195,6 @@ public class InputConsumerUtilsTest {
|
||||
when(mDeviceState.canStartSystemGesture()).thenReturn(true);
|
||||
when(mDeviceState.isFullyGesturalNavMode()).thenReturn(true);
|
||||
when(mDeviceState.getNavBarPosition()).thenReturn(mock(NavBarPosition.class));
|
||||
when(mDeviceState.getRotationTouchHelper()).thenReturn(mock(RotationTouchHelper.class));
|
||||
}
|
||||
|
||||
@After
|
||||
|
||||
@@ -46,18 +46,12 @@ public class TaskAnimationManagerTest {
|
||||
private SystemUiProxy mSystemUiProxy;
|
||||
|
||||
private TaskAnimationManager mTaskAnimationManager;
|
||||
protected RecentsAnimationDeviceState mRecentsAnimationDeviceState;
|
||||
|
||||
@Before
|
||||
public void setUpRecentsAnimationDeviceState() {
|
||||
runOnMainSync(() ->
|
||||
mRecentsAnimationDeviceState = new RecentsAnimationDeviceState(mContext, true));
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mTaskAnimationManager = new TaskAnimationManager(mContext, mRecentsAnimationDeviceState) {
|
||||
mTaskAnimationManager = new TaskAnimationManager(mContext,
|
||||
RecentsAnimationDeviceState.INSTANCE.get(mContext)) {
|
||||
@Override
|
||||
SystemUiProxy getSystemUiProxy() {
|
||||
return mSystemUiProxy;
|
||||
|
||||
Reference in New Issue
Block a user