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

Commit 030005fb authored by Dmitry Dementyev's avatar Dmitry Dementyev Committed by Android (Google) Code Review
Browse files

Merge "Prevent system service crash after SQL error in AccountManagerService." into main

parents 88695ddf d248c61e
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ import android.content.pm.SigningDetails.CertCapabilities;
import android.content.pm.UserInfo;
import android.database.Cursor;
import android.database.sqlite.SQLiteCantOpenDatabaseException;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteFullException;
import android.database.sqlite.SQLiteStatement;
import android.os.Binder;
@@ -1461,8 +1462,8 @@ public class AccountManagerService
                List<Integer> uids;
                try {
                    uids = accounts.accountsDb.findAllUidGrants();
                } catch (SQLiteCantOpenDatabaseException e) {
                    Log.w(TAG, "Could not delete grants for user = " + accounts.userId);
                } catch (SQLiteException e) {
                    Log.w(TAG, "Could not delete grants for user = " + accounts.userId, e);
                    return;
                }
                for (int uid : uids) {
@@ -4464,6 +4465,9 @@ public class AccountManagerService
                    opPackageName,
                    visibleAccountTypes,
                    false /* includeUserManagedNotVisible */);
        } catch (SQLiteException e) {
            Log.w(TAG, "Could not get accounts for user " + userId, e);
            return new Account[]{};
        } finally {
            restoreCallingIdentity(identityToken);
        }
@@ -4539,7 +4543,7 @@ public class AccountManagerService
        try {
            return getAccountsAsUserForPackage(type, userId, opPackageName /* callingPackage */, -1,
                    opPackageName, false /* includeUserManagedNotVisible */);
        } catch (SQLiteCantOpenDatabaseException e) {
        } catch (SQLiteException e) {
            Log.e(TAG, "Could not get accounts for user " + userId, e);
            return new Account[]{};
        }
@@ -4549,7 +4553,7 @@ public class AccountManagerService
    private Account[] getAccountsOrEmptyArray(String type, int userId, String opPackageName) {
        try {
            return getAccountsAsUser(type, userId, opPackageName);
        } catch (SQLiteCantOpenDatabaseException e) {
        } catch (SQLiteException e) {
            Log.w(TAG, "Could not get accounts for user " + userId, e);
            return new Account[]{};
        }