summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/recents
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2014-09-17 15:16:09 +0200
committerWinson Chung <winsonc@google.com>2014-09-17 15:20:10 +0200
commit4e96eb709d2f1b6b1cd233c8a99f6706fde70bb1 (patch)
treeebe0f25d9bf6c4d02df6827286c2bd612210a771 /packages/SystemUI/src/com/android/systemui/recents
parentd4aaab99bb13c7f34df480bb170f2afc71849f3f (diff)
downloadframeworks_base-4e96eb709d2f1b6b1cd233c8a99f6706fde70bb1.zip
frameworks_base-4e96eb709d2f1b6b1cd233c8a99f6706fde70bb1.tar.gz
frameworks_base-4e96eb709d2f1b6b1cd233c8a99f6706fde70bb1.tar.bz2
Handling broader set of exceptions when startingActivity from Recents. (Bug 17481968)
Change-Id: Ia11e0f77e6c1f28f3d6946362d5a6333b57ac80e
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/recents')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java14
4 files changed, 27 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
index 787de4e..702f59a 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
@@ -222,9 +222,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
// Bring an active task to the foreground
mSystemServicesProxy.moveTaskToFront(toTask.key.id, launchOpts);
} else {
- try {
- mSystemServicesProxy.startActivityFromRecents(toTask.key.id, launchOpts);
- } catch (ActivityNotFoundException anfe) {}
+ mSystemServicesProxy.startActivityFromRecents(mContext, toTask.key.id,
+ toTask.activityLabel, launchOpts);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index 8f92027..933d3ca 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -614,6 +614,12 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
}
@Override
+ public void onTaskLaunchFailed() {
+ // Return to Home
+ dismissRecentsToHomeRaw(true);
+ }
+
+ @Override
public void onAllTaskViewsDismissed() {
mFinishLaunchHomeRunnable.run();
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
index bbd0a0d..55413c6 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
@@ -57,6 +57,7 @@ import android.view.DisplayInfo;
import android.view.SurfaceControl;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityManager;
+import com.android.systemui.R;
import com.android.systemui.recents.Constants;
import java.io.IOException;
@@ -509,12 +510,18 @@ public class SystemServicesProxy {
return takeScreenshot();
}
- public void startActivityFromRecents(int taskId, ActivityOptions options) {
+ /** Starts an activity from recents. */
+ public boolean startActivityFromRecents(Context context, int taskId, String taskName,
+ ActivityOptions options) {
if (mIam != null) {
try {
mIam.startActivityFromRecents(taskId, options == null ? null : options.toBundle());
- } catch (RemoteException e) {
+ return true;
+ } catch (Exception e) {
+ Console.logError(context,
+ context.getString(R.string.recents_launch_error_message, taskName));
}
}
+ return false;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
index 1bfb41f..bb4010e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
@@ -56,6 +56,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
/** The RecentsView callbacks */
public interface RecentsViewCallbacks {
public void onTaskViewClicked();
+ public void onTaskLaunchFailed();
public void onAllTaskViewsDismissed();
public void onExitToHomeAnimationTriggered();
}
@@ -470,13 +471,18 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
// Bring an active task to the foreground
ssp.moveTaskToFront(task.key.id, launchOpts);
} else {
- try {
- ssp.startActivityFromRecents(task.key.id, launchOpts);
+ if (ssp.startActivityFromRecents(getContext(), task.key.id,
+ task.activityLabel, launchOpts)) {
if (launchOpts == null && lockToTask) {
ssp.lockCurrentTask();
}
- } catch (ActivityNotFoundException anfe) {
- Console.logError(getContext(), "Could not start Activity");
+ } else {
+ // Dismiss the task and return the user to home if we fail to
+ // launch the task
+ onTaskViewDismissed(task);
+ if (mCb != null) {
+ mCb.onTaskLaunchFailed();
+ }
}
}
}