From 67f115c04967238c869ce2f5029302a1f960f30c Mon Sep 17 00:00:00 2001
From: Mingbo Zhang <mingboz@codeaurora.org>
Date: Wed, 27 Jul 2016 13:56:26 +0800
Subject: [PATCH] Fix: Can't control Alarm/Ring volume after plugout headset
 and a2dp

1) wired headset is plugin, a2dp is connected, fm is on =>
2) plugout wired headset, then disconnect a2dp =>
3) will not control alarm/ring volume via +/- button
reason: after plugout wired headset, then disconnect a2dp at last,
configureAudioDataPath(true) will be called and AudioSystem.DEVICE_OUT_FM
will be set to DEVICE_STATE_AVAILABLE. Then we can only control
media volume via +/- button.

Change-Id: Ic9b0bad141a8d5d88e6b9b93350a5b02961b91db
CRs-Fixed: 1047328
---
 fmapp2/src/com/caf/fmradio/FMRadioService.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 9546cd3..2b9fb83 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -652,7 +652,8 @@ public class FMRadioService extends Service
                             mA2dpDisconnected = false;
                             mA2dpConnected = true;
                         }
-                        configureAudioDataPath(true);
+                        if (isFmOn())
+                            configureAudioDataPath(true);
                     } else if (action.equals("HDMI_CONNECTED")) {
                         //FM should be off when HDMI is connected.
                         fmOff();
-- 
GitLab