Fix issue #1324: No audible call-waiting indication when in-call volume
is low

http://code.google.com/p/android/issues/detail?id=1324
Re-base the internally generated in-call audio volume so that it is
never muted, which is already the case for the hardware routed in-call
audio.
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index c330bc8..918b01f 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -800,13 +800,21 @@
         return BAD_VALUE;
     }
 
-    mStreamTypes[stream].volume = value;
     status_t ret = NO_ERROR;
     if (stream == AudioTrack::VOICE_CALL) {
         AutoMutex lock(mHardwareLock);
         mHardwareStatus = AUDIO_SET_VOICE_VOLUME;
         ret = mAudioHardware->setVoiceVolume(value);
         mHardwareStatus = AUDIO_HW_IDLE;
+        // FIXME: This is a temporary fix to re-base the internally
+        // generated in-call audio so that it is never muted, which is
+        // already the case for the hardware routed in-call audio.
+        // When audio stream handling is reworked, this should be
+        // addressed more cleanly.  Fixes #1324; see discussion at
+        // http://review.source.android.com/8224
+        mStreamTypes[stream].volume = value * (1.0 - 1.0 / 6.0) + (1.0 / 6.0);
+    } else {
+        mStreamTypes[stream].volume = value;
     }
     return ret;
 }
@@ -830,6 +838,11 @@
     if (uint32_t(stream) >= AudioTrack::NUM_STREAM_TYPES) {
         return 0.0f;
     }
+    if (stream == AudioTrack::VOICE_CALL) {
+        // FIXME: Re-base internally generated in-call audio,
+        // reverse of above in setStreamVolume.
+        return (mStreamTypes[stream].volume - (1.0 / 6.0)) / (1.0 - 1.0 / 6.0);
+    }
     return mStreamTypes[stream].volume;
 }