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

Commit e1d03c63 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 am: cd0fceb7

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



Change-Id: I5f50806528b5f12d136980c3783a68a6d39db2a2
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 70fc112a cd0fceb7
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;
}