summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2018-02-21 22:49:44 +0100
committerMichael W <baddaemon87@gmail.com>2018-02-21 22:40:06 +0000
commitfc0c28f5b09387fe04f075717a18163ad9b6ec62 (patch)
treecda47d311db406d68be214f2a57fe0c3e6ace611
parentdfdc8bb0980829e55c317b14a109a07720154dbd (diff)
downloadpackages_apps_Contacts-fc0c28f5b09387fe04f075717a18163ad9b6ec62.tar.gz
packages_apps_Contacts-fc0c28f5b09387fe04f075717a18163ad9b6ec62.tar.bz2
packages_apps_Contacts-fc0c28f5b09387fe04f075717a18163ad9b6ec62.zip
Contacts: Don't crash if Blocked Number Storage is disabled
If the provider is disabled or missing, trying to resolve content://com.android.blockednumber/ will result in an IllegalArgumentException. Don't allow to block numbers if the provider is missing, or else the Contact app will crash upon opening the preferences. Solution based on commit 96f9c9cd2cfcde1a1c8dcc46ff21ed6452c27eb5 by Gabriele M <moto.falcon.git@gmail.com> Change-Id: Ib95d5e7e8b4b625e6c20f537b84da9d09ebef6ea
-rwxr-xr-xsrc/com/android/contacts/activities/PeopleActivity.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index 79dcc921a..3732dabcd 100755
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -1358,9 +1358,14 @@ public class PeopleActivity extends ContactsActivity implements
helpMenu.setVisible(HelpUtils.isHelpAndFeedbackAvailable());
}
final boolean showMiscOptions = !isSearchOrSelectionMode;
- final boolean showBlockedNumbers = PhoneCapabilityTester.isPhone(this)
+ boolean showBlockedNumbers = false;
+ try {
+ showBlockedNumbers = PhoneCapabilityTester.isPhone(this)
&& ContactsUtils.FLAG_N_FEATURE
&& BlockedNumberContract.canCurrentUserBlockNumbers(this);
+ } catch (IllegalArgumentException e) {
+ Log.d(TAG, "Could not get content resolver", e);
+ }
makeMenuItemVisible(menu, R.id.menu_search, showMiscOptions);
makeMenuItemVisible(menu, R.id.menu_import_export, showMiscOptions);
makeMenuItemVisible(menu, R.id.menu_accounts, showMiscOptions);