Merge "Make DiscreteRegistry react only to offsetHistory() calls made as TestApi call. Initialize DiscreteRegistry first as it doesn't depend on HistoricalRegistry." into sc-dev am: 6eb35894be

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

Change-Id: Ib4e4502538d8329c4c65666be129cd5755590149
This commit is contained in:
Stanislav Zholnin
2021-05-17 18:27:49 +00:00
committed by Automerger Merge Worker
2 changed files with 5 additions and 1 deletions

View File

@@ -6470,6 +6470,7 @@ public class AppOpsService extends IAppOpsService.Stub {
"offsetHistory"); "offsetHistory");
// Must not hold the appops lock // Must not hold the appops lock
mHistoricalRegistry.offsetHistory(offsetMillis); mHistoricalRegistry.offsetHistory(offsetMillis);
mHistoricalRegistry.offsetDiscreteHistory(offsetMillis);
} }
@Override @Override

View File

@@ -212,6 +212,7 @@ final class HistoricalRegistry {
} }
void systemReady(@NonNull ContentResolver resolver) { void systemReady(@NonNull ContentResolver resolver) {
mDiscreteRegistry.systemReady();
final Uri uri = Settings.Global.getUriFor(Settings.Global.APPOP_HISTORY_PARAMETERS); final Uri uri = Settings.Global.getUriFor(Settings.Global.APPOP_HISTORY_PARAMETERS);
resolver.registerContentObserver(uri, false, new ContentObserver( resolver.registerContentObserver(uri, false, new ContentObserver(
FgThread.getHandler()) { FgThread.getHandler()) {
@@ -249,7 +250,6 @@ final class HistoricalRegistry {
} }
} }
} }
mDiscreteRegistry.systemReady();
} }
private boolean isPersistenceInitializedMLocked() { private boolean isPersistenceInitializedMLocked() {
@@ -594,6 +594,9 @@ final class HistoricalRegistry {
mPersistence.persistHistoricalOpsDLocked(history); mPersistence.persistHistoricalOpsDLocked(history);
} }
} }
}
void offsetDiscreteHistory(long offsetMillis) {
mDiscreteRegistry.offsetHistory(offsetMillis); mDiscreteRegistry.offsetHistory(offsetMillis);
} }