Merge "Add search list complete callback" into fm.lnx.2.1-dev
diff --git a/fm_hci/fm_hci.c b/fm_hci/fm_hci.c
index 2fafe83..a3666af 100644
--- a/fm_hci/fm_hci.c
+++ b/fm_hci/fm_hci.c
@@ -57,6 +57,7 @@
#define WAIT_TIMEOUT 200000 /* 200*1000us */
static void fm_hci_exit(void *arg);
+static int power(struct fm_hci_t *hci, fm_power_state_t state);
static void event_notification(struct fm_hci_t *hci, uint16_t event)
{
@@ -178,7 +179,7 @@
{
fd_set readFds;
sigset_t sigmask, emptymask;
- int n = 0, ret = -1, evt_len = -1;
+ int n = 0, ret = -1, evt_len = -1,status=0;
volatile int fd = hci->fd;
struct sigaction action;
@@ -230,6 +231,10 @@
ALOGI("%s: FM H/w Err Event Recvd. Event Code: 0x%2x", __func__, pbuf->evt_code);
lib_running =0;
hci->vendor->ssr_cleanup(0x22);
+ status = power(hci, FM_RADIO_DISABLE);
+ if (status < 0) {
+ ALOGE("power off fm radio failed during SSR ");
+ }
} else {
ALOGE("%s: Not CS/CC Event: Recvd. Event Code: 0x%2x", __func__, pbuf->evt_code);
}
diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java
index 43fd2ef..7d357f7 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadio.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadio.java
@@ -439,7 +439,7 @@
public void onRestart() {
Log.d(LOGTAG, "FMRadio: onRestart");
try {
- if (null != mService) {
+ if (null != mService && isAntennaAvailable()) {
mService.requestFocus();
}
} catch (Exception e) {
@@ -505,6 +505,9 @@
super.onResume();
+ if (!isAntennaAvailable()) {
+ return;
+ }
// TODO: We should return on exception or continue?
try {
if (mService != null)
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 2b9fb83..43e91a6 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -1604,8 +1604,6 @@
case AudioManager.AUDIOFOCUS_LOSS:
Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS");
//intentional fall through.
- if (true == isFmRecordingOn())
- stopRecording();
if (mSpeakerPhoneOn) {
mSpeakerDisableHandler.removeCallbacks(mSpeakerDisableTask);
mSpeakerDisableHandler.postDelayed(mSpeakerDisableTask, 0);
@@ -1613,6 +1611,9 @@
if (true == mPlaybackInProgress) {
stopFM();
}
+ if (true == isFmRecordingOn())
+ stopRecording();
+
if (mSpeakerPhoneOn) {
if (isAnalogModeSupported())
setAudioPath(false);
@@ -2247,6 +2248,17 @@
* Turn OFF FM Operations: This disables all the current FM operations .
*/
private void fmOperationsOff() {
+ // disable audio path
+ AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
+ if(audioManager != null)
+ {
+ Log.d(LOGTAG, "audioManager.setFmRadioOn = false \n" );
+ stopFM();
+ unMute();
+ audioManager.abandonAudioFocus(mAudioFocusListener);
+ //audioManager.setParameters("FMRadioOn=false");
+ Log.d(LOGTAG, "audioManager.setFmRadioOn false done \n" );
+ }
// stop recording
if (isFmRecordingOn())
{
@@ -2258,17 +2270,6 @@
return;
}
}
- // disable audio path
- AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
- if(audioManager != null)
- {
- Log.d(LOGTAG, "audioManager.setFmRadioOn = false \n" );
- stopFM();
- unMute();
- audioManager.abandonAudioFocus(mAudioFocusListener);
- //audioManager.setParameters("FMRadioOn=false");
- Log.d(LOGTAG, "audioManager.setFmRadioOn false done \n" );
- }
// reset FM audio settings
resetAudioRoute();
@@ -2281,6 +2282,7 @@
}
}
+
/*
* Reset (OFF) FM Operations: This resets all the current FM operations .
*/