am de8268d6: Merge change 2331 into donut

Merge commit 'de8268d6d1cd168510c490b17e93154d2eab767c'

* commit 'de8268d6d1cd168510c490b17e93154d2eab767c':
  Fix issue 1846343 - part 1
diff --git a/api/current.xml b/api/current.xml
index 00ca732..4db6e66 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -74241,6 +74241,17 @@
  visibility="public"
 >
 </constructor>
+<method name="getAudioSourceMax"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getMaxAmplitude"
  return="int"
  abstract="false"
@@ -74642,6 +74653,39 @@
  visibility="public"
 >
 </field>
+<field name="VOICE_CALL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="VOICE_DOWNLINK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="VOICE_UPLINK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 </class>
 <interface name="MediaRecorder.OnErrorListener"
  abstract="true"
diff --git a/core/jni/android_media_AudioRecord.cpp b/core/jni/android_media_AudioRecord.cpp
index 288433a..e71e348 100644
--- a/core/jni/android_media_AudioRecord.cpp
+++ b/core/jni/android_media_AudioRecord.cpp
@@ -45,8 +45,6 @@
     jmethodID postNativeEventInJava; //... event post callback method
     int       PCM16;                 //...  format constants
     int       PCM8;                  //...  format constants
-    int       SOURCE_DEFAULT;        //...  record source constants
-    int       SOURCE_MIC;            //...  record source constants
     jfieldID  nativeRecorderInJavaObj; // provides access to the C++ AudioRecord object
     jfieldID  nativeCallbackCookie;    // provides access to the AudioRecord callback data
 };
@@ -66,7 +64,7 @@
 #define AUDIORECORD_ERROR_SETUP_ZEROFRAMECOUNT      -16
 #define AUDIORECORD_ERROR_SETUP_INVALIDCHANNELCOUNT -17
 #define AUDIORECORD_ERROR_SETUP_INVALIDFORMAT       -18
-#define AUDIORECORD_ERROR_SETUP_INVALIDSTREAMTYPE   -19
+#define AUDIORECORD_ERROR_SETUP_INVALIDSOURCE       -19
 #define AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED    -20
 
 jint android_media_translateRecorderErrorCode(int code) {
@@ -154,17 +152,16 @@
     int frameSize = nbChannels * bytesPerSample;
     size_t frameCount = buffSizeInBytes / frameSize;
     
-    // compare the source against the Java constants
-    AudioRecord::stream_type arSource;
-    if (source == javaAudioRecordFields.SOURCE_DEFAULT) {
-        arSource = AudioRecord::DEFAULT_INPUT;
-    } else if (source == javaAudioRecordFields.SOURCE_MIC) {
-        arSource = AudioRecord::MIC_INPUT;
-    } else {
+    // convert and check input source value
+    // input_source values defined in AudioRecord.h are equal to
+    // JAVA MediaRecord.AudioSource values minus 1.
+    AudioRecord::input_source arSource = (AudioRecord::input_source)(source - 1);
+    if (arSource < AudioRecord::DEFAULT_INPUT ||
+        arSource >= AudioRecord::NUM_INPUT_SOURCES) {
         LOGE("Error creating AudioRecord: unknown source.");
-        return AUDIORECORD_ERROR_SETUP_INVALIDSTREAMTYPE;
+        return AUDIORECORD_ERROR_SETUP_INVALIDSOURCE;
     }
-     
+
     audiorecord_callback_cookie *lpCallbackData = NULL;
     AudioRecord* lpRecorder = NULL;
 
@@ -511,8 +508,6 @@
 #define JAVA_POSTEVENT_CALLBACK_NAME  "postEventFromNative"
 #define JAVA_CONST_PCM16_NAME         "ENCODING_PCM_16BIT"
 #define JAVA_CONST_PCM8_NAME          "ENCODING_PCM_8BIT"
-#define JAVA_CONST_SOURCEDEFAULT_NAME "SOURCE_DEFAULT"
-#define JAVA_CONST_SOURCEMIC_NAME     "SOURCE_MIC"
 #define JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME  "mNativeRecorderInJavaObj"
 #define JAVA_NATIVECALLBACKINFO_FIELD_NAME       "mNativeCallbackCookie"
 
@@ -583,17 +578,6 @@
         return -1;
     }
 
-    // Get the recording source constants from the AudioRecord class
-    if ( !android_media_getIntConstantFromClass(env, javaAudioRecordFields.audioRecordClass, 
-                kClassPathName,
-                JAVA_CONST_SOURCEDEFAULT_NAME, &(javaAudioRecordFields.SOURCE_DEFAULT))
-        || !android_media_getIntConstantFromClass(env, javaAudioRecordFields.audioRecordClass, 
-                kClassPathName,
-                JAVA_CONST_SOURCEMIC_NAME, &(javaAudioRecordFields.SOURCE_MIC)) ) {
-        // error log performed in getIntConstantFromClass() 
-        return -1;
-    }
-
     return AndroidRuntime::registerNativeMethods(env,
             kClassPathName, gMethods, NELEM(gMethods));
 }
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h
index e962db6e..106807e 100644
--- a/include/media/AudioRecord.h
+++ b/include/media/AudioRecord.h
@@ -39,10 +39,15 @@
 {
 public:
 
-    enum stream_type {
+    // input sources values must always be defined in the range
+    // [AudioRecord::DEFAULT_INPUT, AudioRecord::NUM_INPUT_SOURCES[
+    enum input_source {
         DEFAULT_INPUT   =-1,
         MIC_INPUT       = 0,
-        NUM_STREAM_TYPES
+        VOICE_UPLINK_INPUT = 1,
+        VOICE_DOWNLINK_INPUT = 2,
+        VOICE_CALL_INPUT = 3,
+        NUM_INPUT_SOURCES
     };
 
     static const int DEFAULT_SAMPLE_RATE = 8000;
@@ -118,7 +123,7 @@
      *
      * Parameters:
      *
-     * streamType:         Select the audio input to record to (e.g. AudioRecord::MIC_INPUT).
+     * inputSource:        Select the audio input to record to (e.g. AudioRecord::MIC_INPUT).
      * sampleRate:         Track sampling rate in Hz.
      * format:             PCM sample format (e.g AudioSystem::PCM_16_BIT for signed
      *                     16 bits per sample).
@@ -140,7 +145,7 @@
          RECORD_IIR_ENABLE = AudioSystem::TX_IIR_ENABLE
      };
 
-                        AudioRecord(int streamType,
+                        AudioRecord(int inputSource,
                                     uint32_t sampleRate = 0,
                                     int format          = 0,
                                     int channelCount    = 0,
@@ -165,7 +170,7 @@
      *  - NO_INIT: audio server or audio hardware not initialized
      *  - PERMISSION_DENIED: recording is not allowed for the requesting process
      * */
-            status_t    set(int streamType      = 0,
+            status_t    set(int inputSource     = 0,
                             uint32_t sampleRate = 0,
                             int format          = 0,
                             int channelCount    = 0,
@@ -197,6 +202,7 @@
             int         channelCount() const;
             uint32_t    frameCount() const;
             int         frameSize() const;
+            int         inputSource() const;
 
 
     /* After it's created the track is not active. Call start() to
@@ -323,7 +329,8 @@
     audio_track_cblk_t*     mCblk;
     uint8_t                 mFormat;
     uint8_t                 mChannelCount;
-    uint8_t                 mReserved[2];
+    uint8_t                 mInputSource;
+    uint8_t                 mReserved;
     status_t                mStatus;
     uint32_t                mLatency;
 
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index 031335e..bac3d29 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -54,7 +54,7 @@
 
     virtual sp<IAudioRecord> openRecord(
                                 pid_t pid,
-                                int streamType,
+                                int inputSource,
                                 uint32_t sampleRate,
                                 int format,
                                 int channelCount,
diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h
index b9ea0c6..aebe191 100644
--- a/include/media/mediarecorder.h
+++ b/include/media/mediarecorder.h
@@ -35,6 +35,10 @@
 enum audio_source {
     AUDIO_SOURCE_DEFAULT = 0,
     AUDIO_SOURCE_MIC = 1,
+    AUDIO_SOURCE_VOICE_UPLINK = 2,
+    AUDIO_SOURCE_VOICE_DOWNLINK = 3,
+    AUDIO_SOURCE_VOICE_CALL = 4,
+    AUDIO_SOURCE_MAX = AUDIO_SOURCE_VOICE_CALL
 };
 
 enum video_source {
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index 4b4fa5e..49b0129 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -1560,7 +1560,6 @@
 AudioFlinger::MixerThread::TrackBase::TrackBase(
             const sp<MixerThread>& mixerThread,
             const sp<Client>& client,
-            int streamType,
             uint32_t sampleRate,
             int format,
             int channelCount,
@@ -1570,7 +1569,6 @@
     :   RefBase(),
         mMixerThread(mixerThread),
         mClient(client),
-        mStreamType(streamType),
         mFrameCount(0),
         mState(IDLE),
         mClientTid(-1),
@@ -1720,12 +1718,13 @@
             int channelCount,
             int frameCount,
             const sp<IMemory>& sharedBuffer)
-    :   TrackBase(mixerThread, client, streamType, sampleRate, format, channelCount, frameCount, 0, sharedBuffer)
+    :   TrackBase(mixerThread, client, sampleRate, format, channelCount, frameCount, 0, sharedBuffer)
 {
     mVolume[0] = 1.0f;
     mVolume[1] = 1.0f;
     mMute = false;
     mSharedBuffer = sharedBuffer;
+    mStreamType = streamType;
 }
 
 AudioFlinger::MixerThread::Track::~Track()
@@ -1909,15 +1908,15 @@
 AudioFlinger::MixerThread::RecordTrack::RecordTrack(
             const sp<MixerThread>& mixerThread,
             const sp<Client>& client,
-            int streamType,
+            int inputSource,
             uint32_t sampleRate,
             int format,
             int channelCount,
             int frameCount,
             uint32_t flags)
-    :   TrackBase(mixerThread, client, streamType, sampleRate, format,
+    :   TrackBase(mixerThread, client, sampleRate, format,
                   channelCount, frameCount, flags, 0),
-        mOverflow(false)
+        mOverflow(false), mInputSource(inputSource)
 {
 }
 
@@ -2242,7 +2241,7 @@
 
 sp<IAudioRecord> AudioFlinger::openRecord(
         pid_t pid,
-        int streamType,
+        int inputSource,
         uint32_t sampleRate,
         int format,
         int channelCount,
@@ -2265,7 +2264,7 @@
         goto Exit;
     }
 
-    if (uint32_t(streamType) >= AudioRecord::NUM_STREAM_TYPES) {
+    if (uint32_t(inputSource) >= AudioRecord::NUM_INPUT_SOURCES) {
         LOGE("invalid stream type");
         lStatus = BAD_VALUE;
         goto Exit;
@@ -2308,7 +2307,7 @@
         frameCount = ((frameCount - 1)/inFrameCount + 1) * inFrameCount;
     
         // create new record track. The record track uses one track in mHardwareMixerThread by convention.
-        recordTrack = new MixerThread::RecordTrack(mHardwareMixerThread, client, streamType, sampleRate,
+        recordTrack = new MixerThread::RecordTrack(mHardwareMixerThread, client, inputSource, sampleRate,
                                                    format, channelCount, frameCount, flags);
     }
     if (recordTrack->getCblk() == NULL) {
@@ -2415,7 +2414,7 @@
                 LOGV("AudioRecordThread: loop starting");
                 if (mRecordTrack != 0) {
                     input = mAudioHardware->openInputStream(
-                                    mRecordTrack->type(),
+                                    mRecordTrack->inputSource(),
                                     mRecordTrack->format(), 
                                     mRecordTrack->channelCount(), 
                                     mRecordTrack->sampleRate(), 
diff --git a/libs/audioflinger/AudioFlinger.h b/libs/audioflinger/AudioFlinger.h
index f3e6dc1..cc3d6c2 100644
--- a/libs/audioflinger/AudioFlinger.h
+++ b/libs/audioflinger/AudioFlinger.h
@@ -139,7 +139,7 @@
     // record interface
     virtual sp<IAudioRecord> openRecord(
                                 pid_t pid,
-                                int streamType,
+                                int inputSource,
                                 uint32_t sampleRate,
                                 int format,
                                 int channelCount,
@@ -232,7 +232,6 @@
 
                                 TrackBase(const sp<MixerThread>& mixerThread,
                                         const sp<Client>& client,
-                                        int streamType,
                                         uint32_t sampleRate,
                                         int format,
                                         int channelCount,
@@ -260,10 +259,6 @@
                 return mCblk;
             }
 
-            int type() const {
-                return mStreamType;
-            }
-
             int format() const {
                 return mFormat;
             }
@@ -293,7 +288,6 @@
             sp<Client>          mClient;
             sp<IMemory>         mCblkMemory;
             audio_track_cblk_t* mCblk;
-            int                 mStreamType;
             void*               mBuffer;
             void*               mBufferEnd;
             uint32_t            mFrameCount;
@@ -328,6 +322,11 @@
                     void        mute(bool);
                     void        setVolume(float left, float right);
 
+                    int type() const {
+                        return mStreamType;
+                    }
+
+
         protected:
             friend class MixerThread;
             friend class AudioFlinger;
@@ -364,6 +363,7 @@
             int8_t              mRetryCount;
             sp<IMemory>         mSharedBuffer;
             bool                mResetDone;
+            int                 mStreamType;
         };  // end of Track
 
         // record track
@@ -371,7 +371,7 @@
         public:
                                 RecordTrack(const sp<MixerThread>& mixerThread,
                                         const sp<Client>& client,
-                                        int streamType,
+                                        int inputSource,
                                         uint32_t sampleRate,
                                         int format,
                                         int channelCount,
@@ -385,6 +385,8 @@
                     bool        overflow() { bool tmp = mOverflow; mOverflow = false; return tmp; }
                     bool        setOverflow() { bool tmp = mOverflow; mOverflow = true; return tmp; }
 
+                    int         inputSource() const { return mInputSource; }
+
         private:
             friend class AudioFlinger;
             friend class AudioFlinger::RecordHandle;
@@ -397,6 +399,7 @@
             virtual status_t getNextBuffer(AudioBufferProvider::Buffer* buffer);
 
             bool                mOverflow;
+            int                 mInputSource;
         };
 
         // playback track
diff --git a/libs/audioflinger/AudioHardwareGeneric.cpp b/libs/audioflinger/AudioHardwareGeneric.cpp
index a97c0bc..1e159b8 100644
--- a/libs/audioflinger/AudioHardwareGeneric.cpp
+++ b/libs/audioflinger/AudioHardwareGeneric.cpp
@@ -98,8 +98,8 @@
         status_t *status, AudioSystem::audio_in_acoustics acoustics)
 {
     // check for valid input source
-    if ((inputSource != AudioRecord::DEFAULT_INPUT) &&
-            (inputSource != AudioRecord::MIC_INPUT)) {
+    if ((inputSource < AudioRecord::DEFAULT_INPUT) ||
+        (inputSource >= AudioRecord::NUM_INPUT_SOURCES)) {
         return 0;
     }
 
diff --git a/libs/audioflinger/AudioHardwareStub.cpp b/libs/audioflinger/AudioHardwareStub.cpp
index c61e6e6..0ab4c60 100644
--- a/libs/audioflinger/AudioHardwareStub.cpp
+++ b/libs/audioflinger/AudioHardwareStub.cpp
@@ -61,8 +61,8 @@
         status_t *status, AudioSystem::audio_in_acoustics acoustics)
 {
     // check for valid input source
-    if ((inputSource != AudioRecord::DEFAULT_INPUT) &&
-            (inputSource != AudioRecord::MIC_INPUT)) {
+    if ((inputSource < AudioRecord::DEFAULT_INPUT) ||
+        (inputSource >= AudioRecord::NUM_INPUT_SOURCES)) {
         return 0;
     }
 
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java
index 3346bed..4d1535f9 100644
--- a/media/java/android/media/AudioRecord.java
+++ b/media/java/android/media/AudioRecord.java
@@ -88,7 +88,7 @@
     private static final int AUDIORECORD_ERROR_SETUP_ZEROFRAMECOUNT      = -16;
     private static final int AUDIORECORD_ERROR_SETUP_INVALIDCHANNELCOUNT = -17;
     private static final int AUDIORECORD_ERROR_SETUP_INVALIDFORMAT       = -18;
-    private static final int AUDIORECORD_ERROR_SETUP_INVALIDSTREAMTYPE   = -19;
+    private static final int AUDIORECORD_ERROR_SETUP_INVALIDSOURCE       = -19;
     private static final int AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED    = -20;
     
     // Events:
@@ -113,13 +113,7 @@
      */
     @SuppressWarnings("unused")
     private int mNativeRecorderInJavaObj;
-    /** 
-     * Accessed by native methods: provides access to record source constants 
-     */
-    @SuppressWarnings("unused")
-    private final static int SOURCE_DEFAULT = MediaRecorder.AudioSource.DEFAULT;
-    @SuppressWarnings("unused")
-    private final static int SOURCE_MIC = MediaRecorder.AudioSource.MIC;
+
     /** 
      * Accessed by native methods: provides access to the callback data.
      */
@@ -252,8 +246,8 @@
 
         //--------------
         // audio source
-        if ( (audioSource != MediaRecorder.AudioSource.DEFAULT)
-                && (audioSource != MediaRecorder.AudioSource.MIC) ) {
+        if ( (audioSource < MediaRecorder.AudioSource.DEFAULT) ||
+             (audioSource > MediaRecorder.getAudioSourceMax()) )  {
             throw (new IllegalArgumentException("Invalid audio source."));
         } else {
             mRecordSource = audioSource;
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 5d90e62..44f21c8 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -125,6 +125,15 @@
         public static final int DEFAULT = 0;
         /** Microphone audio source */
         public static final int MIC = 1;
+
+        /** Voice call uplink (Tx) audio source */
+        public static final int VOICE_UPLINK = 2;
+
+        /** Voice call downlink (Rx) audio source */
+        public static final int VOICE_DOWNLINK = 3;
+
+        /** Voice call uplink + downlink audio source */
+        public static final int VOICE_CALL = 4;
     }
 
     /**
@@ -203,6 +212,12 @@
             throws IllegalStateException;
 
     /**
+     * Gets the maximum value for audio sources.
+     * @see android.media.MediaRecorder.AudioSource
+     */
+    public static final int getAudioSourceMax() { return AudioSource.VOICE_CALL; }
+
+    /**
      * Sets the video source to be used for recording. If this method is not
      * called, the output file will not contain an video track. The source needs
      * to be specified before setting recording-parameters or encoders. Call
diff --git a/media/jni/android_media_MediaRecorder.cpp b/media/jni/android_media_MediaRecorder.cpp
index cac65d6..7561af1 100644
--- a/media/jni/android_media_MediaRecorder.cpp
+++ b/media/jni/android_media_MediaRecorder.cpp
@@ -177,7 +177,7 @@
 android_media_MediaRecorder_setAudioSource(JNIEnv *env, jobject thiz, jint as)
 {
     LOGV("setAudioSource(%d)", as);
-    if (as < AUDIO_SOURCE_DEFAULT || as > AUDIO_SOURCE_MIC) {
+    if (as < AUDIO_SOURCE_DEFAULT || as > AUDIO_SOURCE_MAX) {
         jniThrowException(env, "java/lang/IllegalArgumentException", "Invalid audio source");
         return;
     }
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index 793bbf4..cf0965e 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -50,7 +50,7 @@
 }
 
 AudioRecord::AudioRecord(
-        int streamType,
+        int inputSource,
         uint32_t sampleRate,
         int format,
         int channelCount,
@@ -61,7 +61,7 @@
         int notificationFrames)
     : mStatus(NO_INIT)
 {
-    mStatus = set(streamType, sampleRate, format, channelCount,
+    mStatus = set(inputSource, sampleRate, format, channelCount,
             frameCount, flags, cbf, user, notificationFrames);
 }
 
@@ -82,7 +82,7 @@
 }
 
 status_t AudioRecord::set(
-        int streamType,
+        int inputSource,
         uint32_t sampleRate,
         int format,
         int channelCount,
@@ -104,8 +104,8 @@
         return NO_INIT;
     }
 
-    if (streamType == DEFAULT_INPUT) {
-        streamType = MIC_INPUT;
+    if (inputSource == DEFAULT_INPUT) {
+        inputSource = MIC_INPUT;
     }
 
     if (sampleRate == 0) {
@@ -157,7 +157,7 @@
 
     // open record channel
     status_t status;
-    sp<IAudioRecord> record = audioFlinger->openRecord(getpid(), streamType,
+    sp<IAudioRecord> record = audioFlinger->openRecord(getpid(), inputSource,
                                                        sampleRate, format,
                                                        channelCount,
                                                        frameCount,
@@ -201,6 +201,7 @@
     mMarkerReached = false;
     mNewPosition = 0;
     mUpdatePeriod = 0;
+    mInputSource = (uint8_t)inputSource;
 
     return NO_ERROR;
 }
@@ -242,6 +243,11 @@
     return channelCount()*((format() == AudioSystem::PCM_8_BIT) ? sizeof(uint8_t) : sizeof(int16_t));
 }
 
+int AudioRecord::inputSource() const
+{
+    return (int)mInputSource;
+}
+
 // -------------------------------------------------------------------------
 
 status_t AudioRecord::start()
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index 7395885..09f1c36 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -99,7 +99,7 @@
 
     virtual sp<IAudioRecord> openRecord(
                                 pid_t pid,
-                                int streamType,
+                                int inputSource,
                                 uint32_t sampleRate,
                                 int format,
                                 int channelCount,
@@ -110,7 +110,7 @@
         Parcel data, reply;
         data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
         data.writeInt32(pid);
-        data.writeInt32(streamType);
+        data.writeInt32(inputSource);
         data.writeInt32(sampleRate);
         data.writeInt32(format);
         data.writeInt32(channelCount);
@@ -384,14 +384,14 @@
         case OPEN_RECORD: {
             CHECK_INTERFACE(IAudioFlinger, data, reply);
             pid_t pid = data.readInt32();
-            int streamType = data.readInt32();
+            int inputSource = data.readInt32();
             uint32_t sampleRate = data.readInt32();
             int format = data.readInt32();
             int channelCount = data.readInt32();
             size_t bufferCount = data.readInt32();
             uint32_t flags = data.readInt32();
             status_t status;
-            sp<IAudioRecord> record = openRecord(pid, streamType,
+            sp<IAudioRecord> record = openRecord(pid, inputSource,
                     sampleRate, format, channelCount, bufferCount, flags, &status);
             reply->writeInt32(status);
             reply->writeStrongBinder(record->asBinder());