summaryrefslogtreecommitdiff
path: root/packages/Shell/src
diff options
context:
space:
mode:
authorFelipe Leme <felipeal@google.com>2016-03-15 10:41:49 -0700
committerFelipe Leme <felipeal@google.com>2016-03-15 13:21:43 -0700
commit213e355c77993c718298c89bc04908a0d6c5addd (patch)
treee920fb9a6d2599e5d56c5a1fdfb394ab1ed81d9c /packages/Shell/src
parent8a8e8ea19a825dd45117909df2f0140ca20565e7 (diff)
Handle AccountManager failures so Shell doesn't crash.
BUG: 27665208 Change-Id: Iccb6ce810c8e1c93bded58871d7ec220b7d14ba9
Diffstat (limited to 'packages/Shell/src')
-rw-r--r--packages/Shell/src/com/android/shell/BugreportProgressService.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index 10c541600d87..89ebcd1b3fe6 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -1102,7 +1102,14 @@ public class BugreportProgressService extends Service {
preferredDomain = "@" + preferredDomain;
}
- final Account[] accounts = am.getAccounts();
+ final Account[] accounts;
+ try {
+ accounts = am.getAccounts();
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Could not get accounts for preferred domain " + preferredDomain, e);
+ return null;
+ }
+ if (DEBUG) Log.d(TAG, "Number of accounts: " + accounts.length);
Account foundAccount = null;
for (Account account : accounts) {
if (Patterns.EMAIL_ADDRESS.matcher(account.name).matches()) {