Handle AccountManager failures so Shell doesn\'t crash. am: 213e355c77

am: a70ae37b19

* commit 'a70ae37b1934c5533d1d315bd3886ba31144618f':
  Handle AccountManager failures so Shell doesn't crash.
This commit is contained in:
Felipe Leme
2016-03-15 20:30:35 +00:00
committed by android-build-merger

View File

@@ -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()) {