Reset per-pkg app-ops for runtime permissions
... on every boot.
These should never have been set, but we allow settings them via the
shell.
- Also previously a bug set per-pkg app-ops.
- Also set the app-op correctly when a fg/bg permission looses it's bg
permission.
Test: Set per-pkg app-opp. Rebooted and saw log message.
atest --test-mapping frameworks/base/services/core/java/com/android/server/pm/permission/:presubmit
Change-Id: If3b56fc08783ea99b4dba70c5fa275b94411ce94
Fixes: 123177944
diff --git a/core/java/android/app/AppOpsManagerInternal.java b/core/java/android/app/AppOpsManagerInternal.java
index b556033..da45054 100644
--- a/core/java/android/app/AppOpsManagerInternal.java
+++ b/core/java/android/app/AppOpsManagerInternal.java
@@ -78,7 +78,7 @@
/**
* Sets the app-ops mode for a certain app-op and uid.
*
- * <p>Similar as {@link AppOpsManager#setMode} but does not require the package manager to be
+ * <p>Similar as {@link AppOpsManager#setUidMode} but does not require the package manager to be
* working. Hence this can be used very early during boot.
*
* <p>Only for internal callers. Does <u>not</u> verify that package name belongs to uid.
@@ -88,4 +88,12 @@
* @param mode The new mode to set.
*/
public abstract void setUidMode(int code, int uid, int mode);
+
+ /**
+ * Set all {@link #setMode (package) modes} for this uid to the default value.
+ *
+ * @param code The app-op
+ * @param uid The uid
+ */
+ public abstract void setAllPkgModesToDefault(int code, int uid);
}