Revert "FM: Wait to be completely closed before processing next start"
This reverts commit 43a4f71274fca4bbe0915e6990d7dd3fe249bd0d.
Change-Id: Id21676336b73b613d16e8e2b8a100f7148265aba
diff --git a/qcom/fmradio/FmReceiver.java b/qcom/fmradio/FmReceiver.java
index 7d6ab0d..5ba27c8 100644
--- a/qcom/fmradio/FmReceiver.java
+++ b/qcom/fmradio/FmReceiver.java
@@ -41,7 +41,6 @@
import android.net.wifi.WifiManager;
import android.content.IntentFilter;
import android.bluetooth.BluetoothAdapter;
-import java.lang.Object;
/**
* This class contains all interfaces and types needed to
@@ -440,8 +439,6 @@
}
}
};
- private volatile int mState;
- public static Object mLockObject = new Object();
/**
* Constructor for the receiver Object
@@ -449,7 +446,7 @@
public FmReceiver(){
mControl = new FmRxControls();
mRdsData = new FmRxRdsData (sFd);
- mRxEvents = new FmRxEventListner(this);
+ mRxEvents = new FmRxEventListner();
}
/**
@@ -464,7 +461,7 @@
public FmReceiver(String devicePath,
FmRxEvCallbacksAdaptor callback) throws InstantiationException {
mControl = new FmRxControls();
- mRxEvents = new FmRxEventListner(this);
+ mRxEvents = new FmRxEventListner();
Log.e(TAG, "FmReceiver constructor");
//registerClient(callback);
@@ -579,32 +576,22 @@
* Check for FM State.
* If FMRx already on, then return.
*/
-
- int mState = getFMState();
+ int state = getFMState();
mIntentFilter = new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION);
mBtIntentFilter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
- if (mState == FMState_Rx_Turned_On || mState == FMState_Srch_InProg) {
-
+ if (state == FMState_Rx_Turned_On || state == FMState_Srch_InProg) {
Log.d(TAG, "enable: FM already turned On and running");
return status;
- }else if (mState == subPwrLevel_FMTurning_Off) {
+ }else if (state == subPwrLevel_FMTurning_Off) {
Log.v(TAG, "FM is in the process of turning off.Pls wait for sometime.");
- synchronized(mLockObject){
- try {
- if (getFMState() != FMState_Turned_Off) {
- mLockObject.wait();
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "Error in waiting on mLockObject" + e);
- }
- }
- }else if (mState == subPwrLevel_FMRx_Starting) {
+ return status;
+ }else if (state == subPwrLevel_FMRx_Starting) {
Log.v(TAG, "FM is in the process of turning On.Pls wait for sometime.");
return status;
- }else if ((mState == FMState_Tx_Turned_On)
- || (mState == subPwrLevel_FMTx_Starting)) {
+ }else if ((state == FMState_Tx_Turned_On)
+ || (state == subPwrLevel_FMTx_Starting)) {
Log.v(TAG, "FM Tx is turned on or in the process of turning on.");
return status;
}
diff --git a/qcom/fmradio/FmRxEventListner.java b/qcom/fmradio/FmRxEventListner.java
index 9c9bba2..0ad7c0c 100644
--- a/qcom/fmradio/FmRxEventListner.java
+++ b/qcom/fmradio/FmRxEventListner.java
@@ -59,13 +59,8 @@
}
private Thread mThread;
- private FmReceiver mReceiver;
private static final String TAG = "FMRadio";
- public FmRxEventListner(FmReceiver receiver) {
- mReceiver = receiver;
- }
-
public void startListner (final int fd, final FmRxEvCallbacks cb) {
/* start a thread and listen for messages */
mThread = new Thread(){
@@ -218,14 +213,11 @@
case 18:
Log.d(TAG, "Got RADIO_DISABLED");
if (FmTransceiver.getFMPowerState() == FmTransceiver.subPwrLevel_FMTurning_Off) {
- synchronized(FmReceiver.mLockObject) {
- FmTransceiver.release("/dev/radio0");
- cb.FmRxEvDisableReceiver();
- /*Set the state as FMOff */
- FmTransceiver.setFMPowerState(FmTransceiver.FMState_Turned_Off);
- Log.v(TAG, "RxEvtList: CURRENT-STATE : FMTurningOff ---> NEW-STATE : FMOff");
- FmReceiver.mLockObject.notify();
- }
+ FmTransceiver.release("/dev/radio0");
+ cb.FmRxEvDisableReceiver();
+ /*Set the state as FMOff */
+ FmTransceiver.setFMPowerState(FmTransceiver.FMState_Turned_Off);
+ Log.v(TAG, "RxEvtList: CURRENT-STATE : FMTurningOff ---> NEW-STATE : FMOff");
Thread.currentThread().interrupt();
} else {
Log.d(TAG, "Unexpected RADIO_DISABLED recvd");