Merge "CameraService: Notify flashlight about device close" into nyc-mr1-dev
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index 4cde70d..e3e518c 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -1733,9 +1733,11 @@
 // resetVolume_l() must be called with PlaybackThread::mLock or EffectChain::mLock held
 void AudioFlinger::EffectChain::resetVolume_l()
 {
-    uint32_t left = mLeftVolume;
-    uint32_t right = mRightVolume;
-    (void)setVolume_l(&left, &right, true);
+    if ((mLeftVolume != UINT_MAX) && (mRightVolume != UINT_MAX)) {
+        uint32_t left = mLeftVolume;
+        uint32_t right = mRightVolume;
+        (void)setVolume_l(&left, &right, true);
+    }
 }
 
 void AudioFlinger::EffectChain::syncHalEffectsState()
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index c0bb4e7..b752541 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -273,6 +273,9 @@
         }
 
         closeAllInputs();
+        // As the input device list can impact the output device selection, update
+        // getDeviceForStrategy() cache
+        updateDevicesAndOutputs();
 
         if (mEngine->getPhoneState() == AUDIO_MODE_IN_CALL && hasPrimaryOutput()) {
             audio_devices_t newDevice = getNewOutputDevice(mPrimaryOutput, false /*fromCache*/);