Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2403b49b authored by Dmitry Dementyev's avatar Dmitry Dementyev
Browse files

Ignore SQL exceptions in getAccountsAsUserForPackage and syncSharedAccounts.

In rare cases API is called for removed user and crashes system server.

Bug: 354148797
Test: manual
Flag: EXEMPT bugfix
Change-Id: I9f1aef6f8e131ad1df11f68eda4c0db189b45b05
parent 83f5e4f2
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -4616,6 +4616,9 @@ public class AccountManagerService
                    opPackageName,
                    visibleAccountTypes,
                    includeUserManagedNotVisible);
        } catch (SQLiteException e) {
            Log.w(TAG, "Could not get accounts for user " + userId, e);
            return new Account[]{};
        } finally {
            restoreCallingIdentity(identityToken);
        }
@@ -4703,6 +4706,7 @@ public class AccountManagerService

    public Account[] getSharedAccountsAsUser(int userId) {
        userId = handleIncomingUser(userId);
        try {
            UserAccounts accounts = getUserAccounts(userId);
            synchronized (accounts.dbLock) {
                List<Account> accountList = accounts.accountsDb.getSharedAccounts();
@@ -4710,6 +4714,10 @@ public class AccountManagerService
                accountList.toArray(accountArray);
                return accountArray;
            }
        } catch (SQLiteException e) {
            Log.w(TAG, "Could not get shared accounts for user " + userId, e);
            return new Account[]{};
        }
    }

    @Override