mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
audio: Use ChildInterface in StreamCommonImpl
Replace the pair of 'shared_ptr<>, Binder' with the equivalent ChildInterface. Fix logging of returned sub-objects to print their Binder value instead of the local pointer. Bug: 264712385 Test: m Change-Id: I1350e7b3720c6244cd8527e1d021ee9577399291
This commit is contained in:
@@ -38,7 +38,8 @@ ndk::ScopedAStatus ModulePrimary::getTelephony(std::shared_ptr<ITelephony>* _aid
|
||||
mTelephony = ndk::SharedRefBase::make<Telephony>();
|
||||
}
|
||||
*_aidl_return = mTelephony.getPtr();
|
||||
LOG(DEBUG) << __func__ << ": returning instance of ITelephony: " << _aidl_return->get();
|
||||
LOG(DEBUG) << __func__
|
||||
<< ": returning instance of ITelephony: " << _aidl_return->get()->asBinder().get();
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
|
||||
@@ -603,18 +603,16 @@ StreamCommonImpl::~StreamCommonImpl() {
|
||||
ndk::ScopedAStatus StreamCommonImpl::initInstance(
|
||||
const std::shared_ptr<StreamCommonInterface>& delegate) {
|
||||
mCommon = ndk::SharedRefBase::make<StreamCommonDelegator>(delegate);
|
||||
mCommonBinder = mCommon->asBinder();
|
||||
AIBinder_setMinSchedulerPolicy(mCommonBinder.get(), SCHED_NORMAL, ANDROID_PRIORITY_AUDIO);
|
||||
return mWorker->start() ? ndk::ScopedAStatus::ok()
|
||||
: ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus StreamCommonImpl::getStreamCommonCommon(
|
||||
std::shared_ptr<IStreamCommon>* _aidl_return) {
|
||||
if (mCommon == nullptr) {
|
||||
if (!mCommon) {
|
||||
LOG(FATAL) << __func__ << ": the common interface was not created";
|
||||
}
|
||||
*_aidl_return = mCommon;
|
||||
*_aidl_return = mCommon.getPtr();
|
||||
LOG(DEBUG) << __func__ << ": returning " << _aidl_return->get()->asBinder().get();
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <system/thread_defs.h>
|
||||
#include <utils/Errors.h>
|
||||
|
||||
#include "core-impl/ChildInterface.h"
|
||||
#include "core-impl/utils.h"
|
||||
|
||||
namespace aidl::android::hardware::audio::core {
|
||||
@@ -466,8 +467,7 @@ class StreamCommonImpl : virtual public StreamCommonInterface, virtual public Dr
|
||||
Metadata mMetadata;
|
||||
StreamContext mContext;
|
||||
std::unique_ptr<StreamWorkerInterface> mWorker;
|
||||
std::shared_ptr<StreamCommonDelegator> mCommon;
|
||||
ndk::SpAIBinder mCommonBinder;
|
||||
ChildInterface<StreamCommonDelegator> mCommon;
|
||||
ConnectedDevices mConnectedDevices;
|
||||
};
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@ ndk::ScopedAStatus ModuleStub::getBluetooth(std::shared_ptr<IBluetooth>* _aidl_r
|
||||
mBluetooth = ndk::SharedRefBase::make<Bluetooth>();
|
||||
}
|
||||
*_aidl_return = mBluetooth.getPtr();
|
||||
LOG(DEBUG) << __func__ << ": returning instance of IBluetooth: " << _aidl_return->get();
|
||||
LOG(DEBUG) << __func__
|
||||
<< ": returning instance of IBluetooth: " << _aidl_return->get()->asBinder().get();
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
@@ -47,7 +48,8 @@ ndk::ScopedAStatus ModuleStub::getBluetoothA2dp(std::shared_ptr<IBluetoothA2dp>*
|
||||
mBluetoothA2dp = ndk::SharedRefBase::make<BluetoothA2dp>();
|
||||
}
|
||||
*_aidl_return = mBluetoothA2dp.getPtr();
|
||||
LOG(DEBUG) << __func__ << ": returning instance of IBluetoothA2dp: " << _aidl_return->get();
|
||||
LOG(DEBUG) << __func__ << ": returning instance of IBluetoothA2dp: "
|
||||
<< _aidl_return->get()->asBinder().get();
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
@@ -56,7 +58,8 @@ ndk::ScopedAStatus ModuleStub::getBluetoothLe(std::shared_ptr<IBluetoothLe>* _ai
|
||||
mBluetoothLe = ndk::SharedRefBase::make<BluetoothLe>();
|
||||
}
|
||||
*_aidl_return = mBluetoothLe.getPtr();
|
||||
LOG(DEBUG) << __func__ << ": returning instance of IBluetoothLe: " << _aidl_return->get();
|
||||
LOG(DEBUG) << __func__
|
||||
<< ": returning instance of IBluetoothLe: " << _aidl_return->get()->asBinder().get();
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user