summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Evan Severson <evanseverson@google.com> 2021-03-11 13:21:28 -0800
committer Evan Severson <evanseverson@google.com> 2021-03-16 16:25:54 +0000
commitdb8fb7ca7365e29cc2853745301e15830bf07cf6 (patch)
treeca6b09ce03fee531c289ecd2265a3f039cb92936
parent56547bfd283d8d26c129a43b1db8ff4e5af457f8 (diff)
Fix lock contention in AppOpsService
Credit to our partner Samsung for suggesting this fix. Test: None Fixes: 181639255 Change-Id: I556ce9caa45e2cbea93fed9c7c27bd16e32ec883
-rw-r--r--services/core/java/com/android/server/appop/HistoricalRegistry.java31
1 files changed, 15 insertions, 16 deletions
diff --git a/services/core/java/com/android/server/appop/HistoricalRegistry.java b/services/core/java/com/android/server/appop/HistoricalRegistry.java
index 22d628b8e789..2c25476153c1 100644
--- a/services/core/java/com/android/server/appop/HistoricalRegistry.java
+++ b/services/core/java/com/android/server/appop/HistoricalRegistry.java
@@ -384,11 +384,10 @@ final class HistoricalRegistry {
callback.sendResult(new Bundle());
return;
}
- mPersistence.collectHistoricalOpsDLocked(result, uid, packageName,
- attributionTag,
- opNames, filter, beginTimeMillis, endTimeMillis, flags);
-
}
+ mPersistence.collectHistoricalOpsDLocked(result, uid, packageName,
+ attributionTag,
+ opNames, filter, beginTimeMillis, endTimeMillis, flags);
}
}
@@ -576,19 +575,19 @@ final class HistoricalRegistry {
Slog.e(LOG_TAG, "Interaction before persistence initialized");
return;
}
- final List<HistoricalOps> history = mPersistence.readHistoryDLocked();
- clearHistoricalRegistry();
- if (history != null) {
- final int historySize = history.size();
- for (int i = 0; i < historySize; i++) {
- final HistoricalOps ops = history.get(i);
- ops.offsetBeginAndEndTime(offsetMillis);
- }
- if (offsetMillis < 0) {
- pruneFutureOps(history);
- }
- mPersistence.persistHistoricalOpsDLocked(history);
+ }
+ final List<HistoricalOps> history = mPersistence.readHistoryDLocked();
+ clearHistoricalRegistry();
+ if (history != null) {
+ final int historySize = history.size();
+ for (int i = 0; i < historySize; i++) {
+ final HistoricalOps ops = history.get(i);
+ ops.offsetBeginAndEndTime(offsetMillis);
+ }
+ if (offsetMillis < 0) {
+ pruneFutureOps(history);
}
+ mPersistence.persistHistoricalOpsDLocked(history);
}
}
}