summaryrefslogtreecommitdiffstats
path: root/quickstep/recents_ui_overrides
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2019-06-12 22:59:35 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-06-12 22:59:35 +0000
commit964d16470958fd7ace6de4cf1b0987b4734754ee (patch)
tree12e63dbd8d5f6010f8ae25260252e17d171aac14 /quickstep/recents_ui_overrides
parentf97355a145c2ff7b924bbecb582175348436c3eb (diff)
parente8836dc0823a4b7115f2bc7b5f93c4d6b8cc9f7a (diff)
downloadandroid_packages_apps_Trebuchet-964d16470958fd7ace6de4cf1b0987b4734754ee.tar.gz
android_packages_apps_Trebuchet-964d16470958fd7ace6de4cf1b0987b4734754ee.tar.bz2
android_packages_apps_Trebuchet-964d16470958fd7ace6de4cf1b0987b4734754ee.zip
Merge "Gracefully handle failed task launches during quick switch" into ub-launcher3-qt-dev
Diffstat (limited to 'quickstep/recents_ui_overrides')
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java12
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java6
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java5
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java15
4 files changed, 36 insertions, 2 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
index ed511f5f2..cdc271fdd 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
@@ -15,6 +15,9 @@
*/
package com.android.launcher3.uioverrides.states;
+import android.os.Handler;
+import android.os.Looper;
+
import com.android.launcher3.Launcher;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.views.RecentsView;
@@ -27,6 +30,8 @@ import com.android.quickstep.views.TaskView;
*/
public class QuickSwitchState extends BackgroundAppState {
+ private static final String TAG = "QuickSwitchState";
+
public QuickSwitchState(int id) {
super(id, LauncherLogProto.ContainerType.APP);
}
@@ -48,7 +53,12 @@ public class QuickSwitchState extends BackgroundAppState {
public void onStateTransitionEnd(Launcher launcher) {
TaskView tasktolaunch = launcher.<RecentsView>getOverviewPanel().getTaskViewAt(0);
if (tasktolaunch != null) {
- tasktolaunch.launchTask(false);
+ tasktolaunch.launchTask(false, success -> {
+ if (!success) {
+ launcher.getStateManager().goToState(OVERVIEW);
+ tasktolaunch.notifyTaskLaunchFailed(TAG);
+ }
+ }, new Handler(Looper.getMainLooper()));
} else {
launcher.getStateManager().goToState(NORMAL);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
index 2c42fd63a..4ae6d87b8 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
@@ -224,4 +224,10 @@ public final class FallbackActivityControllerHelper implements
public boolean isInLiveTileMode() {
return false;
}
+
+ @Override
+ public void onLaunchTaskFailed(RecentsActivity activity) {
+ // TODO: probably go back to overview instead.
+ activity.<RecentsView>getOverviewPanel().startHome();
+ }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
index e52a42038..0d06c19ab 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
@@ -506,4 +506,9 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
return launcher != null && launcher.getStateManager().getState() == OVERVIEW &&
launcher.isStarted();
}
+
+ @Override
+ public void onLaunchTaskFailed(Launcher launcher) {
+ launcher.getStateManager().goToState(OVERVIEW);
+ }
} \ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
index edeae8116..e9aa6d078 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -746,6 +746,9 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
? 0 : (progress - mShiftAtGestureStart) / (1 - mShiftAtGestureStart));
}
+ /**
+ * @param windowProgress 0 == app, 1 == overview
+ */
private void updateSysUiFlags(float windowProgress) {
if (mRecentsView != null) {
TaskView centermostTask = mRecentsView.getTaskViewAt(mRecentsView
@@ -1247,7 +1250,17 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
if (!mCanceled) {
TaskView nextTask = mRecentsView.getTaskView(taskId);
if (nextTask != null) {
- nextTask.launchTask(false /* animate */, true /* freezeTaskList */);
+ nextTask.launchTask(false /* animate */, true /* freezeTaskList */,
+ success -> {
+ if (!success) {
+ // 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();
+ mActivityControlHelper.onLaunchTaskFailed(mActivity);
+ nextTask.notifyTaskLaunchFailed(TAG);
+ updateSysUiFlags(1 /* windowProgress == overview */);
+ }
+ }, mMainThreadHandler);
doLogGesture(NEW_TASK);
}
reset();