Mass merge from gingerbread - do not merge

Change-Id: I45dc3596bf4211d8f91c64f2d1d00588878df629
diff --git a/media/libmedia/Visualizer.cpp b/media/libmedia/Visualizer.cpp
index a660429..43571cf 100644
--- a/media/libmedia/Visualizer.cpp
+++ b/media/libmedia/Visualizer.cpp
@@ -219,8 +219,13 @@
     }
 
     for (uint32_t i = 0; i < mCaptureSize; i += 2) {
-        fft[i] = workspace[i >> 1] >> 24;
-        fft[i + 1] = workspace[i >> 1] >> 8;
+        short tmp = workspace[i >> 1] >> 21;
+        while (tmp > 127 || tmp < -128) tmp >>= 1;
+        fft[i] = tmp;
+        tmp = workspace[i >> 1];
+        tmp >>= 5;
+        while (tmp > 127 || tmp < -128) tmp >>= 1;
+        fft[i + 1] = tmp;
     }
 
     return NO_ERROR;
diff --git a/services/audioflinger/AudioPolicyManagerBase.cpp b/services/audioflinger/AudioPolicyManagerBase.cpp
index e4086c4..2c81c34 100644
--- a/services/audioflinger/AudioPolicyManagerBase.cpp
+++ b/services/audioflinger/AudioPolicyManagerBase.cpp
@@ -1835,7 +1835,8 @@
         AudioSystem::DEVICE_OUT_WIRED_HEADPHONE |
         AudioSystem::DEVICE_OUT_ANLG_DOCK_HEADSET |
         AudioSystem::DEVICE_OUT_DGTL_DOCK_HEADSET)) &&
-        (getStrategy((AudioSystem::stream_type)stream) == STRATEGY_SONIFICATION) &&
+        ((getStrategy((AudioSystem::stream_type)stream) == STRATEGY_SONIFICATION) ||
+         (stream == AudioSystem::SYSTEM)) &&
         streamDesc.mCanBeMuted) {
         volume *= SONIFICATION_HEADSET_VOLUME_FACTOR;
         // when the phone is ringing we must consider that music could have been paused just before