Merge "Catch ActivityNotFoundException in quick contacts badge" into klp-dev

This commit is contained in:
Jay Shrauner
2014-03-03 21:56:17 +00:00
committed by Android (Google) Code Review
3 changed files with 20 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ package android.provider;
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.text.TextUtils;
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 @@ public final class ContactsContract {
// Trigger with obtained rectangle
Intent intent = composeQuickContactsIntent(context, target, lookupUri, mode,
excludeMimes);
context.startActivity(intent);
startActivityWithErrorToast(context, intent);
}
/**
@@ -8014,7 +8016,16 @@ public final class ContactsContract {
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();
}
}
}

View File

@@ -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>

View File

@@ -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" />