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

Commit 7b588a6e authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[audio] Avoid startOp when restrictions in place" into main

parents 0936276c 4b555e86
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -172,9 +172,20 @@ static int checkRecordingInternal(const AttributionSourceState &attributionSourc
        permission::PermissionChecker permissionChecker;
        int permitted;
        if (start) {
            // Do a double-check, where we first check without actually starting in order to handle
            // the behavior of AppOps where ops are sometimes started but paused for SOFT_DENIED.
            // Since there is no way to maintain reference consensus due to this behavior, avoid
            // starting an op when a restriction is in place by first checking. Technically racy,
            // but very unlikely.
            // TODO(b/294609684) To be removed when the pause state for an OP is removed.
            permitted = permissionChecker.checkPermissionForPreflightFromDatasource(
                    sAndroidPermissionRecordAudio, resolvedAttributionSource.value(), msg,
                    attributedOpCode);
            if (permitted == PERMISSION_GRANTED) {
                permitted = permissionChecker.checkPermissionForStartDataDeliveryFromDatasource(
                        sAndroidPermissionRecordAudio, resolvedAttributionSource.value(), msg,
                        attributedOpCode);
            }
        } else {
            permitted = permissionChecker.checkPermissionForPreflightFromDatasource(
                    sAndroidPermissionRecordAudio, resolvedAttributionSource.value(), msg,