Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd0fceb7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Use PermissionChecker (av) in captureAudioOutputAllowed method" into...

Merge "Use PermissionChecker (av) in captureAudioOutputAllowed method" into tm-dev am: 981bf0e8 am: 0490489b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/18672350



Change-Id: Ifd31f1abf90498cbf2e299e8b70e835f7e80ca43
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 3fa71e4f 0490489b
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -181,10 +181,14 @@ void finishRecording(const AttributionSourceState& attributionSource, audio_sour

bool captureAudioOutputAllowed(const AttributionSourceState& attributionSource) {
    uid_t uid = VALUE_OR_FATAL(aidl2legacy_int32_t_uid_t(attributionSource.uid));
    pid_t pid = VALUE_OR_FATAL(aidl2legacy_int32_t_pid_t(attributionSource.pid));
    if (isAudioServerOrRootUid(uid)) return true;
    static const String16 sCaptureAudioOutput("android.permission.CAPTURE_AUDIO_OUTPUT");
    bool ok = PermissionCache::checkPermission(sCaptureAudioOutput, pid, uid);
    // Use PermissionChecker, which includes some logic for allowing the isolated
    // HotwordDetectionService to hold certain permissions.
    permission::PermissionChecker permissionChecker;
    bool ok = (permissionChecker.checkPermissionForPreflight(
            sCaptureAudioOutput, attributionSource, String16(),
            AppOpsManager::OP_NONE) != permission::PermissionChecker::PERMISSION_HARD_DENIED);
    if (!ok) ALOGV("Request requires android.permission.CAPTURE_AUDIO_OUTPUT");
    return ok;
}