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

Commit 3e3cc268 authored by Lee Shombert's avatar Lee Shombert Committed by Android (Google) Code Review
Browse files

Merge "Correct SQLiteOpenHelper lock creation" into main

parents 33365431 5253dcb1
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -182,17 +182,10 @@ public abstract class SQLiteOpenHelper implements AutoCloseable {
        setOpenParamsBuilder(openParamsBuilder);

        Object lock = null;
        if (mName == null || !Flags.concurrentOpenHelper()) {
        if (!Flags.concurrentOpenHelper() || mName == null) {
            lock = new Object();
        } else {
            try {
                final String path = mContext.getDatabasePath(mName).getCanonicalPath();
                lock = sDbLock.computeIfAbsent(path, (String k) -> new Object());
            } catch (IOException e) {
                Log.d(TAG, "failed to construct db path for " + mName);
                // Ensure the lock is not null.
                lock = new Object();
            }
            lock = sDbLock.computeIfAbsent(mName, (String k) -> new Object());
        }
        mLock = lock;
    }