From e4643d19aff6978f05b0050758ec38b3b9c53f3e Mon Sep 17 00:00:00 2001
From: Venkateshwarlu Domakonda <vdomak@codeaurora.org>
Date: Tue, 6 Oct 2015 11:43:38 +0530
Subject: [PATCH] FM: Add headset check

FM is turning ON even without WHS for AVRCP commands.
Added headset check before turning ON FM.

Change-Id: I0c0f1c0976ab19a89232a1de6ec4d999a3226fd1
CRs-Fixed: 918891
---
 fmapp2/src/com/caf/fmradio/FMRadioService.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 02dd4ad..35e7e24 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -932,7 +932,7 @@ public class FMRadioService extends Service
            } catch (RemoteException e) {
                 e.printStackTrace();
            }
-       } else if( mServiceInUse ) {
+       } else if(isAntennaAvailable() && mServiceInUse ) {
            fmOn();
            try {
                 if (mCallbacks != null ) {
@@ -974,7 +974,7 @@ public class FMRadioService extends Service
             } else if((event != null) && (event.getKeyCode() == KeyEvent.KEYCODE_MEDIA_PLAY)
                        && (key_action == KeyEvent.ACTION_DOWN)) {
                 Log.d(LOGTAG, "SessionCallback: MEDIA_PLAY");
-                if (mServiceInUse ) {
+                if (isAntennaAvailable() && mServiceInUse) {
                     fmOn();
                     try {
                         if (mCallbacks != null ) {
-- 
GitLab