Merge "Add checks to listen for A2dp state changes" into fm.lnx.2.1-dev
diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp
index 9e469ed..b5b0a5e 100644
--- a/jni/android_hardware_fm.cpp
+++ b/jni/android_hardware_fm.cpp
@@ -194,7 +194,16 @@
void fm_srch_list_cb(uint16_t *scan_tbl)
{
ALOGI("SRCH_LIST");
- //mCallbackEnv->CallVoidMethod(javaObjectRef, method_srchListCallback);
+ jbyteArray srch_buffer = NULL;
+
+ srch_buffer = mCallbackEnv->NewByteArray(STD_BUF_SIZE);
+ if (srch_buffer == NULL) {
+ ALOGE(" af list allocate failed :");
+ return;
+ }
+ mCallbackEnv->SetByteArrayRegion(srch_buffer, 0, STD_BUF_SIZE, (jbyte *)scan_tbl);
+ mCallbackEnv->CallVoidMethod(mCallbacksObj, method_srchListCallback, srch_buffer);
+ mCallbackEnv->DeleteLocalRef(srch_buffer);
}
void fm_stereo_status_cb(bool stereo)
@@ -1519,7 +1528,7 @@
method_tuneCallback = env->GetMethodID(javaClassRef, "tuneCallback", "(I)V");
method_seekCmplCallback = env->GetMethodID(javaClassRef, "seekCmplCallback", "(I)V");
method_scanNxtCallback = env->GetMethodID(javaClassRef, "scanNxtCallback", "()V");
- //method_srchListCallback = env->GetMethodID(javaClassRef, "srchListCallback", "([B)V");
+ method_srchListCallback = env->GetMethodID(javaClassRef, "srchListCallback", "([B)V");
method_stereostsCallback = env->GetMethodID(javaClassRef, "stereostsCallback", "(Z)V");
method_rdsAvlStsCallback = env->GetMethodID(javaClassRef, "rdsAvlStsCallback", "(Z)V");
method_disableCallback = env->GetMethodID(javaClassRef, "disableCallback", "()V");
diff --git a/qcom/fmradio/FmReceiverJNI.java b/qcom/fmradio/FmReceiverJNI.java
index e587b44..c5835ff 100644
--- a/qcom/fmradio/FmReceiverJNI.java
+++ b/qcom/fmradio/FmReceiverJNI.java
@@ -193,7 +193,6 @@
public void tuneCallback(int freq) {
int state;
-
Log.d(TAG, "tuneCallback enter");
state = FmReceiver.getSearchState();
switch(state) {
@@ -222,7 +221,7 @@
Log.d(TAG, "seekCmplCallback enter");
state = FmReceiver.getSearchState();
- switch(state) {
+ switch (state) {
case FmTransceiver.subSrchLevel_ScanInProg:
Log.v(TAG, "Current state is " + state);
FmReceiver.setSearchState(FmTransceiver.subSrchLevel_SrchComplete);
@@ -240,6 +239,26 @@
Log.d(TAG, "seekCmplCallback exit");
}
+ public void srchListCallback(byte[] scan_tbl) {
+ int state;
+ state = FmReceiver.getSearchState();
+ switch (state) {
+ case FmTransceiver.subSrchLevel_SrchListInProg:
+ Log.v(TAG, "FmRxEventListener: Current state is AUTO_PRESET_INPROGRESS");
+ FmReceiver.setSearchState(FmTransceiver.subSrchLevel_SrchComplete);
+ Log.v(TAG, "RxEvtList: CURRENT-STATE : Search ---> NEW-STATE : FMRxOn");
+ FmReceiver.mCallback.FmRxEvSearchListComplete();
+ break;
+ case FmTransceiver.subSrchLevel_SrchAbort:
+ Log.v(TAG, "Current state is SRCH_ABORTED");
+ Log.v(TAG, "Aborting on-going SearchList command...");
+ FmReceiver.setSearchState(FmTransceiver.subSrchLevel_SrchComplete);
+ Log.v(TAG, "RxEvtList: CURRENT-STATE : Search ---> NEW-STATE : FMRxOn");
+ FmReceiver.mCallback.FmRxEvSearchCancelled();
+ break;
+ }
+ }
+
public void scanNxtCallback() {
Log.d(TAG, "scanNxtCallback enter");
FmReceiver.mCallback.FmRxEvSearchInProgress();