diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp index 9e469ed9abe66792b73badaff3362d47644520dc..b5b0a5edbb71bd669a71f4e54312a7019fcddb57 100644 --- a/jni/android_hardware_fm.cpp +++ b/jni/android_hardware_fm.cpp @@ -194,7 +194,16 @@ void fm_scan_next_cb() 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 @@ static void classInitNative(JNIEnv* env, jclass clazz) { 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 e587b446be4446f11f8b54af911af20692ff29eb..c5835ff674d75a571e5915fda74f7790f9567e4b 100644 --- a/qcom/fmradio/FmReceiverJNI.java +++ b/qcom/fmradio/FmReceiverJNI.java @@ -193,7 +193,6 @@ class FmReceiverJNI { public void tuneCallback(int freq) { int state; - Log.d(TAG, "tuneCallback enter"); state = FmReceiver.getSearchState(); switch(state) { @@ -222,7 +221,7 @@ class FmReceiverJNI { 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 @@ class FmReceiverJNI { 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();