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
This commit is contained in:
Philip P. Moltmann
2019-01-25 16:42:36 -08:00
parent 3abecb462b
commit dde0785228
4 changed files with 123 additions and 3 deletions

View File

@@ -78,7 +78,7 @@ public abstract class AppOpsManagerInternal {
/**
* 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 @@ public abstract class AppOpsManagerInternal {
* @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);
}