Don't crash if no email provider active
The content resolver throws an exception if no email provider is active.
Handle this case without crashing.
Bug:14273233
Change-Id: I67c6e36ed7d664e46b71410ab1a81002bd3eb3b5
diff --git a/src/com/android/exchange/Exchange.java b/src/com/android/exchange/Exchange.java
index 2b2a468..c18c86c 100644
--- a/src/com/android/exchange/Exchange.java
+++ b/src/com/android/exchange/Exchange.java
@@ -31,7 +31,12 @@
public void onCreate() {
super.onCreate();
EmailContent.init(this);
- getContentResolver().call(EmailContent.CONTENT_URI, MailboxUtilities.FIX_PARENT_KEYS_METHOD,
- "", null);
+ try {
+ getContentResolver().call(EmailContent.CONTENT_URI,
+ MailboxUtilities.FIX_PARENT_KEYS_METHOD, "", null);
+ } catch (IllegalArgumentException e) {
+ // If there is no Email provider (which happens if eg the
+ // Email app is disabled), ignore.
+ }
}
}