summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hui Yu <huiyu@google.com> 2020-04-09 19:42:09 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-04-09 19:42:09 +0000
commitd0139b01dda7d1c1a04a1e9b0003e76d55c3b78e (patch)
treeff4a99c33c740785cffe015738277c25baaa0672
parent94fbff18e540e40b35991c0a6b72de7e5c4b0ac0 (diff)
parent3b1110b170be4e56ef40fbae62262fe697256c42 (diff)
Merge "Document process capability in AppOps.md." into rvc-dev
-rw-r--r--core/java/android/app/AppOps.md29
1 files changed, 21 insertions, 8 deletions
diff --git a/core/java/android/app/AppOps.md b/core/java/android/app/AppOps.md
index bee701addca8..ad1a30146663 100644
--- a/core/java/android/app/AppOps.md
+++ b/core/java/android/app/AppOps.md
@@ -116,14 +116,27 @@ for app-ops. It also delays the changes by a _settle time_. This delay is needed
can fluctuate when switching apps. By delaying the change the appops service is not affected by
those.
-The proc state is used for two use cases: Firstly, Tracking remembers the proc state for each
-tracked event. Secondly, `noteOp`/`checkOp` calls for app-op that are set to `MODE_FOREGROUND` are
-translated using the `AppOpsService.UidState.evalMode` method into `MODE_ALLOWED` when the app is
-counted as foreground and `MODE_IGNORED` when the app is counted as background. `checkOpRaw`
-calls are not affected.
-
-The current proc state for an app can be read from `dumpsys appops`. The tracking information can
-be read from `dumpsys appops`
+In addition to proc state, the `AppOpsService` also receives process capability update from the
+`ActivityManagerService`. Proc capability specifies what while-in-use(`MODE_FOREGROUND`) operations
+ the proc is allowed to perform in its current proc state. There are three proc capabilities
+ defined so far:
+`PROCESS_CAPABILITY_FOREGROUND_LOCATION`, `PROCESS_CAPABILITY_FOREGROUND_CAMERA` and
+`PROCESS_CAPABILITY_FOREGROUND_MICROPHONE`, they correspond to the while-in-use operation of
+location, camera and microphone (microphone is `RECORD_AUDIO`).
+
+In `ActivityManagerService`, `PROCESS_STATE_TOP` and `PROCESS_STATE_PERSISTENT` have all
+three capabilities, `PROCESS_STATE_FOREGROUND_SERVICE` has capabilities defined by
+ `foregroundServiceType` that is specified in foreground service's manifest file. A client process
+ can pass its capabilities to service using `BIND_INCLUDE_CAPABILITIES` flag.
+
+The proc state and capability are used for two use cases: Firstly, Tracking remembers the proc state
+ for each tracked event. Secondly, `noteOp`/`checkOp` calls for app-op that are set to
+ `MODE_FOREGROUND` are translated using the `AppOpsService.UidState.evalMode` method into
+ `MODE_ALLOWED` when the app has the capability and `MODE_IGNORED` when the app does not have the
+ capability. `checkOpRaw` calls are not affected.
+
+The current proc state and capability for an app can be read from `dumpsys appops`.
+The tracking information can be read from `dumpsys appops`
```
Uid u0a118: