From faef7cd61012645916a15f0e0e73a3301eab0311 Mon Sep 17 00:00:00 2001
From: Satish kumar sugasi <ssugas@codeaurora.org>
Date: Tue, 8 Nov 2016 14:24:33 -0800
Subject: [PATCH] Add checks to listen for A2dp state changes

skip registering listener for BT a2dp connection state changes
to avoid FM over A2DP specific to particular SOC type.

Change-Id: I748d8432ffdc875e7efd0064018ac9d95b907600
---
 fmapp2/src/com/caf/fmradio/FMRadioService.java | 5 ++++-
 helium/radio_helium_hal.c                      | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 43e91a6..54654fa 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -608,6 +608,7 @@ public class FMRadioService extends Service
      */
     public void registerHeadsetListener() {
         if (mHeadsetReceiver == null) {
+            boolean fm_a2dp_disabled = SystemProperties.getBoolean("fm.a2dp.conc.disabled",true);
             mHeadsetReceiver = new BroadcastReceiver() {
                 @Override
                 public void onReceive(Context context, Intent intent) {
@@ -682,7 +683,9 @@ public class FMRadioService extends Service
             AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
             IntentFilter iFilter = new IntentFilter();
             iFilter.addAction(Intent.ACTION_HEADSET_PLUG);
-            iFilter.addAction(mA2dpDeviceState.getActionSinkStateChangedString());
+            if (!fm_a2dp_disabled) {
+                iFilter.addAction(mA2dpDeviceState.getActionSinkStateChangedString());
+            }
             iFilter.addAction("HDMI_CONNECTED");
             iFilter.addAction(Intent.ACTION_SHUTDOWN);
             iFilter.addCategory(Intent.CATEGORY_DEFAULT);
diff --git a/helium/radio_helium_hal.c b/helium/radio_helium_hal.c
index 3f68812..3fa4587 100644
--- a/helium/radio_helium_hal.c
+++ b/helium/radio_helium_hal.c
@@ -623,7 +623,7 @@ static inline void hci_ev_program_service(char *buff)
 
     memcpy(data+RDS_OFFSET, &buff[RDS_PS_DATA_OFFSET], len-RDS_OFFSET);
 
-    ALOGE("SSK call ps-callback");
+    ALOGV("call ps-callback");
     hal->jni_cb->ps_update_cb(data);
 
     free(data);
-- 
GitLab