Fix issue 2192181: AudioFlinger must provide separated methods to set VOICE_CALL stream volume and down link audio volume.

Added setVoiceVolume() method to AudioSystem, AudioFlinger, IAudioFlinger, AudioPolicyService.
Removed call to AudioHardwareInterface::setVoiceVolume() from AudioFlinger::setStreamVolume().
diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h
index 57f8102..a7c8a0a 100644
--- a/include/media/AudioSystem.h
+++ b/include/media/AudioSystem.h
@@ -220,6 +220,7 @@
     static status_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount,
         size_t* buffSize);
 
+    static status_t setVoiceVolume(float volume);
 
     //
     // AudioPolicyService interface
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index 8018568..a46c727 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -102,10 +102,10 @@
 
     virtual     status_t    setParameters(int ioHandle, const String8& keyValuePairs) = 0;
     virtual     String8     getParameters(int ioHandle, const String8& keys) = 0;
-    
+
     // register a current process for audio output change notifications
     virtual void registerClient(const sp<IAudioFlingerClient>& client) = 0;
-    
+
     // retrieve the audio recording buffer size
     virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount) = 0;
 
@@ -128,6 +128,8 @@
     virtual status_t closeInput(int input) = 0;
 
     virtual status_t setStreamOutput(uint32_t stream, int output) = 0;
+
+    virtual status_t setVoiceVolume(float volume) = 0;
 };
 
 
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index bd1b2d7..5352234 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -335,6 +335,13 @@
     return NO_ERROR;
 }
 
+status_t AudioSystem::setVoiceVolume(float value)
+{
+    const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
+    if (af == 0) return PERMISSION_DENIED;
+    return af->setVoiceVolume(value);
+}
+
 // ---------------------------------------------------------------------------
 
 void AudioSystem::AudioFlingerClient::binderDied(const wp<IBinder>& who) {
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index 5089157..0eff205 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -59,7 +59,8 @@
     RESTORE_OUTPUT,
     OPEN_INPUT,
     CLOSE_INPUT,
-    SET_STREAM_OUTPUT
+    SET_STREAM_OUTPUT,
+    SET_VOICE_VOLUME
 };
 
 class BpAudioFlinger : public BpInterface<IAudioFlinger>
@@ -455,6 +456,15 @@
         remote()->transact(SET_STREAM_OUTPUT, data, &reply);
         return reply.readInt32();
     }
+
+    virtual status_t setVoiceVolume(float volume)
+    {
+        Parcel data, reply;
+        data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
+        data.writeFloat(volume);
+        remote()->transact(SET_VOICE_VOLUME, data, &reply);
+        return reply.readInt32();
+    }
 };
 
 IMPLEMENT_META_INTERFACE(AudioFlinger, "android.media.IAudioFlinger");
@@ -700,6 +710,12 @@
             reply->writeInt32(setStreamOutput(stream, output));
             return NO_ERROR;
         } break;
+        case SET_VOICE_VOLUME: {
+            CHECK_INTERFACE(IAudioFlinger, data, reply);
+            float volume = data.readFloat();
+            reply->writeInt32( setVoiceVolume(volume) );
+            return NO_ERROR;
+        } break;
         default:
             return BBinder::onTransact(code, data, reply, flags);
     }