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

Commit f6dd57e8 authored by Akshata Kadam's avatar Akshata Kadam Committed by Automerger Merge Worker
Browse files

Added get_audio_flinger_for_fuzzer in AudioSystem.cpp am: b43ed66d

parents ffede699 b43ed66d
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ status_t AudioSystem::setLocalAudioFlinger(const sp<IAudioFlinger>& af) {
}

// establish binder interface to AudioFlinger service
const sp<IAudioFlinger> AudioSystem::get_audio_flinger() {
const sp<IAudioFlinger> AudioSystem::getAudioFlingerImpl(bool canStartThreadPool = true) {
    sp<IAudioFlinger> af;
    sp<AudioFlingerClient> afc;
    bool reportNoError = false;
@@ -147,8 +147,10 @@ const sp<IAudioFlinger> AudioSystem::get_audio_flinger() {
        afc = gAudioFlingerClient;
        af = gAudioFlinger;
        // Make sure callbacks can be received by gAudioFlingerClient
        if(canStartThreadPool) {
            ProcessState::self()->startThreadPool();
        }
    }
    const int64_t token = IPCThreadState::self()->clearCallingIdentity();
    af->registerClient(afc);
    IPCThreadState::self()->restoreCallingIdentity(token);
@@ -156,6 +158,14 @@ const sp<IAudioFlinger> AudioSystem::get_audio_flinger() {
    return af;
}

const sp<IAudioFlinger> AudioSystem:: get_audio_flinger() {
    return getAudioFlingerImpl();
}

const sp<IAudioFlinger> AudioSystem:: get_audio_flinger_for_fuzzer() {
    return getAudioFlingerImpl(false);
}

const sp<AudioSystem::AudioFlingerClient> AudioSystem::getAudioFlingerClient() {
    // calling get_audio_flinger() will initialize gAudioFlingerClient if needed
    const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
+2 −0
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@ public:

    // helper function to obtain AudioFlinger service handle
    static const sp<IAudioFlinger> get_audio_flinger();
    static const sp<IAudioFlinger> get_audio_flinger_for_fuzzer();

    static float linearToLog(int volume);
    static int logToLinear(float volume);
@@ -876,6 +877,7 @@ private:
    static audio_io_handle_t getOutput(audio_stream_type_t stream);
    static const sp<AudioFlingerClient> getAudioFlingerClient();
    static sp<AudioIoDescriptor> getIoDescriptor(audio_io_handle_t ioHandle);
    static const sp<IAudioFlinger> getAudioFlingerImpl(bool canStartThreadPool);

    // Invokes all registered error callbacks with the given error code.
    static void reportError(status_t err);