FM: synchronization of rssi or sinr contiguous commands

Change-Id: Ifdf0ca3621535ca8ce4d76b6b85708cf46ef455f
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 879678d..b855197 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -3676,6 +3676,12 @@
           if (mCallbacks != null) {
               try {
                   mCallbacks.getStationParamCb(val, status);
+                  if (mReceiver != null && mReceiver.isCherokeeChip()) {
+                      synchronized(mEventWaitLock) {
+                          mEventReceived = true;
+                          mEventWaitLock.notify();
+                      }
+                  }
               } catch (RemoteException e) {
                   e.printStackTrace();
               }
@@ -3909,9 +3915,12 @@
       return frequencyString;
    }
    public int getRssi() {
-      if (mReceiver != null)
-          return mReceiver.getRssi();
-      else
+      if (mReceiver != null) {
+          mEventReceived = false;
+          int rssi = mReceiver.getRssi();
+          waitForFWEvent();
+          return rssi;
+      } else
           return Integer.MAX_VALUE;
    }
    public int getIoC() {
@@ -3937,9 +3946,12 @@
           mReceiver.setHiLoInj(inj);
    }
    public int getSINR() {
-      if (mReceiver != null)
-          return mReceiver.getSINR();
-      else
+      if (mReceiver != null) {
+          mEventReceived = false;
+          int sinr = mReceiver.getSINR();;
+          waitForFWEvent();
+          return sinr;
+      } else
           return Integer.MAX_VALUE;
    }
    public boolean setSinrSamplesCnt(int samplesCnt) {
diff --git a/helium/radio_helium_hal.c b/helium/radio_helium_hal.c
index b7951f3..1480b72 100644
--- a/helium/radio_helium_hal.c
+++ b/helium/radio_helium_hal.c
@@ -418,8 +418,8 @@
     }
     ALOGE("hci_cc_station_rsp: val =%x, status = %x", val, status);
 
-    hal->jni_cb->fm_get_station_param_cb(val, status);
     clear_all_bit(station_param_mask_flag);
+    hal->jni_cb->fm_get_station_param_cb(val, status);
 }
 
 static void hci_cc_dbg_param_rsp(char *ev_buff)