FM audio config sequence during FM radio ON/OFF
call audio config changes and allow some delay for slimbus
close before turning off FM chip,adds delay after enable FM
chip before calling audio config changes to start FM audio.
Change-Id: I563bbad9edee92247b3514612fe7b94838d32525
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 54654fa..5744d96 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -1104,6 +1104,7 @@
private void resetFM(){
Log.d(LOGTAG, "resetFM");
mPlaybackInProgress = false;
+ configureAudioDataPath(false);
}
private boolean getRecordServiceStatus() {
@@ -2315,12 +2316,7 @@
}
}
- /*
- * Turn OFF FM: Disable the FM Host and hardware .
- * .
- * @return true if fm Disable api was invoked successfully, false if the api failed.
- */
- private boolean fmOff() {
+ private boolean fmOffImpl() {
boolean bStatus=false;
// This will disable the FM radio device
@@ -2346,9 +2342,60 @@
}
fmOperationsOff();
stop();
+
return(bStatus);
}
+ private boolean fmOffImplCherokee() {
+ boolean bStatus=false;
+
+ fmOperationsOff();
+ stop();
+ try {
+ Thread.sleep(200);
+ } catch (Exception ex) {
+ Log.d( LOGTAG, "RunningThread InterruptedException");
+ }
+
+ // This will disable the FM radio device
+ if (mReceiver != null)
+ {
+ bStatus = mReceiver.disable(this);
+ if (bStatus &&
+ (mReceiver.getFMState() == mReceiver.subPwrLevel_FMTurning_Off)) {
+ synchronized (mEventWaitLock) {
+ Log.d(LOGTAG, "waiting for disable event");
+ try {
+ mEventWaitLock.wait(RADIO_TIMEOUT);
+ } catch (IllegalMonitorStateException e) {
+ Log.e(LOGTAG, "Exception caught while waiting for event");
+ e.printStackTrace();
+ } catch (InterruptedException ex) {
+ Log.e(LOGTAG, "Exception caught while waiting for event");
+ ex.printStackTrace();
+ }
+ }
+ }
+ mReceiver = null;
+ }
+ return(bStatus);
+ }
+ /*
+ * Turn OFF FM: Disable the FM Host and hardware .
+ * .
+ * @return true if fm Disable api was invoked successfully, false if the api failed.
+ */
+ private boolean fmOff() {
+ if (mReceiver != null) {
+ if (mReceiver.isCherokeeChip()) {
+ return fmOffImplCherokee();
+ } else {
+ return fmOffImpl();
+ }
+ }
+ return false;
+ }
+
private boolean fmOff(int off_from) {
if (off_from == FM_OFF_FROM_APPLICATION || off_from == FM_OFF_FROM_ANTENNA) {
Log.d(LOGTAG, "FM application close button pressed or antenna removed");