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

Commit a59bbab5 authored by Atneya Nair's avatar Atneya Nair Committed by Android (Google) Code Review
Browse files

Merge "Add new AudioInputFlags to AIDL conversion"

parents 5cc7965d 0f0a8037
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -1167,6 +1167,10 @@ ConversionResult<audio_input_flags_t> aidl2legacy_AudioInputFlags_audio_input_fl
            return AUDIO_INPUT_FLAG_DIRECT;
        case AudioInputFlags::ULTRASOUND:
            return AUDIO_INPUT_FLAG_ULTRASOUND;
        case AudioInputFlags::HOTWORD_TAP:
            return AUDIO_INPUT_FLAG_HOTWORD_TAP;
        case AudioInputFlags::HW_LOOKBACK:
            return AUDIO_INPUT_FLAG_HW_LOOKBACK;
    }
    return unexpected(BAD_VALUE);
}
@@ -1194,6 +1198,10 @@ ConversionResult<AudioInputFlags> legacy2aidl_audio_input_flags_t_AudioInputFlag
            return AudioInputFlags::DIRECT;
        case AUDIO_INPUT_FLAG_ULTRASOUND:
            return AudioInputFlags::ULTRASOUND;
        case AUDIO_INPUT_FLAG_HOTWORD_TAP:
            return AudioInputFlags::HOTWORD_TAP;
        case AUDIO_INPUT_FLAG_HW_LOOKBACK:
            return AudioInputFlags::HW_LOOKBACK;
    }
    return unexpected(BAD_VALUE);
}
+6 −2
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include <map>
#include <math.h>
#include <set>
#include <type_traits>
#include <unordered_set>
#include <vector>

@@ -7439,8 +7440,11 @@ sp<IOProfile> AudioPolicyManager::getInputProfile(const sp<DeviceDescriptor> &de
    // TODO: perhaps isCompatibleProfile should return a "matching" score so we can return
    // the best matching profile, not the first one.

    const audio_input_flags_t mustMatchFlag = AUDIO_INPUT_FLAG_MMAP_NOIRQ;
    const audio_input_flags_t oriFlags = flags;
    using underlying_input_flag_t = std::underlying_type_t<audio_input_flags_t>;
    const underlying_input_flag_t mustMatchFlag = AUDIO_INPUT_FLAG_MMAP_NOIRQ |
                         AUDIO_INPUT_FLAG_HOTWORD_TAP | AUDIO_INPUT_FLAG_HW_LOOKBACK;

    const underlying_input_flag_t oriFlags = flags;

    for (;;) {
        sp<IOProfile> firstInexact = nullptr;
+3 −1
Original line number Diff line number Diff line
@@ -667,7 +667,9 @@ Status AudioPolicyService::getInputForAttr(const media::AudioAttributesInternal&
        return binderStatusFromStatusT(PERMISSION_DENIED);
    }

    if (((flags & AUDIO_INPUT_FLAG_HW_HOTWORD) != 0)
    if (((flags & (AUDIO_INPUT_FLAG_HW_HOTWORD |
                        AUDIO_INPUT_FLAG_HOTWORD_TAP |
                        AUDIO_INPUT_FLAG_HW_LOOKBACK)) != 0)
            && !canCaptureHotword) {
        ALOGE("%s: permission denied: hotword mode not allowed"
              " for uid %d pid %d", __func__, attributionSource.uid, attributionSource.pid);