Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2f05db2 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11691493 from 7f08804e to 24Q3-release

Change-Id: I7aa9cfcaed7dcfb9876d9c344e682866787f21c8
parents c1bfc6c9 7f08804e
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -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/
+1 −4
Original line number Diff line number Diff line
@@ -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\")))",
    ],

+12 −6
Original line number Diff line number Diff line
@@ -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;
@@ -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();
@@ -186,6 +186,10 @@ public:
        if (mClient) ServiceTraits::onClearService(mClient);
    }

    void disableThreadPool() {
        mCanStartThreadPool = false;
    }

private:
    std::mutex mSingleGetter;
    std::mutex mMutex;
@@ -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 {
@@ -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();
}
@@ -957,6 +958,11 @@ void AudioSystem::clearAudioPolicyService() {
    gAudioPolicyServiceHandler.clearService();
}

void AudioSystem::disableThreadPool() {
    gAudioFlingerServiceHandler.disableThreadPool();
    gAudioPolicyServiceHandler.disableThreadPool();
}

// ---------------------------------------------------------------------------

void AudioSystem::onNewAudioModulesAvailable() {
+3 −1
Original line number Diff line number Diff line
@@ -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);

@@ -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,
+4 −1
Original line number Diff line number Diff line
@@ -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