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

Commit 42387cea authored by Nate Myren's avatar Nate Myren
Browse files

Fix potential deadlock in shutdown in HistoricalRegistry

Ensure that the memory lock is released before calling
persistPendingHistory in HistoricalRegistry.

Bug: 172776374
Test: none
Change-Id: I909de9f83cd43c695d0db99f82252ce36a0b972b
parent f00473f7
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -669,10 +669,12 @@ final class HistoricalRegistry {

    void shutdown() {
        synchronized (mInMemoryLock) {
            if (mMode != AppOpsManager.HISTORICAL_MODE_DISABLED) {
                persistPendingHistory();
            if (mMode == AppOpsManager.HISTORICAL_MODE_DISABLED) {
                return;
            }
        }
        // Do not call persistPendingHistory inside the memory lock, due to possible deadlock
        persistPendingHistory();
    }

    void persistPendingHistory() {