Loading go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java +2 −0 Original line number Diff line number Diff line Loading @@ -89,4 +89,6 @@ public abstract class RecentsUiFactory { public static RotationMode getRotationMode(DeviceProfile dp) { return RotationMode.NORMAL; } public static void clearSwipeSharedState(boolean finishAnimation) {} } quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java +8 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import com.android.launcher3.util.UiThreadHelper; import com.android.launcher3.util.UiThreadHelper.AsyncCommand; import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.TouchInteractionService; import com.android.quickstep.views.RecentsView; import com.android.systemui.shared.system.WindowManagerWrapper; Loading Loading @@ -183,6 +184,13 @@ public abstract class RecentsUiFactory { return new RecentsViewStateController(launcher); } /** * Clears the swipe shared state for the current swipe gesture. */ public static void clearSwipeSharedState(boolean finishAnimation) { TouchInteractionService.getSwipeSharedState().clearAllState(finishAnimation); } /** * Recents logic that triggers when launcher state changes or launcher activity stops/resumes. * Loading quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeSharedState.java +7 −5 Original line number Diff line number Diff line Loading @@ -72,13 +72,15 @@ public class SwipeSharedState implements SwipeAnimationListener { mLastAnimationRunning = false; } private void clearListenerState() { private void clearListenerState(boolean finishAnimation) { if (mRecentsAnimationListener != null) { mRecentsAnimationListener.removeListener(this); mRecentsAnimationListener.cancelListener(); if (mLastAnimationRunning && mLastAnimationTarget != null) { Utilities.postAsyncCallback(MAIN_THREAD_EXECUTOR.getHandler(), mLastAnimationTarget::cancelAnimation); finishAnimation ? mLastAnimationTarget::finishAnimation : mLastAnimationTarget::cancelAnimation); mLastAnimationTarget = null; } } Loading Loading @@ -106,7 +108,7 @@ public class SwipeSharedState implements SwipeAnimationListener { } } clearListenerState(); clearListenerState(false /* finishAnimation */); boolean shouldMinimiseSplitScreen = mOverviewComponentObserver == null ? false : mOverviewComponentObserver.getActivityControlHelper().shouldMinimizeSplitScreen(); mRecentsAnimationListener = new RecentsAnimationListenerSet( Loading Loading @@ -138,8 +140,8 @@ public class SwipeSharedState implements SwipeAnimationListener { mLastAnimationTarget = mLastAnimationTarget.cloneWithoutTargets(); } public void clearAllState() { clearListenerState(); public void clearAllState(boolean finishAnimation) { clearListenerState(finishAnimation); canGestureBeContinued = false; recentsAnimationFinishInterrupted = false; nextRunningTaskId = -1; Loading quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +18 −14 Original line number Diff line number Diff line Loading @@ -225,14 +225,18 @@ public class TouchInteractionService extends Service implements }; private static boolean sConnected = false; private static final SwipeSharedState sSwipeSharedState = new SwipeSharedState(); public static boolean isConnected() { return sConnected; } private final SwipeSharedState mSwipeSharedState = new SwipeSharedState(); public static SwipeSharedState getSwipeSharedState() { return sSwipeSharedState; } private final InputConsumer mResetGestureInputConsumer = new ResetGestureInputConsumer(mSwipeSharedState); new ResetGestureInputConsumer(sSwipeSharedState); private ActivityManagerWrapper mAM; private RecentsModel mRecentsModel; Loading Loading @@ -436,7 +440,7 @@ public class TouchInteractionService extends Service implements mInputConsumer = InputConsumerController.getRecentsAnimationInputConsumer(); mIsUserUnlocked = true; mSwipeSharedState.setOverviewComponentObserver(mOverviewComponentObserver); sSwipeSharedState.setOverviewComponentObserver(mOverviewComponentObserver); mInputConsumer.registerInputConsumer(); onSystemUiProxySet(); onSystemUiFlagsChanged(); Loading Loading @@ -589,7 +593,7 @@ public class TouchInteractionService extends Service implements private InputConsumer newBaseConsumer(boolean useSharedState, MotionEvent event) { final RunningTaskInfo runningTaskInfo = mAM.getRunningTask(0); if (!useSharedState) { mSwipeSharedState.clearAllState(); sSwipeSharedState.clearAllState(false /* finishAnimation */); } if ((mSystemUiStateFlags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED) != 0) { // This handles apps showing over the lockscreen (e.g. camera) Loading @@ -599,16 +603,16 @@ public class TouchInteractionService extends Service implements final ActivityControlHelper activityControl = mOverviewComponentObserver.getActivityControlHelper(); if (runningTaskInfo == null && !mSwipeSharedState.goingToLauncher && !mSwipeSharedState.recentsAnimationFinishInterrupted) { if (runningTaskInfo == null && !sSwipeSharedState.goingToLauncher && !sSwipeSharedState.recentsAnimationFinishInterrupted) { return mResetGestureInputConsumer; } else if (mSwipeSharedState.recentsAnimationFinishInterrupted) { } else if (sSwipeSharedState.recentsAnimationFinishInterrupted) { // If the finish animation was interrupted, then continue using the other activity input // consumer but with the next task as the running task RunningTaskInfo info = new ActivityManager.RunningTaskInfo(); info.id = mSwipeSharedState.nextRunningTaskId; info.id = sSwipeSharedState.nextRunningTaskId; return createOtherActivityInputConsumer(event, info); } else if (mSwipeSharedState.goingToLauncher || activityControl.isResumed()) { } else if (sSwipeSharedState.goingToLauncher || activityControl.isResumed()) { return createOverviewInputConsumer(event); } else if (ENABLE_QUICKSTEP_LIVE_TILE.get() && activityControl.isInLiveTileMode()) { return createOverviewInputConsumer(event); Loading @@ -617,7 +621,7 @@ public class TouchInteractionService extends Service implements return mResetGestureInputConsumer; } else if (mMode == Mode.NO_BUTTON && !mOverviewComponentObserver.isHomeAndOverviewSame()) { return new FallbackNoButtonInputConsumer(this, activityControl, mInputMonitorCompat, mSwipeSharedState, mSwipeTouchRegion, mInputMonitorCompat, sSwipeSharedState, mSwipeTouchRegion, mOverviewComponentObserver, disableHorizontalSwipe(event), runningTaskInfo); } else { return createOtherActivityInputConsumer(event, runningTaskInfo); Loading @@ -640,13 +644,13 @@ public class TouchInteractionService extends Service implements return new OtherActivityInputConsumer(this, runningTaskInfo, mRecentsModel, mOverviewComponentObserver.getOverviewIntent(), activityControl, shouldDefer, mOverviewCallbacks, mInputConsumer, this::onConsumerInactive, mSwipeSharedState, mInputMonitorCompat, mSwipeTouchRegion, sSwipeSharedState, mInputMonitorCompat, mSwipeTouchRegion, disableHorizontalSwipe(event)); } private InputConsumer createDeviceLockedInputConsumer(RunningTaskInfo taskInfo) { if (mMode == Mode.NO_BUTTON && taskInfo != null) { return new DeviceLockedInputConsumer(this, mSwipeSharedState, mInputMonitorCompat, return new DeviceLockedInputConsumer(this, sSwipeSharedState, mInputMonitorCompat, mSwipeTouchRegion, taskInfo.taskId); } else { return mResetGestureInputConsumer; Loading @@ -661,7 +665,7 @@ public class TouchInteractionService extends Service implements return mResetGestureInputConsumer; } if (activity.getRootView().hasWindowFocus() || mSwipeSharedState.goingToLauncher) { if (activity.getRootView().hasWindowFocus() || sSwipeSharedState.goingToLauncher) { return new OverviewInputConsumer(activity, mInputMonitorCompat, false /* startingInActivityBounds */); } else { Loading Loading @@ -708,7 +712,7 @@ public class TouchInteractionService extends Service implements + mOverviewComponentObserver.getActivityControlHelper().isResumed()); pw.println(" useSharedState=" + mConsumer.useSharedSwipeState()); if (mConsumer.useSharedSwipeState()) { mSwipeSharedState.dump(" ", pw); sSwipeSharedState.dump(" ", pw); } pw.println(" mConsumer=" + mConsumer.getName()); pw.println("FeatureFlags:"); Loading quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ResetGestureInputConsumer.java +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ public class ResetGestureInputConsumer implements InputConsumer { public void onMotionEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN && mSwipeSharedState.getActiveListener() != null) { mSwipeSharedState.clearAllState(); mSwipeSharedState.clearAllState(false /* finishAnimation */); } } } Loading
go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java +2 −0 Original line number Diff line number Diff line Loading @@ -89,4 +89,6 @@ public abstract class RecentsUiFactory { public static RotationMode getRotationMode(DeviceProfile dp) { return RotationMode.NORMAL; } public static void clearSwipeSharedState(boolean finishAnimation) {} }
quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java +8 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import com.android.launcher3.util.UiThreadHelper; import com.android.launcher3.util.UiThreadHelper.AsyncCommand; import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.TouchInteractionService; import com.android.quickstep.views.RecentsView; import com.android.systemui.shared.system.WindowManagerWrapper; Loading Loading @@ -183,6 +184,13 @@ public abstract class RecentsUiFactory { return new RecentsViewStateController(launcher); } /** * Clears the swipe shared state for the current swipe gesture. */ public static void clearSwipeSharedState(boolean finishAnimation) { TouchInteractionService.getSwipeSharedState().clearAllState(finishAnimation); } /** * Recents logic that triggers when launcher state changes or launcher activity stops/resumes. * Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeSharedState.java +7 −5 Original line number Diff line number Diff line Loading @@ -72,13 +72,15 @@ public class SwipeSharedState implements SwipeAnimationListener { mLastAnimationRunning = false; } private void clearListenerState() { private void clearListenerState(boolean finishAnimation) { if (mRecentsAnimationListener != null) { mRecentsAnimationListener.removeListener(this); mRecentsAnimationListener.cancelListener(); if (mLastAnimationRunning && mLastAnimationTarget != null) { Utilities.postAsyncCallback(MAIN_THREAD_EXECUTOR.getHandler(), mLastAnimationTarget::cancelAnimation); finishAnimation ? mLastAnimationTarget::finishAnimation : mLastAnimationTarget::cancelAnimation); mLastAnimationTarget = null; } } Loading Loading @@ -106,7 +108,7 @@ public class SwipeSharedState implements SwipeAnimationListener { } } clearListenerState(); clearListenerState(false /* finishAnimation */); boolean shouldMinimiseSplitScreen = mOverviewComponentObserver == null ? false : mOverviewComponentObserver.getActivityControlHelper().shouldMinimizeSplitScreen(); mRecentsAnimationListener = new RecentsAnimationListenerSet( Loading Loading @@ -138,8 +140,8 @@ public class SwipeSharedState implements SwipeAnimationListener { mLastAnimationTarget = mLastAnimationTarget.cloneWithoutTargets(); } public void clearAllState() { clearListenerState(); public void clearAllState(boolean finishAnimation) { clearListenerState(finishAnimation); canGestureBeContinued = false; recentsAnimationFinishInterrupted = false; nextRunningTaskId = -1; Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +18 −14 Original line number Diff line number Diff line Loading @@ -225,14 +225,18 @@ public class TouchInteractionService extends Service implements }; private static boolean sConnected = false; private static final SwipeSharedState sSwipeSharedState = new SwipeSharedState(); public static boolean isConnected() { return sConnected; } private final SwipeSharedState mSwipeSharedState = new SwipeSharedState(); public static SwipeSharedState getSwipeSharedState() { return sSwipeSharedState; } private final InputConsumer mResetGestureInputConsumer = new ResetGestureInputConsumer(mSwipeSharedState); new ResetGestureInputConsumer(sSwipeSharedState); private ActivityManagerWrapper mAM; private RecentsModel mRecentsModel; Loading Loading @@ -436,7 +440,7 @@ public class TouchInteractionService extends Service implements mInputConsumer = InputConsumerController.getRecentsAnimationInputConsumer(); mIsUserUnlocked = true; mSwipeSharedState.setOverviewComponentObserver(mOverviewComponentObserver); sSwipeSharedState.setOverviewComponentObserver(mOverviewComponentObserver); mInputConsumer.registerInputConsumer(); onSystemUiProxySet(); onSystemUiFlagsChanged(); Loading Loading @@ -589,7 +593,7 @@ public class TouchInteractionService extends Service implements private InputConsumer newBaseConsumer(boolean useSharedState, MotionEvent event) { final RunningTaskInfo runningTaskInfo = mAM.getRunningTask(0); if (!useSharedState) { mSwipeSharedState.clearAllState(); sSwipeSharedState.clearAllState(false /* finishAnimation */); } if ((mSystemUiStateFlags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED) != 0) { // This handles apps showing over the lockscreen (e.g. camera) Loading @@ -599,16 +603,16 @@ public class TouchInteractionService extends Service implements final ActivityControlHelper activityControl = mOverviewComponentObserver.getActivityControlHelper(); if (runningTaskInfo == null && !mSwipeSharedState.goingToLauncher && !mSwipeSharedState.recentsAnimationFinishInterrupted) { if (runningTaskInfo == null && !sSwipeSharedState.goingToLauncher && !sSwipeSharedState.recentsAnimationFinishInterrupted) { return mResetGestureInputConsumer; } else if (mSwipeSharedState.recentsAnimationFinishInterrupted) { } else if (sSwipeSharedState.recentsAnimationFinishInterrupted) { // If the finish animation was interrupted, then continue using the other activity input // consumer but with the next task as the running task RunningTaskInfo info = new ActivityManager.RunningTaskInfo(); info.id = mSwipeSharedState.nextRunningTaskId; info.id = sSwipeSharedState.nextRunningTaskId; return createOtherActivityInputConsumer(event, info); } else if (mSwipeSharedState.goingToLauncher || activityControl.isResumed()) { } else if (sSwipeSharedState.goingToLauncher || activityControl.isResumed()) { return createOverviewInputConsumer(event); } else if (ENABLE_QUICKSTEP_LIVE_TILE.get() && activityControl.isInLiveTileMode()) { return createOverviewInputConsumer(event); Loading @@ -617,7 +621,7 @@ public class TouchInteractionService extends Service implements return mResetGestureInputConsumer; } else if (mMode == Mode.NO_BUTTON && !mOverviewComponentObserver.isHomeAndOverviewSame()) { return new FallbackNoButtonInputConsumer(this, activityControl, mInputMonitorCompat, mSwipeSharedState, mSwipeTouchRegion, mInputMonitorCompat, sSwipeSharedState, mSwipeTouchRegion, mOverviewComponentObserver, disableHorizontalSwipe(event), runningTaskInfo); } else { return createOtherActivityInputConsumer(event, runningTaskInfo); Loading @@ -640,13 +644,13 @@ public class TouchInteractionService extends Service implements return new OtherActivityInputConsumer(this, runningTaskInfo, mRecentsModel, mOverviewComponentObserver.getOverviewIntent(), activityControl, shouldDefer, mOverviewCallbacks, mInputConsumer, this::onConsumerInactive, mSwipeSharedState, mInputMonitorCompat, mSwipeTouchRegion, sSwipeSharedState, mInputMonitorCompat, mSwipeTouchRegion, disableHorizontalSwipe(event)); } private InputConsumer createDeviceLockedInputConsumer(RunningTaskInfo taskInfo) { if (mMode == Mode.NO_BUTTON && taskInfo != null) { return new DeviceLockedInputConsumer(this, mSwipeSharedState, mInputMonitorCompat, return new DeviceLockedInputConsumer(this, sSwipeSharedState, mInputMonitorCompat, mSwipeTouchRegion, taskInfo.taskId); } else { return mResetGestureInputConsumer; Loading @@ -661,7 +665,7 @@ public class TouchInteractionService extends Service implements return mResetGestureInputConsumer; } if (activity.getRootView().hasWindowFocus() || mSwipeSharedState.goingToLauncher) { if (activity.getRootView().hasWindowFocus() || sSwipeSharedState.goingToLauncher) { return new OverviewInputConsumer(activity, mInputMonitorCompat, false /* startingInActivityBounds */); } else { Loading Loading @@ -708,7 +712,7 @@ public class TouchInteractionService extends Service implements + mOverviewComponentObserver.getActivityControlHelper().isResumed()); pw.println(" useSharedState=" + mConsumer.useSharedSwipeState()); if (mConsumer.useSharedSwipeState()) { mSwipeSharedState.dump(" ", pw); sSwipeSharedState.dump(" ", pw); } pw.println(" mConsumer=" + mConsumer.getName()); pw.println("FeatureFlags:"); Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ResetGestureInputConsumer.java +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ public class ResetGestureInputConsumer implements InputConsumer { public void onMotionEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN && mSwipeSharedState.getActiveListener() != null) { mSwipeSharedState.clearAllState(); mSwipeSharedState.clearAllState(false /* finishAnimation */); } } }