Don't crash when trying to launch missing application
Fixes http://b/issue?id=2155988
"Clicking a shortcut for an uninstalled application in Quick Search Box crashes acore, requires reboot"
Change-Id: Ia32c2e90a4baaa0b6794d397db16aa136988790e
diff --git a/src/com/android/providers/applications/ApplicationLauncher.java b/src/com/android/providers/applications/ApplicationLauncher.java
index 8463fb6..830597f 100644
--- a/src/com/android/providers/applications/ApplicationLauncher.java
+++ b/src/com/android/providers/applications/ApplicationLauncher.java
@@ -17,6 +17,7 @@
package com.android.providers.applications;
import android.app.Activity;
+import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
@@ -45,7 +46,11 @@
launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
launchIntent.setComponent(componentName);
- startActivity(launchIntent);
+ try {
+ startActivity(launchIntent);
+ } catch (ActivityNotFoundException ex) {
+ Log.w(TAG, "Activity not found: " + componentName);
+ }
handled = true;
}
}