fmapp2: tell audio stack about FM being active
This was present in earlier versions on the app, and is needed for the
qcom policy hal to manage it correctly.
Issue: FP2P-632
Change-Id: I01d3f9164495f1bce89462041b5e1f1793355044
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 43a9f55..9d18a3a 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -420,6 +420,9 @@
mAudioDeviceType = mAudioDevice | AudioSystem.DEVICE_OUT_FM;
int mCurrentVolumeIndex = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
setFMVolume(mCurrentVolumeIndex);
+
+ AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_FM,
+ AudioSystem.DEVICE_STATE_AVAILABLE, "", "");
} else if (mIsFMDeviceLoopbackActive == false) {
Log.d(LOGTAG, "no devcie loop back is active, not disabling the audio");
return false;
@@ -427,6 +430,9 @@
/*disabling the fm audio*/
mIsFMDeviceLoopbackActive = false;
mAudioDeviceType = mAudioDevice;
+
+ AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_FM,
+ AudioSystem.DEVICE_STATE_UNAVAILABLE, "", "");
}
String keyValPairs = new String("handle_fm="+mAudioDeviceType);
Log.d(LOGTAG, "keyValPairs = "+keyValPairs);