Fix issue 3436738.

The problem is that the AudioPolicyManager refreshes the device attached to the
hardware output stream every time another output stops (in this case A2DP output).
As there is no active stream on the HW output, the selected device is 0.
As the shutter sound is short and there is some additional delay to setup the A2DP output,
the sound is not yet out of the AudioFlinger mixer when the device is set to 0.
On Crespo, device 0 is a valid audio path (means audio off) which is not the case
on other platforms and therefore the output is disabled while the shutter sound
is actually playing.

The fix consists in ignoring requests to set the output device to 0 in the audio HAL.

Change-Id: I7366e359a7d3a0f8207e7a5c879ced9078224002
diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp
index 99c38fa..45f0a2d 100644
--- a/libaudio/AudioHardware.cpp
+++ b/libaudio/AudioHardware.cpp
@@ -1241,16 +1241,18 @@
 
         if (param.getInt(String8(AudioParameter::keyRouting), device) == NO_ERROR)
         {
-            AutoMutex hwLock(mHardware->lock());
+            if (device != 0) {
+                AutoMutex hwLock(mHardware->lock());
 
-            if (mDevices != (uint32_t)device) {
-                mDevices = (uint32_t)device;
-                if (mHardware->mode() != AudioSystem::MODE_IN_CALL) {
-                    doStandby_l();
+                if (mDevices != (uint32_t)device) {
+                    mDevices = (uint32_t)device;
+                    if (mHardware->mode() != AudioSystem::MODE_IN_CALL) {
+                        doStandby_l();
+                    }
                 }
-            }
-            if (mHardware->mode() == AudioSystem::MODE_IN_CALL) {
-                mHardware->setIncallPath_l(device);
+                if (mHardware->mode() == AudioSystem::MODE_IN_CALL) {
+                    mHardware->setIncallPath_l(device);
+                }
             }
             param.remove(String8(AudioParameter::keyRouting));
         }