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

Commit 00de49e2 authored by Fyodor Kupolov's avatar Fyodor Kupolov
Browse files

Introduced AccountDb API replacing helpers

Refactored AccountsDb to provide unified interface for interacting with
CE/DE database.

Benefits of the new API:
- Better encapsulation - only relevant methods are exposed.
  Implementation details are hidden in private helper classes.
- Clients can now treat CE tables as if they were in  DE database, but
  only available when the user is unlocked.
- Opening database is now implicit - no more getReadableDatabase
  /getWritableDatabase calls. Clients only need to define transaction
  boundaries, when necessary.

Test: Refactoring
Bug: 30639520
Change-Id: I08b1fc95b7a633b036e05e8ef7e8ebd239187aa1
parent 4c9f9d68
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -142,9 +142,8 @@ public final class AccountManagerBackupHelper {
        final AccountManagerService.UserAccounts accounts = mAccountManagerService
        final AccountManagerService.UserAccounts accounts = mAccountManagerService
                .getUserAccounts(userId);
                .getUserAccounts(userId);
        synchronized (accounts.cacheLock) {
        synchronized (accounts.cacheLock) {
            SQLiteDatabase db = accounts.openHelper.getReadableDatabase();
            List<Pair<String, Integer>> allAccountGrants = accounts.accountsDb
            List<Pair<String, Integer>> allAccountGrants = DeDatabaseHelper.findAllAccountGrants(
                    .findAllAccountGrants();
                    db);
            if (allAccountGrants.isEmpty()) {
            if (allAccountGrants.isEmpty()) {
                return null;
                return null;
            }
            }
+105 −150

File changed.

Preview size limit exceeded, changes collapsed.

+550 −525

File changed.

Preview size limit exceeded, changes collapsed.