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

Commit 25f9b05b authored by Kevin Rocard's avatar Kevin Rocard
Browse files

AudioPolicy: allow recording on a APC dyn policy



Test: atest android.media.cts.AudioPlaybackCaptureTest#testCaptureMediaUsage
Bug: 111453086
Change-Id: Iee6c2f450268ab16eb299827e358468cbf1349e2
Signed-off-by: default avatarKevin Rocard <krocard@google.com>
parent e1e9cad4
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -58,10 +58,12 @@ public:
    typedef enum {
        API_INPUT_INVALID = -1,
        API_INPUT_LEGACY  = 0,// e.g. audio recording from a microphone
        API_INPUT_MIX_CAPTURE,// used for "remote submix", capture of the media to play it remotely
        API_INPUT_MIX_CAPTURE,// used for "remote submix" legacy mode (no DAP),
                              // capture of the media to play it remotely
        API_INPUT_MIX_EXT_POLICY_REROUTE,// used for platform audio rerouting, where mixes are
                                         // handled by external and dynamically installed
                                         // policies which reroute audio mixes
        API_INPUT_MIX_PUBLIC_CAPTURE_PLAYBACK,  // used for playback capture with a MediaProjection
        API_INPUT_TELEPHONY_RX, // used for capture from telephony RX path
    } input_type_t;

+5 −1
Original line number Diff line number Diff line
@@ -1986,7 +1986,11 @@ status_t AudioPolicyManager::getInputForAttr(const audio_attributes_t *attr,
        if (status != NO_ERROR) {
            goto error;
        }
        if (is_mix_loopback_render(policyMix->mRouteFlags)) {
            *inputType = API_INPUT_MIX_PUBLIC_CAPTURE_PLAYBACK;
        } else {
            *inputType = API_INPUT_MIX_EXT_POLICY_REROUTE;
        }
        device = mAvailableInputDevices.getDevice(AUDIO_DEVICE_IN_REMOTE_SUBMIX,
                                                  String8(attr->tags + strlen("addr=")),
                                                  AUDIO_FORMAT_DEFAULT);
+3 −0
Original line number Diff line number Diff line
@@ -404,6 +404,9 @@ status_t AudioPolicyService::getInputForAttr(const audio_attributes_t *attr,
        if (status == NO_ERROR) {
            // enforce permission (if any) required for each type of input
            switch (inputType) {
            case AudioPolicyInterface::API_INPUT_MIX_PUBLIC_CAPTURE_PLAYBACK:
                // this use case has been validated in audio service with a MediaProjection token,
                // and doesn't rely on regular permissions
            case AudioPolicyInterface::API_INPUT_LEGACY:
                break;
            case AudioPolicyInterface::API_INPUT_TELEPHONY_RX: