From 046d5c37ae18857c726145b1cd3545a69f8dd033 Mon Sep 17 00:00:00 2001 From: himta ram Date: Thu, 10 Jan 2019 15:42:34 +0530 Subject: FM: Ignore VOLUME_CHANGED_ACTION intent when fm is turned off. - when fm is turned off and fm app is running then if VOLUME_CHANGED_ACTION intent comes, no need to apply changed fm volume - set default FM OutPut Device to WiredHeadset CRs-Fixed: 2374389 Change-Id: I8fccb09eab41f0007157b34af41d654a41a891da --- fmapp2/src/com/caf/fmradio/FMRadioService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java index 8faa313..9b8647d 100644 --- a/fmapp2/src/com/caf/fmradio/FMRadioService.java +++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java @@ -143,7 +143,7 @@ public class FMRadioService extends Service private boolean mServiceInUse = false; private static boolean mMuted = false; private static boolean mResumeAfterCall = false; - private static int mAudioDevice = 0; + private static int mAudioDevice = AudioDeviceInfo.TYPE_WIRED_HEADPHONES; MediaRecorder mRecorder = null; MediaRecorder mA2dp = null; private boolean mFMOn = false; @@ -584,6 +584,10 @@ public class FMRadioService extends Service stopRecording(); } } else if( action.equals(AudioManager.VOLUME_CHANGED_ACTION)) { + if(!isFmOn()) { + Log.d(LOGTAG, "FM is Turned off ,not applying the changed volume"); + return; + } int streamType = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, -1); if (streamType == AudioManager.STREAM_MUSIC) { -- cgit v1.2.3