FM: Passing constructor for newobject
Passing constructor for newobject in enable slimbus callback.
CRs-Fixed: 2434160
Change-Id: I472ccd101a35deca859242358c7b5d17d2784403
diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp
index bb0b25e..451cbf0 100644
--- a/jni/android_hardware_fm.cpp
+++ b/jni/android_hardware_fm.cpp
@@ -164,6 +164,7 @@
jmethodID method_getStnDbgParamCallback;
jmethodID method_enableSlimbusCallback;
jmethodID method_enableSoftMuteCallback;
+jmethodID method_FmReceiverJNICtor;
int load_bt_configstore_lib();
@@ -188,9 +189,10 @@
} else {
if (mCallbackEnv != NULL) {
ALOGE("javaObjectRef creating");
- jobject javaObjectRef = mCallbackEnv->NewObject(javaClassRef, method_enableCallback);
+ jobject javaObjectRef = mCallbackEnv->NewObject(javaClassRef, method_FmReceiverJNICtor);
mCallbacksObj = javaObjectRef;
ALOGE("javaObjectRef = %p mCallbackobject =%p \n",javaObjectRef,mCallbacksObj);
+ mCallbackEnv->CallVoidMethod(mCallbacksObj, method_enableCallback);
}
}
ALOGD("exit %s", __func__);
@@ -550,12 +552,13 @@
static void fm_enable_slimbus_cb(int status)
{
- ALOGD("++fm_enable_slimbus_cb mCallbacksObjCreated: %d", mCallbacksObjCreated);
+ ALOGD("++fm_enable_slimbus_cb mCallbacksObjCreatedtor: %d", mCallbacksObjCreated);
slimbus_flag = 1;
if (mCallbacksObjCreated == false) {
- jobject javaObjectRef = mCallbackEnv->NewObject(javaClassRef, method_enableSlimbusCallback);
+ jobject javaObjectRef = mCallbackEnv->NewObject(javaClassRef, method_FmReceiverJNICtor);
mCallbacksObj = javaObjectRef;
mCallbacksObjCreated = true;
+ mCallbackEnv->CallVoidMethod(mCallbacksObj, method_enableSlimbusCallback, status);
return;
}
@@ -1702,6 +1705,7 @@
method_getStnDbgParamCallback = env->GetMethodID(javaClassRef, "getStnDbgParamCallback", "(II)V");
method_enableSlimbusCallback = env->GetMethodID(javaClassRef, "enableSlimbusCallback", "(I)V");
method_enableSoftMuteCallback = env->GetMethodID(javaClassRef, "enableSoftMuteCallback", "(I)V");
+ method_FmReceiverJNICtor = env->GetMethodID(javaClassRef,"<init>","()V");
return;
error:
diff --git a/qcom/fmradio/FmReceiverJNI.java b/qcom/fmradio/FmReceiverJNI.java
index 6d36b19..9d6c273 100644
--- a/qcom/fmradio/FmReceiverJNI.java
+++ b/qcom/fmradio/FmReceiverJNI.java
@@ -58,7 +58,7 @@
static native void initNative();
static native void cleanupNative();
- final private FmRxEvCallbacks mCallback;
+ private FmRxEvCallbacks mCallback;
static private final int STD_BUF_SIZE = 256;
static private byte[] mRdsBuffer = new byte[STD_BUF_SIZE];
@@ -315,6 +315,10 @@
initNative();
}
+ public FmReceiverJNI() {
+ Log.d(TAG, "FmReceiverJNI constructor called");
+ }
+
static native int acquireFdNative(String path);
/**