Merge 1e6791a5f681b4abfe6e7bd0de5f038956c35764 on remote branch
Change-Id: I8e318eea3f3017531c3faa41a389885f7fcf75fb
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 884f255..ce39f38 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -288,7 +288,16 @@
getA2dpStatusAtStart();
mGainFocusReq = requestAudioFocus();
-
+ AudioManager mAudioManager =
+ (AudioManager) getSystemService(Context.AUDIO_SERVICE);
+ AudioDeviceInfo[] deviceList = mAudioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS);
+ for (int index = 0; index < deviceList.length; index++) {
+ if ((deviceList[index].getType() == AudioDeviceInfo.TYPE_WIRED_HEADSET ) ||
+ (deviceList[index].getType() == AudioDeviceInfo.TYPE_WIRED_HEADPHONES )){
+ mHeadsetPlugged = true;
+ break;
+ }
+ }
}
@Override