Delete persisted historical app ops on package uninstall
They're removed from the current state, but not the persisted state.
This adds HistoricalRegistry#clearHistoryForPackage which reads the
disk state, strips the corresponding UID/package, and re-writes
to disk.
Bug: 129796626
Test: manual test app with location access
Test: atest AppOpsServiceTest#testPackageRemovedHistoricalOps
Change-Id: I8daa2e3474b400a3789b2eaf178441c6d1578af1
(cherry picked from commit 4e3b435c0ee794790131f24dc8cd76cd9102510c)
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java
index 7056799..ae9194c 100644
--- a/services/core/java/com/android/server/appop/AppOpsService.java
+++ b/services/core/java/com/android/server/appop/AppOpsService.java
@@ -905,6 +905,8 @@
}
}
}
+
+ mHistoricalRegistry.clearHistory(uid, packageName);
}
}