summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2010-03-04 12:52:16 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-03-04 12:52:16 -0800
commit2dc785dbde506090d6df6572c6cc88d7958754f0 (patch)
tree1ee1895df49f3136a96156fb06b32c89f40627fa /src
parentce11585bb420b0bd49fa08d6fab5e0f0e210d81c (diff)
parent8e633c5a3e4a387ecf02fb74eae8ff926a1b33cd (diff)
downloadandroid_packages_apps_Trebuchet-2dc785dbde506090d6df6572c6cc88d7958754f0.tar.gz
android_packages_apps_Trebuchet-2dc785dbde506090d6df6572c6cc88d7958754f0.tar.bz2
android_packages_apps_Trebuchet-2dc785dbde506090d6df6572c6cc88d7958754f0.zip
Merge "Prevent crash when a bad widget launches a non-existent config activity."
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/Launcher.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index d09a91272..08ef8439c 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -997,7 +997,7 @@ public final class Launcher extends Activity
intent.setComponent(appWidget.configure);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
- startActivityForResult(intent, REQUEST_CREATE_APPWIDGET);
+ startActivityForResultSafely(intent, REQUEST_CREATE_APPWIDGET);
} else {
// Otherwise just add it
onActivityResult(REQUEST_CREATE_APPWIDGET, Activity.RESULT_OK, data);
@@ -1284,6 +1284,19 @@ public final class Launcher extends Activity
"or use the exported attribute for this activity.", e);
}
}
+
+ void startActivityForResultSafely(Intent intent, int requestCode) {
+ try {
+ startActivityForResult(intent, requestCode);
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
+ } catch (SecurityException e) {
+ Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
+ Log.e(TAG, "Launcher does not have the permission to launch " + intent +
+ ". Make sure to create a MAIN intent-filter for the corresponding activity " +
+ "or use the exported attribute for this activity.", e);
+ }
+ }
private void handleFolderClick(FolderInfo folderInfo) {
if (!folderInfo.opened) {