Fix potential deadlock in shutdown in HistoricalRegistry am: 4a2d4ddf6e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13082067

Change-Id: Iedd8d3224a84f0ba0677709091982abcba54ec9e
This commit is contained in:
Nate Myren
2020-11-18 23:17:26 +00:00
committed by Automerger Merge Worker

View File

@@ -669,10 +669,12 @@ final class HistoricalRegistry {
void shutdown() { void shutdown() {
synchronized (mInMemoryLock) { synchronized (mInMemoryLock) {
if (mMode != AppOpsManager.HISTORICAL_MODE_DISABLED) { if (mMode == AppOpsManager.HISTORICAL_MODE_DISABLED) {
persistPendingHistory(); return;
} }
} }
// Do not call persistPendingHistory inside the memory lock, due to possible deadlock
persistPendingHistory();
} }
void persistPendingHistory() { void persistPendingHistory() {