audio: Add IBluetoothA2dp

Similar to IBluetooth interface which controls SCO/HFP,
IBluetoothA2dp controls the A2DP profile. This interface
replaces the following string parameters:

AUDIO_PARAMETER_A2DP_RECONFIG_SUPPORTED
AUDIO_PARAMETER_RECONFIG_A2DP
"A2dpSuspended"

Also, refactor fields used by Module implementation
for persistent child interfaces.

Bug: 270731693
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ie62952c3bc3af2f53535d716e5b57bf48c661306
This commit is contained in:
Mikhail Naganov
2023-02-27 18:51:44 -08:00
parent e6c11eea73
commit 3caf6591b6
10 changed files with 281 additions and 23 deletions

View File

@@ -370,29 +370,32 @@ ndk::ScopedAStatus Module::setModuleDebug(
}
ndk::ScopedAStatus Module::getTelephony(std::shared_ptr<ITelephony>* _aidl_return) {
if (mTelephony == nullptr) {
if (!mTelephony) {
mTelephony = ndk::SharedRefBase::make<Telephony>();
mTelephonyBinder = mTelephony->asBinder();
AIBinder_setMinSchedulerPolicy(mTelephonyBinder.get(), SCHED_NORMAL,
ANDROID_PRIORITY_AUDIO);
}
*_aidl_return = mTelephony;
*_aidl_return = mTelephony.getPtr();
LOG(DEBUG) << __func__ << ": returning instance of ITelephony: " << _aidl_return->get();
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Module::getBluetooth(std::shared_ptr<IBluetooth>* _aidl_return) {
if (mBluetooth == nullptr) {
if (!mBluetooth) {
mBluetooth = ndk::SharedRefBase::make<Bluetooth>();
mBluetoothBinder = mBluetooth->asBinder();
AIBinder_setMinSchedulerPolicy(mBluetoothBinder.get(), SCHED_NORMAL,
ANDROID_PRIORITY_AUDIO);
}
*_aidl_return = mBluetooth;
*_aidl_return = mBluetooth.getPtr();
LOG(DEBUG) << __func__ << ": returning instance of IBluetooth: " << _aidl_return->get();
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Module::getBluetoothA2dp(std::shared_ptr<IBluetoothA2dp>* _aidl_return) {
if (!mBluetoothA2dp) {
mBluetoothA2dp = ndk::SharedRefBase::make<BluetoothA2dp>();
}
*_aidl_return = mBluetoothA2dp.getPtr();
LOG(DEBUG) << __func__ << ": returning instance of IBluetoothA2dp: " << _aidl_return->get();
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Module::connectExternalDevice(const AudioPort& in_templateIdAndAdditionalData,
AudioPort* _aidl_return) {
const int32_t templateId = in_templateIdAndAdditionalData.id;
@@ -1039,13 +1042,10 @@ ndk::ScopedAStatus Module::updateScreenState(bool in_isTurnedOn) {
}
ndk::ScopedAStatus Module::getSoundDose(std::shared_ptr<ISoundDose>* _aidl_return) {
if (mSoundDose == nullptr) {
if (!mSoundDose) {
mSoundDose = ndk::SharedRefBase::make<sounddose::SoundDose>();
mSoundDoseBinder = mSoundDose->asBinder();
AIBinder_setMinSchedulerPolicy(mSoundDoseBinder.get(), SCHED_NORMAL,
ANDROID_PRIORITY_AUDIO);
}
*_aidl_return = mSoundDose;
*_aidl_return = mSoundDose.getPtr();
LOG(DEBUG) << __func__ << ": returning instance of ISoundDose: " << _aidl_return->get();
return ndk::ScopedAStatus::ok();
}