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

Commit 48bd513b authored by Shai Barack's avatar Shai Barack
Browse files

Set normal sync mode for accounts DB

We can't use WAL (see b/438408487#comment4) but we could try normal sync.
This is to treat ANRs and jank that were co-incident with Accounts DB doing fsync
while the app's main thread was stalled on an I/O-related blocking_function.

I came across this while doing unrelated research:
https://docs.google.com/document/d/1zZ4GJL1ISu4pja23nizOl1jFA7MJ6lCCD5nvwFf0TSQ/edit?usp=sharing&resourcekey=0-t34iS4UP-1mVhKc8W7AZxA
Thought I'd revisit this issue.
We can try ramping this flag and study the impact.

Flag: com.android.server.accounts.sqlite_sync_normal
Bug: 438408487

Change-Id: I4677c8d6c40865f935f8605183c5844b8c7407ee
parent e5734fd9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ java_library_static {
    ],

    libs: [
        "accounts_flags_lib",
        "android.frameworks.location.altitude-V2-java",
        "android.hardware.common-V2-java",
        "android.hardware.gnss-V2-java",
@@ -178,6 +179,7 @@ java_library_static {
    ],

    static_libs: [
        "accounts_flags_lib",
        "android.frameworks.vibrator-V1-java", // AIDL
        "android.frameworks.devicestate-V1-java", // AIDL
        "android.hardware.authsecret-V1.0-java",
+14 −0
Original line number Diff line number Diff line
@@ -200,6 +200,13 @@ class AccountsDb implements AutoCloseable {
            super(context, ceDatabaseName, null, CE_DATABASE_VERSION);
        }

        @Override
        public void onConfigure(SQLiteDatabase db) {
            if (Flags.sqliteSyncNormal()) {
                db.execSQL("PRAGMA synchronous = NORMAL");
            }
        }

        /**
         * This call needs to be made while the mCacheLock is held.
         * @param db The database.
@@ -514,6 +521,13 @@ class AccountsDb implements AutoCloseable {
            mUserId = userId;
        }

        @Override
        public void onConfigure(SQLiteDatabase db) {
            if (Flags.sqliteSyncNormal()) {
                db.execSQL("PRAGMA synchronous = NORMAL");
            }
        }

        /**
         * This call needs to be made while the mCacheLock is held. The way to
         * ensure this is to get the lock any time a method is called ont the DatabaseHelper
+17 −0
Original line number Diff line number Diff line
package {
    default_team: "trendy_team_authentication",
}

java_aconfig_library {
    name: "accounts_flags_lib",
    aconfig_declarations: "accounts_flags",
}

aconfig_declarations {
    name: "accounts_flags",
    package: "com.android.server.accounts",
    container: "system",
    srcs: [
        "flags.aconfig",
    ],
}
+9 −0
Original line number Diff line number Diff line
package: "com.android.server.accounts"
container: "system"

flag {
     name: "sqlite_sync_normal"
     namespace: "system_performance"
     description: "Whether to enable normal sync mode for the accounts database."
     bug: "438408487"
}
 No newline at end of file