Loading quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java +29 −5 Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten protected MultiStateCallback mStateCallback; protected boolean mCanceled; protected int mFinishingRecentsAnimationForNewTaskId = -1; protected int mLastStartedTaskId = -1; private RecentsOrientedState mOrientedState; Loading Loading @@ -199,7 +199,7 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten mRecentsAnimationTargets)); } protected void startNewTask(int successStateFlag, Consumer<Boolean> resultCallback) { protected void startNewTask(Consumer<Boolean> resultCallback) { // Launch the task user scrolled to (mRecentsView.getNextPage()). if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { // We finish recents animation inside launchTask() when live tile is enabled. Loading @@ -210,18 +210,17 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten if (!mCanceled) { TaskView nextTask = mRecentsView.getTaskView(taskId); if (nextTask != null) { mLastStartedTaskId = taskId; nextTask.launchTask(false /* animate */, true /* freezeTaskList */, success -> { resultCallback.accept(success); if (!success) { mActivityInterface.onLaunchTaskFailed(); nextTask.notifyTaskLaunchFailed(TAG); } else { mActivityInterface.onLaunchTaskSuccess(); mRecentsAnimationController.finish(true /* toRecents */, null); } }, MAIN_EXECUTOR.getHandler()); } mStateCallback.setStateOnUiThread(successStateFlag); } mCanceled = false; } Loading @@ -241,6 +240,7 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten } /** * TODO can we remove this now that we don't finish the controller until onTaskAppeared()? * @return whether the recents animation has started and there are valid app targets. */ protected boolean hasTargets() { Loading Loading @@ -306,6 +306,30 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten } } @Override public void onTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget) { if (mRecentsAnimationController != null) { if (handleTaskAppeared(appearedTaskTarget)) { mRecentsAnimationController.finish(false /* toRecents */, null /* onFinishComplete */); mActivityInterface.onLaunchTaskSuccess(); } } } /** @return Whether this was the task we were waiting to appear, and thus handled it. */ protected abstract boolean handleTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget); /** * @return The index of the TaskView in RecentsView whose taskId matches the task that will * resume if we finish the controller. */ protected int getLastAppearedTaskIndex() { return mGestureState.getLastAppearedTaskId() != -1 ? mRecentsView.getTaskIndexForId(mGestureState.getLastAppearedTaskId()) : mRecentsView.getRunningTaskIndex(); } private Rect getStackBounds(DeviceProfile dp) { if (mActivity != null) { int loc[] = new int[2]; Loading quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java +8 −12 Original line number Diff line number Diff line Loading @@ -46,11 +46,11 @@ import com.android.quickstep.BaseActivityInterface.HomeAnimationFactory; import com.android.quickstep.GestureState.GestureEndTarget; import com.android.quickstep.fallback.FallbackRecentsView; import com.android.quickstep.util.RectFSpringAnim; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.ActivityOptionsCompat; import com.android.systemui.shared.system.InputConsumerController; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; /** * Handles the navigation gestures when a 3rd party launcher is the default home activity. Loading Loading @@ -320,15 +320,6 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa } if (mRecentsView != null) { if (mFinishingRecentsAnimationForNewTaskId != -1) { TaskView newRunningTaskView = mRecentsView.getTaskView( mFinishingRecentsAnimationForNewTaskId); int newRunningTaskId = newRunningTaskView != null ? newRunningTaskView.getTask().key.id : -1; mRecentsView.setCurrentTask(newRunningTaskId); mGestureState.setFinishingRecentsAnimationTaskId(newRunningTaskId); } mRecentsView.setOnScrollChangeListener(null); } } else { Loading Loading @@ -401,7 +392,7 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa break; } case NEW_TASK: { startNewTask(STATE_HANDLER_INVALIDATED, b -> {}); startNewTask(success -> { }); break; } } Loading @@ -416,7 +407,7 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa if (mRecentsView == null || !hasTargets()) { mGestureState.setEndTarget(LAST_TASK); } else { final int runningTaskIndex = mRecentsView.getRunningTaskIndex(); final int runningTaskIndex = getLastAppearedTaskIndex(); final int taskToLaunch = mRecentsView.getNextPage(); mGestureState.setEndTarget( (runningTaskIndex >= 0 && taskToLaunch != runningTaskIndex) Loading Loading @@ -494,6 +485,11 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa super.onRecentsAnimationCanceled(thumbnailData); } @Override protected boolean handleTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget) { return true; } /** * Creates an animation that transforms the current app window into the home app. * @param startProgress The progress of {@link #mCurrentShift} to start the window from. Loading quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java +27 −36 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import static com.android.quickstep.GestureState.GestureEndTarget.NEW_TASK; import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS; import static com.android.quickstep.GestureState.STATE_END_TARGET_ANIMATION_FINISHED; import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHED; import static com.android.quickstep.GestureState.STATE_TASK_APPEARED_DURING_SWITCH; import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS; import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.HIDE; Loading Loading @@ -264,8 +263,6 @@ public class LauncherSwipeHandler<T extends BaseDraggingActivity> | STATE_RECENTS_SCROLLING_FINISHED, this::onSettledOnEndTarget); mGestureState.runOnceAtState(STATE_TASK_APPEARED_DURING_SWITCH, this::onTaskAppeared); mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED, this::invalidateHandler); mStateCallback.runOnceAtState(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED, this::invalidateHandlerWithLauncher); Loading Loading @@ -769,20 +766,16 @@ public class LauncherSwipeHandler<T extends BaseDraggingActivity> } } private void onTaskAppeared() { RemoteAnimationTargetCompat app = mGestureState.getAnimationTarget(); if (mRecentsAnimationController != null && app != null) { // TODO(b/152480470): Update Task target animation after onTaskAppeared holistically. /* android.util.Log.d("LauncherSwipeHandler", "onTaskAppeared"); final boolean result = mRecentsAnimationController.removeTaskTarget(app); mGestureState.setAnimationTarget(null); android.util.Log.d("LauncherSwipeHandler", "removeTask, result=" + result); */ mRecentsAnimationController.finish(false /* toRecents */, null /* onFinishComplete */); @Override protected boolean handleTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget) { if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) { return false; } if (appearedTaskTarget.taskId == mLastStartedTaskId) { reset(); return true; } return false; } private GestureEndTarget calculateEndTarget(PointF velocity, float endVelocity, boolean isFling, Loading Loading @@ -1029,12 +1022,22 @@ public class LauncherSwipeHandler<T extends BaseDraggingActivity> // skip doing any future work here for the current gesture. return; } if (target == NEW_TASK && mRecentsView != null && mRecentsView.getNextPage() == mRecentsView.getRunningTaskIndex()) { // We are about to launch the current running task, so use LAST_TASK state // instead of NEW_TASK. This could happen, for example, if our scroll is // aborted after we determined the target to be NEW_TASK. if (mRecentsView != null) { int taskToLaunch = mRecentsView.getNextPage(); int runningTask = getLastAppearedTaskIndex(); if (target == NEW_TASK && taskToLaunch == runningTask) { // We are about to launch the current running task, so use LAST_TASK // state instead of NEW_TASK. This could happen, for example, if our // scroll is aborted after we determined the target to be NEW_TASK. mGestureState.setEndTarget(LAST_TASK); } else if (target == LAST_TASK && taskToLaunch != runningTask) { // We are about to re-launch the previously running task, but we can't // just finish the controller like we normally would because that would // instead resume the last task that appeared. As a workaround, launch // the task as if it were a new task. // TODO: is this expected? mGestureState.setEndTarget(NEW_TASK); } } mGestureState.setState(STATE_END_TARGET_ANIMATION_FINISHED); } Loading Loading @@ -1158,8 +1161,9 @@ public class LauncherSwipeHandler<T extends BaseDraggingActivity> @UiThread private void startNewTaskInternal() { startNewTask(STATE_HANDLER_INVALIDATED, success -> { startNewTask(success -> { if (!success) { reset(); // We couldn't launch the task, so take user to overview so they can // decide what to do instead of staying in this broken state. endLauncherTransitionController(); Loading @@ -1184,19 +1188,6 @@ public class LauncherSwipeHandler<T extends BaseDraggingActivity> .getAnimationPlayer().isStarted()) { mLauncherTransitionController.getAnimationPlayer().cancel(); } if (mFinishingRecentsAnimationForNewTaskId != -1) { // If we are canceling mid-starting a new task, switch to the screenshot since the // recents animation has finished switchToScreenshot(); TaskView newRunningTaskView = mRecentsView.getTaskView( mFinishingRecentsAnimationForNewTaskId); int newRunningTaskId = newRunningTaskView != null ? newRunningTaskView.getTask().key.id : -1; mRecentsView.setCurrentTask(newRunningTaskId); mGestureState.setFinishingRecentsAnimationTaskId(newRunningTaskId); } } private void invalidateHandler() { Loading quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +12 −20 Original line number Diff line number Diff line Loading @@ -30,8 +30,6 @@ import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYS import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_TRACING_ENABLED; import android.annotation.TargetApi; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; import android.app.PendingIntent; import android.app.RemoteAction; import android.app.Service; Loading Loading @@ -518,8 +516,12 @@ public class TouchInteractionService extends Service implements PluginListener<O private GestureState createGestureState() { GestureState gestureState = new GestureState(mOverviewComponentObserver, ActiveGestureLog.INSTANCE.generateAndSetLogId()); if (mTaskAnimationManager.isRecentsAnimationRunning()) { gestureState.updateRunningTask(mGestureState.getRunningTask()); } else { gestureState.updateRunningTask(TraceHelper.whitelistIpcs("getRunningTask.0", () -> mAM.getRunningTask(false /* filterOnlyVisibleRecents */))); } return gestureState; } Loading Loading @@ -637,14 +639,7 @@ public class TouchInteractionService extends Service implements PluginListener<O runningComponent != null && runningComponent.equals(homeComponent); } if (previousGestureState.getFinishingRecentsAnimationTaskId() > 0) { // 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 = previousGestureState.getFinishingRecentsAnimationTaskId(); gestureState.updateRunningTask(info); return createOtherActivityInputConsumer(previousGestureState, gestureState, event); } else if (gestureState.getRunningTask() == null) { if (gestureState.getRunningTask() == null) { return mResetGestureInputConsumer; } else if (previousGestureState.isRunningAnimationToLauncher() || gestureState.getActivityInterface().isResumed() Loading @@ -658,25 +653,22 @@ public class TouchInteractionService extends Service implements PluginListener<O } else if (mDeviceState.isGestureBlockedActivity(gestureState.getRunningTask())) { return mResetGestureInputConsumer; } else { return createOtherActivityInputConsumer(previousGestureState, gestureState, event); return createOtherActivityInputConsumer(gestureState, event); } } private InputConsumer createOtherActivityInputConsumer(GestureState previousGestureState, GestureState gestureState, MotionEvent event) { private InputConsumer createOtherActivityInputConsumer(GestureState gestureState, MotionEvent event) { final boolean shouldDefer; final BaseSwipeUpHandler.Factory factory; if (!mOverviewComponentObserver.isHomeAndOverviewSame()) { shouldDefer = previousGestureState.getFinishingRecentsAnimationTaskId() < 0; factory = mFallbackSwipeHandlerFactory; } else { shouldDefer = gestureState.getActivityInterface().deferStartingActivity(mDeviceState, event); factory = mLauncherSwipeHandlerFactory; } final boolean shouldDefer = !mOverviewComponentObserver.isHomeAndOverviewSame() || gestureState.getActivityInterface().deferStartingActivity(mDeviceState, event); final boolean disableHorizontalSwipe = mDeviceState.isInExclusionRegion(event); return new OtherActivityInputConsumer(this, mDeviceState, mTaskAnimationManager, gestureState, shouldDefer, this::onConsumerInactive, Loading quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +9 −1 Original line number Diff line number Diff line Loading @@ -977,7 +977,15 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl } public int getRunningTaskIndex() { TaskView tv = getRunningTaskView(); return getTaskIndexForId(mRunningTaskId); } /** * Get the index of the task view whose id matches {@param taskId}. * @return -1 if there is no task view for the task id, else the index of the task view. */ public int getTaskIndexForId(int taskId) { TaskView tv = getTaskView(taskId); return tv == null ? -1 : indexOfChild(tv); } Loading Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java +29 −5 Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten protected MultiStateCallback mStateCallback; protected boolean mCanceled; protected int mFinishingRecentsAnimationForNewTaskId = -1; protected int mLastStartedTaskId = -1; private RecentsOrientedState mOrientedState; Loading Loading @@ -199,7 +199,7 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten mRecentsAnimationTargets)); } protected void startNewTask(int successStateFlag, Consumer<Boolean> resultCallback) { protected void startNewTask(Consumer<Boolean> resultCallback) { // Launch the task user scrolled to (mRecentsView.getNextPage()). if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { // We finish recents animation inside launchTask() when live tile is enabled. Loading @@ -210,18 +210,17 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten if (!mCanceled) { TaskView nextTask = mRecentsView.getTaskView(taskId); if (nextTask != null) { mLastStartedTaskId = taskId; nextTask.launchTask(false /* animate */, true /* freezeTaskList */, success -> { resultCallback.accept(success); if (!success) { mActivityInterface.onLaunchTaskFailed(); nextTask.notifyTaskLaunchFailed(TAG); } else { mActivityInterface.onLaunchTaskSuccess(); mRecentsAnimationController.finish(true /* toRecents */, null); } }, MAIN_EXECUTOR.getHandler()); } mStateCallback.setStateOnUiThread(successStateFlag); } mCanceled = false; } Loading @@ -241,6 +240,7 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten } /** * TODO can we remove this now that we don't finish the controller until onTaskAppeared()? * @return whether the recents animation has started and there are valid app targets. */ protected boolean hasTargets() { Loading Loading @@ -306,6 +306,30 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten } } @Override public void onTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget) { if (mRecentsAnimationController != null) { if (handleTaskAppeared(appearedTaskTarget)) { mRecentsAnimationController.finish(false /* toRecents */, null /* onFinishComplete */); mActivityInterface.onLaunchTaskSuccess(); } } } /** @return Whether this was the task we were waiting to appear, and thus handled it. */ protected abstract boolean handleTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget); /** * @return The index of the TaskView in RecentsView whose taskId matches the task that will * resume if we finish the controller. */ protected int getLastAppearedTaskIndex() { return mGestureState.getLastAppearedTaskId() != -1 ? mRecentsView.getTaskIndexForId(mGestureState.getLastAppearedTaskId()) : mRecentsView.getRunningTaskIndex(); } private Rect getStackBounds(DeviceProfile dp) { if (mActivity != null) { int loc[] = new int[2]; Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java +8 −12 Original line number Diff line number Diff line Loading @@ -46,11 +46,11 @@ import com.android.quickstep.BaseActivityInterface.HomeAnimationFactory; import com.android.quickstep.GestureState.GestureEndTarget; import com.android.quickstep.fallback.FallbackRecentsView; import com.android.quickstep.util.RectFSpringAnim; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.ActivityOptionsCompat; import com.android.systemui.shared.system.InputConsumerController; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; /** * Handles the navigation gestures when a 3rd party launcher is the default home activity. Loading Loading @@ -320,15 +320,6 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa } if (mRecentsView != null) { if (mFinishingRecentsAnimationForNewTaskId != -1) { TaskView newRunningTaskView = mRecentsView.getTaskView( mFinishingRecentsAnimationForNewTaskId); int newRunningTaskId = newRunningTaskView != null ? newRunningTaskView.getTask().key.id : -1; mRecentsView.setCurrentTask(newRunningTaskId); mGestureState.setFinishingRecentsAnimationTaskId(newRunningTaskId); } mRecentsView.setOnScrollChangeListener(null); } } else { Loading Loading @@ -401,7 +392,7 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa break; } case NEW_TASK: { startNewTask(STATE_HANDLER_INVALIDATED, b -> {}); startNewTask(success -> { }); break; } } Loading @@ -416,7 +407,7 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa if (mRecentsView == null || !hasTargets()) { mGestureState.setEndTarget(LAST_TASK); } else { final int runningTaskIndex = mRecentsView.getRunningTaskIndex(); final int runningTaskIndex = getLastAppearedTaskIndex(); final int taskToLaunch = mRecentsView.getNextPage(); mGestureState.setEndTarget( (runningTaskIndex >= 0 && taskToLaunch != runningTaskIndex) Loading Loading @@ -494,6 +485,11 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa super.onRecentsAnimationCanceled(thumbnailData); } @Override protected boolean handleTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget) { return true; } /** * Creates an animation that transforms the current app window into the home app. * @param startProgress The progress of {@link #mCurrentShift} to start the window from. Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java +27 −36 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import static com.android.quickstep.GestureState.GestureEndTarget.NEW_TASK; import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS; import static com.android.quickstep.GestureState.STATE_END_TARGET_ANIMATION_FINISHED; import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHED; import static com.android.quickstep.GestureState.STATE_TASK_APPEARED_DURING_SWITCH; import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS; import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.HIDE; Loading Loading @@ -264,8 +263,6 @@ public class LauncherSwipeHandler<T extends BaseDraggingActivity> | STATE_RECENTS_SCROLLING_FINISHED, this::onSettledOnEndTarget); mGestureState.runOnceAtState(STATE_TASK_APPEARED_DURING_SWITCH, this::onTaskAppeared); mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED, this::invalidateHandler); mStateCallback.runOnceAtState(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED, this::invalidateHandlerWithLauncher); Loading Loading @@ -769,20 +766,16 @@ public class LauncherSwipeHandler<T extends BaseDraggingActivity> } } private void onTaskAppeared() { RemoteAnimationTargetCompat app = mGestureState.getAnimationTarget(); if (mRecentsAnimationController != null && app != null) { // TODO(b/152480470): Update Task target animation after onTaskAppeared holistically. /* android.util.Log.d("LauncherSwipeHandler", "onTaskAppeared"); final boolean result = mRecentsAnimationController.removeTaskTarget(app); mGestureState.setAnimationTarget(null); android.util.Log.d("LauncherSwipeHandler", "removeTask, result=" + result); */ mRecentsAnimationController.finish(false /* toRecents */, null /* onFinishComplete */); @Override protected boolean handleTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget) { if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) { return false; } if (appearedTaskTarget.taskId == mLastStartedTaskId) { reset(); return true; } return false; } private GestureEndTarget calculateEndTarget(PointF velocity, float endVelocity, boolean isFling, Loading Loading @@ -1029,12 +1022,22 @@ public class LauncherSwipeHandler<T extends BaseDraggingActivity> // skip doing any future work here for the current gesture. return; } if (target == NEW_TASK && mRecentsView != null && mRecentsView.getNextPage() == mRecentsView.getRunningTaskIndex()) { // We are about to launch the current running task, so use LAST_TASK state // instead of NEW_TASK. This could happen, for example, if our scroll is // aborted after we determined the target to be NEW_TASK. if (mRecentsView != null) { int taskToLaunch = mRecentsView.getNextPage(); int runningTask = getLastAppearedTaskIndex(); if (target == NEW_TASK && taskToLaunch == runningTask) { // We are about to launch the current running task, so use LAST_TASK // state instead of NEW_TASK. This could happen, for example, if our // scroll is aborted after we determined the target to be NEW_TASK. mGestureState.setEndTarget(LAST_TASK); } else if (target == LAST_TASK && taskToLaunch != runningTask) { // We are about to re-launch the previously running task, but we can't // just finish the controller like we normally would because that would // instead resume the last task that appeared. As a workaround, launch // the task as if it were a new task. // TODO: is this expected? mGestureState.setEndTarget(NEW_TASK); } } mGestureState.setState(STATE_END_TARGET_ANIMATION_FINISHED); } Loading Loading @@ -1158,8 +1161,9 @@ public class LauncherSwipeHandler<T extends BaseDraggingActivity> @UiThread private void startNewTaskInternal() { startNewTask(STATE_HANDLER_INVALIDATED, success -> { startNewTask(success -> { if (!success) { reset(); // We couldn't launch the task, so take user to overview so they can // decide what to do instead of staying in this broken state. endLauncherTransitionController(); Loading @@ -1184,19 +1188,6 @@ public class LauncherSwipeHandler<T extends BaseDraggingActivity> .getAnimationPlayer().isStarted()) { mLauncherTransitionController.getAnimationPlayer().cancel(); } if (mFinishingRecentsAnimationForNewTaskId != -1) { // If we are canceling mid-starting a new task, switch to the screenshot since the // recents animation has finished switchToScreenshot(); TaskView newRunningTaskView = mRecentsView.getTaskView( mFinishingRecentsAnimationForNewTaskId); int newRunningTaskId = newRunningTaskView != null ? newRunningTaskView.getTask().key.id : -1; mRecentsView.setCurrentTask(newRunningTaskId); mGestureState.setFinishingRecentsAnimationTaskId(newRunningTaskId); } } private void invalidateHandler() { Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +12 −20 Original line number Diff line number Diff line Loading @@ -30,8 +30,6 @@ import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYS import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_TRACING_ENABLED; import android.annotation.TargetApi; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; import android.app.PendingIntent; import android.app.RemoteAction; import android.app.Service; Loading Loading @@ -518,8 +516,12 @@ public class TouchInteractionService extends Service implements PluginListener<O private GestureState createGestureState() { GestureState gestureState = new GestureState(mOverviewComponentObserver, ActiveGestureLog.INSTANCE.generateAndSetLogId()); if (mTaskAnimationManager.isRecentsAnimationRunning()) { gestureState.updateRunningTask(mGestureState.getRunningTask()); } else { gestureState.updateRunningTask(TraceHelper.whitelistIpcs("getRunningTask.0", () -> mAM.getRunningTask(false /* filterOnlyVisibleRecents */))); } return gestureState; } Loading Loading @@ -637,14 +639,7 @@ public class TouchInteractionService extends Service implements PluginListener<O runningComponent != null && runningComponent.equals(homeComponent); } if (previousGestureState.getFinishingRecentsAnimationTaskId() > 0) { // 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 = previousGestureState.getFinishingRecentsAnimationTaskId(); gestureState.updateRunningTask(info); return createOtherActivityInputConsumer(previousGestureState, gestureState, event); } else if (gestureState.getRunningTask() == null) { if (gestureState.getRunningTask() == null) { return mResetGestureInputConsumer; } else if (previousGestureState.isRunningAnimationToLauncher() || gestureState.getActivityInterface().isResumed() Loading @@ -658,25 +653,22 @@ public class TouchInteractionService extends Service implements PluginListener<O } else if (mDeviceState.isGestureBlockedActivity(gestureState.getRunningTask())) { return mResetGestureInputConsumer; } else { return createOtherActivityInputConsumer(previousGestureState, gestureState, event); return createOtherActivityInputConsumer(gestureState, event); } } private InputConsumer createOtherActivityInputConsumer(GestureState previousGestureState, GestureState gestureState, MotionEvent event) { private InputConsumer createOtherActivityInputConsumer(GestureState gestureState, MotionEvent event) { final boolean shouldDefer; final BaseSwipeUpHandler.Factory factory; if (!mOverviewComponentObserver.isHomeAndOverviewSame()) { shouldDefer = previousGestureState.getFinishingRecentsAnimationTaskId() < 0; factory = mFallbackSwipeHandlerFactory; } else { shouldDefer = gestureState.getActivityInterface().deferStartingActivity(mDeviceState, event); factory = mLauncherSwipeHandlerFactory; } final boolean shouldDefer = !mOverviewComponentObserver.isHomeAndOverviewSame() || gestureState.getActivityInterface().deferStartingActivity(mDeviceState, event); final boolean disableHorizontalSwipe = mDeviceState.isInExclusionRegion(event); return new OtherActivityInputConsumer(this, mDeviceState, mTaskAnimationManager, gestureState, shouldDefer, this::onConsumerInactive, Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +9 −1 Original line number Diff line number Diff line Loading @@ -977,7 +977,15 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl } public int getRunningTaskIndex() { TaskView tv = getRunningTaskView(); return getTaskIndexForId(mRunningTaskId); } /** * Get the index of the task view whose id matches {@param taskId}. * @return -1 if there is no task view for the task id, else the index of the task view. */ public int getTaskIndexForId(int taskId) { TaskView tv = getTaskView(taskId); return tv == null ? -1 : indexOfChild(tv); } Loading