Loading PREUPLOAD.cfg +21 −0 Original line number Diff line number Diff line Loading @@ -4,9 +4,30 @@ mainline_hook = ${REPO_ROOT}/frameworks/av/tools/mainline_hook_partial.sh ${REPO hidden_api_txt_checksorted_hook = ${REPO_ROOT}/tools/platform-compat/hiddenapi/checksorted_sha.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT} [Builtin Hooks] bpfmt = true clang_format = true [Builtin Hooks Options] # Enable sort and limit subfolder checks bpfmt = -s media/audio/ media/audioserver/ media/libaaudio/ media/libaudioclient/ media/libaudiofoundation/ media/libaudiohal/ media/libaudioprocessing/ media/libaudiousecasevalidation/ media/libeffects/ media/libmediametrics/ media/libnbaio/ media/libnblog/ services/audioflinger/ services/audioparameterparser/ services/audiopolicy/ services/medialog/ services/oboeservice/ # Only turn on clang-format check for the following subfolders. clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp media/libaudioclient/tests/ Loading media/libaaudio/src/Android.bp +1 −4 Original line number Diff line number Diff line Loading @@ -92,13 +92,10 @@ cc_library { cflags: [ "-Wall", "-Werror", // By default, all symbols are hidden. // "-fvisibility=hidden", // AAUDIO_API is used to explicitly export a function or a variable as a visible symbol. "-Wno-unused-parameter", "-Wthread-safety", // AAUDIO_API is used to explicitly export a function or a variable as a visible symbol. "-DAAUDIO_API=__attribute__((visibility(\"default\")))", ], Loading media/libaudioclient/AudioSystem.cpp +12 −6 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ template <typename ServiceInterface, typename Client, typename AidlInterface, typename ServiceTraits> class ServiceHandler { public: sp<ServiceInterface> getService(bool canStartThreadPool = true) sp<ServiceInterface> getService() EXCLUDES(mMutex) NO_THREAD_SAFETY_ANALYSIS { // std::unique_ptr sp<ServiceInterface> service; sp<Client> client; Loading Loading @@ -143,7 +143,7 @@ public: client = mClient; service = mService; // Make sure callbacks can be received by the client if (canStartThreadPool) { if (mCanStartThreadPool) { ProcessState::self()->startThreadPool(); } ul.unlock(); Loading Loading @@ -186,6 +186,10 @@ public: if (mClient) ServiceTraits::onClearService(mClient); } void disableThreadPool() { mCanStartThreadPool = false; } private: std::mutex mSingleGetter; std::mutex mMutex; Loading @@ -194,6 +198,7 @@ private: sp<ServiceInterface> mLocalService GUARDED_BY(mMutex); sp<ServiceInterface> mService GUARDED_BY(mMutex); sp<Client> mClient GUARDED_BY(mMutex); std::atomic<bool> mCanStartThreadPool = true; }; struct AudioFlingerTraits { Loading Loading @@ -224,10 +229,6 @@ sp<IAudioFlinger> AudioSystem::get_audio_flinger() { return gAudioFlingerServiceHandler.getService(); } sp<IAudioFlinger> AudioSystem::get_audio_flinger_for_fuzzer() { return gAudioFlingerServiceHandler.getService(false /* canStartThreadPool */); } sp<AudioSystem::AudioFlingerClient> AudioSystem::getAudioFlingerClient() { return gAudioFlingerServiceHandler.getClient(); } Loading Loading @@ -957,6 +958,11 @@ void AudioSystem::clearAudioPolicyService() { gAudioPolicyServiceHandler.clearService(); } void AudioSystem::disableThreadPool() { gAudioFlingerServiceHandler.disableThreadPool(); gAudioPolicyServiceHandler.disableThreadPool(); } // --------------------------------------------------------------------------- void AudioSystem::onNewAudioModulesAvailable() { Loading media/libaudioclient/aidl/fuzzer/audioflinger_aidl_fuzzer.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { CHECK_EQ(NO_ERROR, AServiceManager_addService(moduleService.get()->asBinder().get(), "android.hardware.audio.core.IModule/default")); // Disable creating thread pool for fuzzer instance of audio flinger and audio policy services AudioSystem::disableThreadPool(); const auto audioFlinger = sp<AudioFlinger>::make(); const auto afAdapter = sp<AudioFlingerServerAdapter>::make(audioFlinger); Loading @@ -85,7 +88,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { String16(IAudioFlinger::DEFAULT_SERVICE_NAME), IInterface::asBinder(afAdapter), false /* allowIsolated */, IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT)); AudioSystem::get_audio_flinger_for_fuzzer(); const auto audioPolicyService = sp<AudioPolicyService>::make(); CHECK_EQ(NO_ERROR, Loading media/libaudioclient/include/media/AudioSystem.h +4 −1 Original line number Diff line number Diff line Loading @@ -187,7 +187,10 @@ public: // helper function to obtain AudioFlinger service handle static sp<IAudioFlinger> get_audio_flinger(); static sp<IAudioFlinger> get_audio_flinger_for_fuzzer(); // function to disable creation of thread pool (Used for testing). // This should be called before get_audio_flinger() or get_audio_policy_service(). static void disableThreadPool(); static float linearToLog(int volume); static int logToLinear(float volume); Loading Loading
PREUPLOAD.cfg +21 −0 Original line number Diff line number Diff line Loading @@ -4,9 +4,30 @@ mainline_hook = ${REPO_ROOT}/frameworks/av/tools/mainline_hook_partial.sh ${REPO hidden_api_txt_checksorted_hook = ${REPO_ROOT}/tools/platform-compat/hiddenapi/checksorted_sha.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT} [Builtin Hooks] bpfmt = true clang_format = true [Builtin Hooks Options] # Enable sort and limit subfolder checks bpfmt = -s media/audio/ media/audioserver/ media/libaaudio/ media/libaudioclient/ media/libaudiofoundation/ media/libaudiohal/ media/libaudioprocessing/ media/libaudiousecasevalidation/ media/libeffects/ media/libmediametrics/ media/libnbaio/ media/libnblog/ services/audioflinger/ services/audioparameterparser/ services/audiopolicy/ services/medialog/ services/oboeservice/ # Only turn on clang-format check for the following subfolders. clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp media/libaudioclient/tests/ Loading
media/libaaudio/src/Android.bp +1 −4 Original line number Diff line number Diff line Loading @@ -92,13 +92,10 @@ cc_library { cflags: [ "-Wall", "-Werror", // By default, all symbols are hidden. // "-fvisibility=hidden", // AAUDIO_API is used to explicitly export a function or a variable as a visible symbol. "-Wno-unused-parameter", "-Wthread-safety", // AAUDIO_API is used to explicitly export a function or a variable as a visible symbol. "-DAAUDIO_API=__attribute__((visibility(\"default\")))", ], Loading
media/libaudioclient/AudioSystem.cpp +12 −6 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ template <typename ServiceInterface, typename Client, typename AidlInterface, typename ServiceTraits> class ServiceHandler { public: sp<ServiceInterface> getService(bool canStartThreadPool = true) sp<ServiceInterface> getService() EXCLUDES(mMutex) NO_THREAD_SAFETY_ANALYSIS { // std::unique_ptr sp<ServiceInterface> service; sp<Client> client; Loading Loading @@ -143,7 +143,7 @@ public: client = mClient; service = mService; // Make sure callbacks can be received by the client if (canStartThreadPool) { if (mCanStartThreadPool) { ProcessState::self()->startThreadPool(); } ul.unlock(); Loading Loading @@ -186,6 +186,10 @@ public: if (mClient) ServiceTraits::onClearService(mClient); } void disableThreadPool() { mCanStartThreadPool = false; } private: std::mutex mSingleGetter; std::mutex mMutex; Loading @@ -194,6 +198,7 @@ private: sp<ServiceInterface> mLocalService GUARDED_BY(mMutex); sp<ServiceInterface> mService GUARDED_BY(mMutex); sp<Client> mClient GUARDED_BY(mMutex); std::atomic<bool> mCanStartThreadPool = true; }; struct AudioFlingerTraits { Loading Loading @@ -224,10 +229,6 @@ sp<IAudioFlinger> AudioSystem::get_audio_flinger() { return gAudioFlingerServiceHandler.getService(); } sp<IAudioFlinger> AudioSystem::get_audio_flinger_for_fuzzer() { return gAudioFlingerServiceHandler.getService(false /* canStartThreadPool */); } sp<AudioSystem::AudioFlingerClient> AudioSystem::getAudioFlingerClient() { return gAudioFlingerServiceHandler.getClient(); } Loading Loading @@ -957,6 +958,11 @@ void AudioSystem::clearAudioPolicyService() { gAudioPolicyServiceHandler.clearService(); } void AudioSystem::disableThreadPool() { gAudioFlingerServiceHandler.disableThreadPool(); gAudioPolicyServiceHandler.disableThreadPool(); } // --------------------------------------------------------------------------- void AudioSystem::onNewAudioModulesAvailable() { Loading
media/libaudioclient/aidl/fuzzer/audioflinger_aidl_fuzzer.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { CHECK_EQ(NO_ERROR, AServiceManager_addService(moduleService.get()->asBinder().get(), "android.hardware.audio.core.IModule/default")); // Disable creating thread pool for fuzzer instance of audio flinger and audio policy services AudioSystem::disableThreadPool(); const auto audioFlinger = sp<AudioFlinger>::make(); const auto afAdapter = sp<AudioFlingerServerAdapter>::make(audioFlinger); Loading @@ -85,7 +88,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { String16(IAudioFlinger::DEFAULT_SERVICE_NAME), IInterface::asBinder(afAdapter), false /* allowIsolated */, IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT)); AudioSystem::get_audio_flinger_for_fuzzer(); const auto audioPolicyService = sp<AudioPolicyService>::make(); CHECK_EQ(NO_ERROR, Loading
media/libaudioclient/include/media/AudioSystem.h +4 −1 Original line number Diff line number Diff line Loading @@ -187,7 +187,10 @@ public: // helper function to obtain AudioFlinger service handle static sp<IAudioFlinger> get_audio_flinger(); static sp<IAudioFlinger> get_audio_flinger_for_fuzzer(); // function to disable creation of thread pool (Used for testing). // This should be called before get_audio_flinger() or get_audio_policy_service(). static void disableThreadPool(); static float linearToLog(int volume); static int logToLinear(float volume); Loading