Merge "audio: Use the canonical direction port direction in ModuleUsb" am: 5a9edcec4c

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2574275

Change-Id: I7c3848444d1500d2b7c4f31b39aef86b737af105
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-05-02 18:32:51 +00:00 committed by Automerger Merge Worker
commit bf373e3e72
2 changed files with 2 additions and 26 deletions

View file

@ -111,30 +111,6 @@ constexpr bool isTelephonyDeviceType(
device == ::aidl::android::media::audio::common::AudioDeviceType::OUT_TELEPHONY_TX;
}
constexpr bool isUsbInputDeviceType(::aidl::android::media::audio::common::AudioDeviceType type) {
switch (type) {
case ::aidl::android::media::audio::common::AudioDeviceType::IN_DOCK:
case ::aidl::android::media::audio::common::AudioDeviceType::IN_ACCESSORY:
case ::aidl::android::media::audio::common::AudioDeviceType::IN_DEVICE:
case ::aidl::android::media::audio::common::AudioDeviceType::IN_HEADSET:
return true;
default:
return false;
}
}
constexpr bool isUsbOutputtDeviceType(::aidl::android::media::audio::common::AudioDeviceType type) {
switch (type) {
case ::aidl::android::media::audio::common::AudioDeviceType::OUT_DOCK:
case ::aidl::android::media::audio::common::AudioDeviceType::OUT_ACCESSORY:
case ::aidl::android::media::audio::common::AudioDeviceType::OUT_DEVICE:
case ::aidl::android::media::audio::common::AudioDeviceType::OUT_HEADSET:
return true;
default:
return false;
}
}
constexpr bool isValidAudioMode(::aidl::android::media::audio::common::AudioMode mode) {
return std::find(kValidAudioModes.begin(), kValidAudioModes.end(), mode) !=
kValidAudioModes.end();

View file

@ -30,13 +30,13 @@ extern "C" {
#include "alsa_device_profile.h"
}
using aidl::android::hardware::audio::common::isUsbInputDeviceType;
using aidl::android::media::audio::common::AudioChannelLayout;
using aidl::android::media::audio::common::AudioDeviceAddress;
using aidl::android::media::audio::common::AudioDeviceDescription;
using aidl::android::media::audio::common::AudioDeviceType;
using aidl::android::media::audio::common::AudioFormatDescription;
using aidl::android::media::audio::common::AudioFormatType;
using aidl::android::media::audio::common::AudioIoFlags;
using aidl::android::media::audio::common::AudioPort;
using aidl::android::media::audio::common::AudioPortConfig;
using aidl::android::media::audio::common::AudioPortExt;
@ -117,7 +117,7 @@ ndk::ScopedAStatus ModuleUsb::populateConnectedDevicePort(AudioPort* audioPort)
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
const bool isInput = isUsbInputDeviceType(devicePort.device.type.type);
const bool isInput = audioPort->flags.getTag() == AudioIoFlags::input;
alsa_device_profile profile;
profile_init(&profile, isInput ? PCM_IN : PCM_OUT);
profile.card = alsaAddress[0];