am 7e3efa82: am 1f168fd4: am 4ef0aabe: Merge "Catch ActivityNotFoundException in quick contacts badge" into klp-dev
* commit '7e3efa82ecbb9e3cf50f8f455e573aed3b88d183':
Catch ActivityNotFoundException in quick contacts badge
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index b16df28..0863368 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -18,6 +18,7 @@
import android.accounts.Account;
import android.app.Activity;
+import android.content.ActivityNotFoundException;
import android.content.ContentProviderClient;
import android.content.ContentProviderOperation;
import android.content.ContentResolver;
@@ -40,6 +41,7 @@
import android.util.DisplayMetrics;
import android.util.Pair;
import android.view.View;
+import android.widget.Toast;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -7981,7 +7983,7 @@
// Trigger with obtained rectangle
Intent intent = composeQuickContactsIntent(context, target, lookupUri, mode,
excludeMimes);
- context.startActivity(intent);
+ startActivityWithErrorToast(context, intent);
}
/**
@@ -8014,7 +8016,16 @@
String[] excludeMimes) {
Intent intent = composeQuickContactsIntent(context, target, lookupUri, mode,
excludeMimes);
- context.startActivity(intent);
+ startActivityWithErrorToast(context, intent);
+ }
+
+ private static void startActivityWithErrorToast(Context context, Intent intent) {
+ try {
+ context.startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(context, com.android.internal.R.string.quick_contacts_not_available,
+ Toast.LENGTH_SHORT).show();
+ }
}
}
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 986a005..397d3e3 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -932,13 +932,13 @@
<!-- [CHAR LIMIT=NONE] Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_getAppOpsStats">Allows the app to retrieve
collected application operation statistics. Not for use by normal apps.</string>
-
+
<!-- [CHAR LIMIT=NONE] Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_updateAppOpsStats">modify app ops statistics</string>
<!-- [CHAR LIMIT=NONE] Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_updateAppOpsStats">Allows the app to modify
collected application operation statistics. Not for use by normal apps.</string>
-
+
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_backup">control system backup and restore</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
@@ -2247,6 +2247,10 @@
<!-- Other SIP address type. Same context as Other phone type. -->
<string name="sipAddressTypeOther">Other</string>
+ <!-- Error message that is displayed when the user clicks on a quick contacts badge, but
+ there is no contacts application installed that can display the quick contact -->
+ <string name="quick_contacts_not_available">No activity found to view contact.</string>
+
<!-- Instructions telling the user to enter their SIM PIN to unlock the keyguard.
Displayed in one line in a large font. -->
<string name="keyguard_password_enter_pin_code">Type PIN code</string>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index c38e753..ab3546c 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -690,6 +690,7 @@
<java-symbol type="string" name="mobile_provisioning_apn" />
<java-symbol type="string" name="mobile_provisioning_url" />
<java-symbol type="string" name="mobile_redirected_provisioning_url" />
+ <java-symbol type="string" name="quick_contacts_not_available" />
<java-symbol type="string" name="reboot_safemode_confirm" />
<java-symbol type="string" name="reboot_safemode_title" />
<java-symbol type="string" name="relationTypeAssistant" />