diff options
| author | 2020-09-11 23:49:20 +0000 | |
|---|---|---|
| committer | 2020-09-11 23:49:20 +0000 | |
| commit | 6e51a31b43ca806ced17633af0ed6873e829deaf (patch) | |
| tree | e4def7683ef1533a8eb26e7ce97fe5edb77113fb | |
| parent | 1b4d361a4f416dc94eac943285e56f04bafaa2bb (diff) | |
| parent | 2ddb682b9500a753866018bd3369e6dfc86eaf10 (diff) | |
Merge "AppOpsService: Add a special case for OP_RECORD_AUDIO_HOTWORD." into rvc-qpr-dev am: 76cf584185 am: 2ddb682b95
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12470810
Change-Id: I8054ffe449c12077d75b3a3f2e84e61522c0f848
| -rw-r--r-- | services/core/java/com/android/server/appop/AppOpsService.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java index b56b09d707af..06f44b1bd388 100644 --- a/services/core/java/com/android/server/appop/AppOpsService.java +++ b/services/core/java/com/android/server/appop/AppOpsService.java @@ -39,6 +39,7 @@ import static android.app.AppOpsManager.OP_FLAG_TRUSTED_PROXIED; import static android.app.AppOpsManager.OP_NONE; import static android.app.AppOpsManager.OP_PLAY_AUDIO; import static android.app.AppOpsManager.OP_RECORD_AUDIO; +import static android.app.AppOpsManager.OP_RECORD_AUDIO_HOTWORD; import static android.app.AppOpsManager.OpEventProxyInfo; import static android.app.AppOpsManager.RestrictionBypass; import static android.app.AppOpsManager.SAMPLING_STRATEGY_BOOT_TIME_SAMPLING; @@ -3428,7 +3429,19 @@ public class AppOpsService extends IAppOpsService.Stub { String resolvedPackageName = resolvePackageName(uid, packageName); if (resolvedPackageName == null) { - return AppOpsManager.MODE_IGNORED; + return AppOpsManager.MODE_IGNORED; + } + + // As a special case for OP_RECORD_AUDIO_HOTWORD, which we use only for attribution + // purposes and not as a check, also make sure that the caller is allowed to access + // the data gated by OP_RECORD_AUDIO. + // + // TODO: Revert this change before Android 12. + if (code == OP_RECORD_AUDIO_HOTWORD) { + int result = checkOperation(OP_RECORD_AUDIO, uid, packageName); + if (result != AppOpsManager.MODE_ALLOWED) { + return result; + } } RestrictionBypass bypass; |