Fix CFI issues in FM project.

CFI check is failing during fm jni callback due
to difference in function signatures.
The patch fixes the issue by matching the function signatures.

CRs-Fixed: 2583457
Change-Id: Ife2b6a882c32d13cb6cc5669d685805be7eb046c
diff --git a/helium/radio-helium.h b/helium/radio-helium.h
index 2111eda..eb6ea9b 100644
--- a/helium/radio-helium.h
+++ b/helium/radio-helium.h
@@ -146,20 +146,20 @@
 
 #define TUNE_PARAM 16
 #define SIZE_ARRAY(x)  (sizeof(x) / sizeof((x)[0]))
-typedef void (*enb_result_cb)();
+typedef void (*enb_result_cb)(void);
 typedef void (*tune_rsp_cb)(int Freq);
 typedef void (*seek_rsp_cb)(int Freq);
-typedef void (*scan_rsp_cb)();
+typedef void (*scan_rsp_cb)(void);
 typedef void (*srch_list_rsp_cb)(uint16_t *scan_tbl);
 typedef void (*stereo_mode_cb)(bool status);
 typedef void (*rds_avl_sts_cb)(bool status);
 typedef void (*af_list_cb)(uint16_t *af_list);
 typedef void (*rt_cb)(char *rt);
 typedef void (*ps_cb)(char *ps);
-typedef void (*oda_cb)();
+typedef void (*oda_cb)(void);
 typedef void (*rt_plus_cb)(char *rt_plus);
 typedef void (*ert_cb)(char *ert);
-typedef void (*disable_cb)();
+typedef void (*disable_cb)(void);
 typedef void (*callback_thread_event)(unsigned int evt);
 typedef void (*rds_grp_cntrs_cb)(char *rds_params);
 typedef void (*rds_grp_cntrs_ext_cb)(char *rds_params);
@@ -1252,7 +1252,7 @@
 };
 
 struct fm_interface_t {
-    int (*init)(const fm_hal_callbacks_t *p_cb);
+    int (*hal_init)(const fm_hal_callbacks_t *p_cb);
     int (*set_fm_ctrl)(int opcode, int val);
     int (*get_fm_ctrl) (int opcode, int *val);
 };
diff --git a/jni/Android.mk b/jni/Android.mk
index 957947a..02be1b6 100644
--- a/jni/Android.mk
+++ b/jni/Android.mk
@@ -21,7 +21,9 @@
 LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include \
                    $(TOP)/libnativehelper/include/nativehelper \
                    $(TOP)/vendor/qcom/opensource/commonsys-intf/bluetooth/include \
-                   $(TOP)/vendor/qcom/opensource/commonsys/bluetooth_ext/system_bt_ext/btconfigstore
+                   $(TOP)/vendor/qcom/opensource/commonsys/bluetooth_ext/system_bt_ext/btconfigstore \
+                   vendor/qcom/opensource/commonsys/fm/helium
+
 LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
 
 LOCAL_MODULE := libqcomfm_jni
diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp
index 1a5cbba..8e0c1bb 100644
--- a/jni/android_hardware_fm.cpp
+++ b/jni/android_hardware_fm.cpp
@@ -45,7 +45,7 @@
 #include "android_runtime/AndroidRuntime.h"
 #include "bt_configstore.h"
 #include <vector>
-
+#include "radio-helium.h"
 
 #define RADIO "/dev/radio0"
 #define FM_JNI_SUCCESS 0L
@@ -96,42 +96,6 @@
 static bt_configstore_interface_t* bt_configstore_intf = NULL;
 static void *bt_configstore_lib_handle = NULL;
 
-
-typedef void (*enb_result_cb)();
-typedef void (*tune_rsp_cb)(int Freq);
-typedef void (*seek_rsp_cb)(int Freq);
-typedef void (*scan_rsp_cb)();
-typedef void (*srch_list_rsp_cb)(uint16_t *scan_tbl);
-typedef void (*stereo_mode_cb)(bool status);
-typedef void (*rds_avl_sts_cb)(bool status);
-typedef void (*af_list_cb)(uint16_t *af_list);
-typedef void (*rt_cb)(char *rt);
-typedef void (*ps_cb)(char *ps);
-typedef void (*oda_cb)();
-typedef void (*rt_plus_cb)(char *rt_plus);
-typedef void (*ert_cb)(char *ert);
-typedef void (*disable_cb)();
-typedef void (*callback_thread_event)(unsigned int evt);
-typedef void (*rds_grp_cntrs_cb)(char *rds_params);
-typedef void (*rds_grp_cntrs_ext_cb)(char *rds_params);
-
-typedef void (*fm_peek_cb)(char *peek_rsp);
-typedef void (*fm_ssbi_peek_cb)(char *ssbi_peek_rsp);
-typedef void (*fm_agc_gain_cb)(char *agc_gain_rsp);
-typedef void (*fm_ch_det_th_cb)(char *ch_det_rsp);
-typedef void (*fm_ecc_evt_cb)(char *ecc);
-typedef void (*fm_sig_thr_cb)(int val, int status);
-typedef void (*fm_get_ch_det_thrs_cb) (int val, int status);
-typedef void (*fm_def_data_rd_cb) (int val, int status);
-typedef void (*fm_get_blnd_cb) (int val, int status);
-typedef void (*fm_set_ch_det_thrs_cb) (int status);
-typedef void (*fm_def_data_wrt_cb) (int status);
-typedef void (*fm_set_blnd_cb) (int status);
-typedef void (*fm_get_stn_prm_cb) (int val, int status);
-typedef void (*fm_get_stn_dbg_prm_cb) (int val, int status);
-typedef void (*fm_enable_sb_cb) (int status);
-typedef void (*fm_enable_sm_cb) (int status);
-
 static JNIEnv *mCallbackEnv = NULL;
 static jobject mCallbacksObj = NULL;
 static bool mCallbacksObjCreated = false;
@@ -178,7 +142,7 @@
     return true;
 }
 
-void fm_enabled_cb() {
+void fm_enabled_cb(void) {
     ALOGD("Entered %s", __func__);
 
     if (slimbus_flag) {
@@ -216,7 +180,7 @@
     mCallbackEnv->CallVoidMethod(mCallbacksObj, method_seekCmplCallback, (jint) Freq);
 }
 
-void fm_scan_next_cb()
+void fm_scan_next_cb(void)
 {
     ALOGI("SCAN_NEXT");
     if (!checkCallbackThread())
@@ -331,7 +295,7 @@
     mCallbackEnv->DeleteLocalRef(ps_data);
 }
 
-void fm_oda_update_cb()
+void fm_oda_update_cb(void)
 {
     ALOGD("ODA_EVT");
 }
@@ -415,7 +379,7 @@
    ALOGE("rds_grp_cntrs_ext_rsp_cb");
 }
 
-void fm_disabled_cb()
+void fm_disabled_cb(void)
 {
     ALOGE("DISABLE");
     if (!checkCallbackThread())
@@ -580,53 +544,8 @@
     ALOGD("--fm_enable_softmute_cb");
 }
 
-
-typedef struct {
-   size_t  size;
-
-   enb_result_cb  enabled_cb;
-   tune_rsp_cb tune_cb;
-   seek_rsp_cb  seek_cmpl_cb;
-   scan_rsp_cb  scan_next_cb;
-   srch_list_rsp_cb  srch_list_cb;
-   stereo_mode_cb  stereo_status_cb;
-   rds_avl_sts_cb  rds_avail_status_cb;
-   af_list_cb  af_list_update_cb;
-   rt_cb  rt_update_cb;
-   ps_cb  ps_update_cb;
-   oda_cb  oda_update_cb;
-   rt_plus_cb  rt_plus_update_cb;
-   ert_cb  ert_update_cb;
-   disable_cb  disabled_cb;
-   rds_grp_cntrs_cb rds_grp_cntrs_rsp_cb;
-   rds_grp_cntrs_ext_cb rds_grp_cntrs_ext_rsp_cb;
-   fm_peek_cb fm_peek_rsp_cb;
-   fm_ssbi_peek_cb fm_ssbi_peek_rsp_cb;
-   fm_agc_gain_cb fm_agc_gain_rsp_cb;
-   fm_ch_det_th_cb fm_ch_det_th_rsp_cb;
-   fm_ecc_evt_cb   ext_country_code_cb;
-   callback_thread_event thread_evt_cb;
-   fm_sig_thr_cb fm_get_sig_thres_cb;
-   fm_get_ch_det_thrs_cb fm_get_ch_det_thr_cb;
-   fm_def_data_rd_cb fm_def_data_read_cb;
-   fm_get_blnd_cb fm_get_blend_cb;
-   fm_set_ch_det_thrs_cb fm_set_ch_det_thr_cb;
-   fm_def_data_wrt_cb fm_def_data_write_cb;
-   fm_set_blnd_cb fm_set_blend_cb;
-   fm_get_stn_prm_cb fm_get_station_param_cb;
-   fm_get_stn_dbg_prm_cb fm_get_station_debug_param_cb;
-   fm_enable_sb_cb fm_enable_slimbus_cb;
-   fm_enable_sm_cb fm_enable_softmute_cb;
-} fm_vendor_callbacks_t;
-
-typedef struct {
-    int (*hal_init)(fm_vendor_callbacks_t *p_cb);
-    int (*set_fm_ctrl)(int ioctl, int val);
-    int (*get_fm_ctrl) (int ioctl, int *val);
-} fm_interface_t;
-
 fm_interface_t *vendor_interface;
-static   fm_vendor_callbacks_t fm_callbacks = {
+static   fm_hal_callbacks_t fm_callbacks = {
     sizeof(fm_callbacks),
     fm_enabled_cb,
     fm_tune_cb,