Ignore SQLite exceptions in AccountManager onPackageAdded

Callback is used to dismiss rarely used notification if account becomes
visible after app update -  b/79918517

Bug: 289131456
Test: N/A
Change-Id: I775c53b3c7663bda218125748dc76f1f1c242f7f
This commit is contained in:
Dmitry Dementyev
2023-07-11 16:06:36 -07:00
parent 9941e10ed2
commit d69b23c8d3

View File

@@ -357,15 +357,25 @@ public class AccountManagerService
@Override
public void onPackageAdded(String packageName, int uid) {
// Called on a handler, and running as the system
UserAccounts accounts = getUserAccounts(UserHandle.getUserId(uid));
cancelAccountAccessRequestNotificationIfNeeded(uid, true, accounts);
try {
UserAccounts accounts = getUserAccounts(UserHandle.getUserId(uid));
cancelAccountAccessRequestNotificationIfNeeded(uid, true, accounts);
} catch (SQLiteCantOpenDatabaseException e) {
Log.w(TAG, "Can't read accounts database", e);
return;
}
}
@Override
public void onPackageUpdateFinished(String packageName, int uid) {
// Called on a handler, and running as the system
UserAccounts accounts = getUserAccounts(UserHandle.getUserId(uid));
cancelAccountAccessRequestNotificationIfNeeded(uid, true, accounts);
try {
UserAccounts accounts = getUserAccounts(UserHandle.getUserId(uid));
cancelAccountAccessRequestNotificationIfNeeded(uid, true, accounts);
} catch (SQLiteCantOpenDatabaseException e) {
Log.w(TAG, "Can't read accounts database", e);
return;
}
}
}.register(mContext, mHandler.getLooper(), UserHandle.ALL, true);
@@ -391,6 +401,9 @@ public class AccountManagerService
}
} catch (NameNotFoundException e) {
/* ignore */
} catch (SQLiteCantOpenDatabaseException e) {
Log.w(TAG, "Can't read accounts database", e);
return;
}
}
});