FM: Fix the FM recording stopped when AUDIOFOCUS_LOSS_TRANSIENT received
- When FM Service receives AUDIOFOCUS_LOSS_TRANSIENT or
AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK FM recording is stopped.
- As the FM SOC is power ON state, FM recording can continue.
Change-Id: I552d60b55c56ad0ea26cc684addbc442a60b2ac8
CRs-Fixed: 638761
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index a218893..1143eaf 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -1138,11 +1138,26 @@
switch (msg.arg1) {
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK");
+ case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
+ Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS_TRANSIENT");
+ if (mSpeakerPhoneOn) {
+ mSpeakerDisableHandler.removeCallbacks(mSpeakerDisableTask);
+ mSpeakerDisableHandler.postDelayed(mSpeakerDisableTask, 0);
+ }
+ if (true == mPlaybackInProgress) {
+ if(mMuted)
+ unMute();
+ stopFM();
+ }
+ if (mSpeakerPhoneOn) {
+ if (isAnalogModeSupported())
+ setAudioPath(false);
+ }
+ mStoppedOnFocusLoss = true;
+ break;
case AudioManager.AUDIOFOCUS_LOSS:
Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS");
//intentional fall through.
- case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
- Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS_TRANSIENT");
if (true == isFmRecordingOn())
stopRecording();
if (mSpeakerPhoneOn) {