Fm: Use btconfigstore interface to fetch vendor features
Use btconfigstore interface to fetch
"persist.vendor.fm.stats" property.
CRs-fixed: 2595144
Change-Id: I8686ee4cf0f140004a6679fffee249f46bfff32f
diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java
index b378ba1..5940f4b 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadio.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadio.java
@@ -278,9 +278,6 @@
private LoadedDataAndState SavedDataAndState = null;
private static String mBTsoc;
- /** fm stats property string */
- public static final String FM_STATS_PROP = "persist.fm.stats";
-
private BroadcastReceiver mFmSettingReceiver = null;
/** Called when the activity is first created. */
@@ -679,7 +676,17 @@
if (item != null) {
item.setVisible(sleepActive && radioOn);
}
- mFMStats = SystemProperties.getBoolean(FM_STATS_PROP, false);
+
+ if (mService != null) {
+ try {
+ mFMStats = mService.getFmStatsProp();
+ Log.d(LOGTAG, "mFMStats: " + mFMStats);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
if(mFMStats) {
item = menu.add(0, MENU_STAT_TEST, 0,R.string.menu_stats).
setIcon(android.R.drawable.ic_menu_info_details);
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index dca9d72..2618a0c 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -2124,6 +2124,11 @@
return(mService.get().getExtenCountryCode());
}
+ public boolean getFmStatsProp()
+ {
+ return (mService.get().getFmStatsProp());
+ }
+
public void restoreDefaults()
{
mService.get().restoreDefaults();
@@ -3893,6 +3898,14 @@
else
return null;
}
+
+ boolean getFmStatsProp() {
+ if(mReceiver != null)
+ return mReceiver.getFmStatsProp();
+ else
+ return false;
+ }
+
private void setAlarmSleepExpired (long duration) {
Intent i = new Intent(SLEEP_EXPIRED_ACTION);
AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
diff --git a/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl b/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
index 0d79755..9766093 100644
--- a/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
+++ b/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
@@ -79,6 +79,7 @@
boolean getIntfDetLowTh();
boolean getIntfDetHighTh();
boolean getRxRepeatCount();
+ boolean getFmStatsProp();
void restoreDefaults();
}
diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp
index 9e01b3a..8e70592 100644
--- a/jni/android_hardware_fm.cpp
+++ b/jni/android_hardware_fm.cpp
@@ -1530,6 +1530,21 @@
return err;
}
+static jboolean android_hardware_fmradio_FmReceiverJNI_getFmStatsPropNative
+ (JNIEnv* env)
+{
+ jboolean ret;
+ char value[PROPERTY_VALUE_MAX] = {'\0'};
+ get_property(FM_STATS_PROP, value);
+ if (!strncasecmp(value, "true", sizeof("true"))) {
+ ret = true;
+ } else {
+ ret = false;
+ }
+
+ return ret;
+}
+
static jint android_hardware_fmradio_FmReceiverJNI_enableSoftMuteNative
(JNIEnv * env, jobject thiz, jint fd, jint val)
{
@@ -1713,6 +1728,8 @@
(void*)android_hardware_fmradio_FmReceiverJNI_enableSoftMuteNative},
{"getSocNameNative", "()Ljava/lang/String;",
(void*) android_hardware_fmradio_FmReceiverJNI_getSocNameNative},
+ {"getFmStatsPropNative", "()Z",
+ (void*) android_hardware_fmradio_FmReceiverJNI_getFmStatsPropNative},
};
int register_android_hardware_fm_fmradio(JNIEnv* env)
diff --git a/qcom/fmradio/FmReceiver.java b/qcom/fmradio/FmReceiver.java
index 3702aac..39974d6 100644
--- a/qcom/fmradio/FmReceiver.java
+++ b/qcom/fmradio/FmReceiver.java
@@ -3092,4 +3092,8 @@
public String getSocName() {
return FmReceiverJNI.getSocNameNative();
}
+
+ public boolean getFmStatsProp() {
+ return FmReceiverJNI.getFmStatsPropNative();
+ }
}
diff --git a/qcom/fmradio/FmReceiverJNI.java b/qcom/fmradio/FmReceiverJNI.java
index d2e929d..21a7e98 100644
--- a/qcom/fmradio/FmReceiverJNI.java
+++ b/qcom/fmradio/FmReceiverJNI.java
@@ -563,4 +563,5 @@
static native int enableSlimbus(int fd, int val);
static native int enableSoftMute(int fd, int val);
static native String getSocNameNative();
+ static native boolean getFmStatsPropNative();
}