オーディオDevicesFactory
外部参照:/ ハードウェア / インターフェース / オーディオ / 共通 / すべてのバージョン / デフォルト / サービス / service.cpp
メインINT(INT / * ARGC * /チャー* / * ARGV * / []){
アンドロイド:: ProcessState :: initWithDriver( "/ DEV / vndbinder" )。
// vndbinder相互作用のためにスレッドプールを開始
アンドロイド:: ProcessState ::自己() - > startThreadPool();
configureRpcThreadpool(16、真/ * callerWillJoin * / );
ブール= registerPassthroughServiceImplementationに失敗<オーディオ:: V4_0 :: IDevicesFactory>()= OK &&! registerPassthroughServiceImplementation <オーディオ:: V2_0 :: IDevicesFactory>()!= OK。LOG_ALWAYS_FATAL_IF(失敗し、 "オーディオコアAPI 2.0や4.0を登録できませんでした" ); 失敗= registerPassthroughServiceImplementation <オーディオ::効果:: V4_0 :: IEffectsFactory>()!= OK &®isterPassthroughServiceImplementation <オーディオ::効果:: V2_0 :: IEffectsFactory>()!= OK、LOG_ALWAYS_FATAL_IF( "オーディオエフェクトAPI 2.0や4.0を登録できませんでした"、失敗)。失敗= registerPassthroughServiceImplementation <soundtrigger :: V2_1 :: ISoundTriggerHw>()= OK &&!registerPassthroughServiceImplementation <soundtrigger :: V2_0 :: ISoundTriggerHw>()!= OK、ALOGW_IFは( "soundtrigger API 2.0や2.1を登録できませんでした"、失敗)。失敗= registerPassthroughServiceImplementation <ブルートゥース:: 11,010 :: V1_0 :: IBluetoothAudioOffload>()!= OK。ALOGW_IF(「Bluetoothのオーディオが1.0の負荷を軽減登録できませんでした」、失敗)。joinRpcThreadpool(); }
registerPassthroughServiceImplementation()
外部参照:/ システム / libhidl / 輸送 / 含める / hidl / LegacySupport.h
テンプレート<クラスインターフェース>
__attribute __((warn_unused_result))
status_t registerPassthroughServiceImplementation(
STD ::文字列名= "デフォルト" ){
SP <インターフェース>サービス= インターフェイス::のgetService(名前、/ * getStub * /真)。
もし(サービス== nullptr){ ALOGE( "%S /%sのパススルーの実装を取得できませんでした。" 、 インターフェイス::記述子を、name.c_str()); リターンEXIT_FAILURE; } LOG_FATAL_IF(service-> isRemote() 、"%sの/%sのの実装がリモートである!" 、インターフェイス::記述子、name.c_str()); status_t状態= service-> registerAsService(名前); もし(状態== OK){ALOGI( "%S /%sのための完全な登録。" 、インターフェイス::記述子、name.c_str()); }他{ALOGE( "サービス%S /%S(%d)は登録できませんでした。" 、インターフェイス::記述子、name.c_str()、ステータス)。}戻りステータス、}
パラメータ上記インターフェイス::のgetService getStub()は、以下のPM = getPassthroughServiceManager()に直接行く、でServiceManagement.cppでとてもgetRawServiceInternal()が真である; PM-> get()は
それがPassthroughServiceManagerを実行します::取得しますまた、()、この機能ServiceManagement.cpp年。この関数ライブラリは[email protected]開くようになります、例えばIDevicesFactoryように開きます。この呼び出しがオープンになります後はそうどこHIDL_FETCH_IDevicesFactory()、および以下のようにこの関数は、新しいオブジェクトをDevicesFactoryます:
オーディオ\コア\全バージョン\インタフェースでハードウェア\ \デフォルト\コアを含む\全バージョン\ \デフォルト\ DevicesFactory.impl .H
IDevicesFactory * HIDL_FETCH_IDevicesFactory(CONST文字* / *名称* / ){
新しい戻り)(DevicesFactoryします。
}
DevicesFactoryはIDevicesFactory(宋のクラス/ .intermediates)を継承しました
PassthroughServiceManagerを続行::(取得)、この関数は次の、これはDevicesFactoryAll.cpp ::記述でIDevicesFactory actualFqNameある(actualFqName、名)RegisterReferenceを呼び出します、それは[email protected] :: IDevicesFactoryです
だから、getRawServiceInternal()getServiceInternal()DevicesFactoryオブジェクトを返すバック、DevicesFactoryはIDevicesFactoryを継承し、かつIDevicesFactory :: isRemote()のでfalseを返し、それは次のようITYPE :: castFrom(ベース)を行いますが、この関数は、直接でありますDevicesFactory対象であるベースパラメータを、返す、つまり、親を返します。
次に、)(registerPassthroughServiceImplementationに戻り、次いでservice-> registerAsService()、それはIDevicesFactory行う:: registerAsService()を実行します
上記、[email protected]を開くために行くだろう検索パスになるように:
外部参照:/ システム / libhidl / ベース / 含める / hidl / HidlInternal.h
#define HAL_LIBRARY_PATH_SYSTEM_64BIT "/システム/ lib64に/ HW /" の#define HAL_LIBRARY_PATH_VNDK_SP_64BIT_FOR_VERSION "/システム/ lib64に/ vndk-SP%S / HW /" の#define HAL_LIBRARY_PATH_VENDOR_64BIT "/ベンダー/ lib64に/ HW /" の#define HAL_LIBRARY_PATH_ODM_64BIT「/ ODM / lib64に/ HW / " の#define HAL_LIBRARY_PATH_SYSTEM_32BIT "/システム/ LIB / HW /" の#define HAL_LIBRARY_PATH_VNDK_SP_32BIT_FOR_VERSION "/システム/ LIB / vndk-SP%S / HW /" の#define HAL_LIBRARY_PATH_VENDOR_32BIT "/ベンダー/ HW / LIB /" の#define HAL_LIBRARY_PATH_ODM_32BIT" / ODM / libに/ HW /」#ifの定義された(__ LP64__) の#define HAL_LIBRARY_PATH_SYSTEM HAL_LIBRARY_PATH_SYSTEM_64BIT の#define HAL_LIBRARY_PATH_VNDK_SP_FOR_VERSION HAL_LIBRARY_PATH_VNDK_SP_64BIT_FOR_VERSION の#define HAL_LIBRARY_PATH_VENDOR HAL_LIBRARY_PATH_VENDOR_64BIT の#define HAL_LIBRARY_PATH_ODM HAL_LIBRARY_PATH_ODM_64BIT の#else の#define HAL_LIBRARY_PATH_SYSTEM HAL_LIBRARY_PATH_SYSTEM_32BIT の#define HAL_LIBRARY_PATH_VNDK_SP_FOR_VERSION HAL_LIBRARY_PATH_VNDK_SP_32BIT_FOR_VERSION の#define HAL_LIBRARY_PATH_VENDOR HAL_LIBRARY_PATH_VENDOR_32BIT の#define HAL_LIBRARY_PATH_ODM HAL_LIBRARY_PATH_ODM_32BIT #endifの
つまり、この[email protected]メイクファイルが何それを構築するために何ですか?次のように:
cc_library_shared { 名:" [email protected] " 、 :relative_install_path " HW " 、 独自:真、 ベンダー:真、 SRCS:[ " Conversions.cpp " 、 " Device.cpp " 、 " DevicesFactory.cpp " 、 " ParametersUtil.cpp " 、 " PrimaryDevice.cpp " 、 " Stream.cpp "、 " StreamIn.cpp " 、 " StreamOut.cpp " 、 ]、 CFLAGS:[ " -DAUDIO_HAL_VERSION_4_0 " 、 ]、 デフォルト:" hidl_defaults " ]、 export_include_dirs:[ " 含む" ]、 shared_libs:[ " libbase " 、 " libcutils " 、 " libfmq " 、 " libhardware " 、 「libhidlbase" " libhidltransport " " liblog " " libutils " " [email protected] " " [email protected] " " [email protected] 」、 " android.hardware.audio.common-utilの" 、 ]、 header_libs:[ " android.hardware.audio.common.util@all-versions " 、 " android.hardware.audio.core@all-versions-impl " " libaudioclient_headers " " libaudio_system_headers " " libhardware_headers " " libmedia_headers " ]、 whole_static_libs:[ " libmedia_helper 」、 ] }