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

Commit 653cc0ab authored by jiabin's avatar jiabin
Browse files

Support query active microphones information in AudioRecord.

This is part of device enumeration. With the new add API, developer
could get the active microphones information for each channel.

Bug: 64038649
Test: Run cts and check the print log.
Change-Id: Ic63d86e533a30e40697da7522a5a81f7cfcea988
parent 46a76fa5
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1316,6 +1316,14 @@ void AudioRecord::onAudioDeviceUpdate(audio_io_handle_t audioIo,
    }
}

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

status_t AudioRecord::getActiveMicrophones(std::vector<media::MicrophoneInfo>* activeMicrophones)
{
    AutoMutex lock(mLock);
    return mAudioRecord->getActiveMicrophones(activeMicrophones).transactionError();
}

// =========================================================================

void AudioRecord::DeathNotifier::binderDied(const wp<IBinder>& who __unused)
+6 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.media;

import android.media.MicrophoneInfo;

/* Native code must specify namespace media (media::IAudioRecord) when referring to this class */
interface IAudioRecord {

@@ -30,4 +32,8 @@ interface IAudioRecord {
   * will be processed, unless flush() is called.
   */
  void stop();

  /* Get a list of current active microphones.
   */
  void getActiveMicrophones(out MicrophoneInfo[] activeMicrophones);
}
+7 −0
Original line number Diff line number Diff line
@@ -23,8 +23,10 @@
#include <media/AudioTimestamp.h>
#include <media/MediaAnalyticsItem.h>
#include <media/Modulo.h>
#include <media/MicrophoneInfo.h>
#include <utils/RefBase.h>
#include <utils/threads.h>
#include <vector>

#include "android/media/IAudioRecord.h"

@@ -527,6 +529,11 @@ public:
    /* Get the flags */
            audio_input_flags_t getFlags() const { AutoMutex _l(mLock); return mFlags; }

    /* Get active microphones. A empty vector of MicrophoneInfo will be passed as a parameter,
     * the data will be filled when querying the hal.
     */
            status_t    getActiveMicrophones(std::vector<media::MicrophoneInfo>* activeMicrophones);

    /*
     * Dumps the state of an audio record.
     */
+2 −0
Original line number Diff line number Diff line
@@ -559,6 +559,8 @@ using effect_buffer_t = int16_t;
        virtual binder::Status    start(int /*AudioSystem::sync_event_t*/ event,
                int /*audio_session_t*/ triggerSession);
        virtual binder::Status   stop();
        virtual binder::Status   getActiveMicrophones(
                std::vector<media::MicrophoneInfo>* activeMicrophones);
    private:
        const sp<RecordThread::RecordTrack> mRecordTrack;

+2 −0
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@ public:
            void        setSilenced(bool silenced) { mSilenced = silenced; }
            bool        isSilenced() const { return mSilenced; }

            status_t    getActiveMicrophones(std::vector<media::MicrophoneInfo>* activeMicrophones);

private:
    friend class AudioFlinger;  // for mState

Loading