FM: Add property to force use internal antenna
Allow devices to force the FM radio to use the internal antenna setup by
setting hw.fm.internal_antenna property to true in system.prop.
Device tree example here: I7c9a67371c775a343345b035c196152bd9b2e13d
Change-Id: I1a055070bb4b7e49b7a03c75632d4b95c59f02da
Author: Dhruv Paranjape <lord.dhruv@gmail.com>
Date: Thu May 14 20:49:26 2015 +0800
FM: respect hw.fm.internal_antenna
PS2: Patch from here: http://forum.xda-developers.com/showpost.php?p=60580714&postcount=86
Change-Id: Ic3104de252bac108c925e7cd5f50d9e89ca63779
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 39f99c1..681a12e 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -2334,13 +2334,12 @@
bStatus = enableAutoAF(FmSharedPreferences.getAutoAFSwitch());
Log.d(LOGTAG, "enableAutoAF done, Status :" + bStatus);
- /* There is no internal Antenna*/
- bStatus = mReceiver.setInternalAntenna(false);
- Log.d(LOGTAG, "setInternalAntenna done, Status :" + bStatus);
-
/* Read back to verify the internal Antenna mode*/
readInternalAntennaAvailable();
+ bStatus = mReceiver.setInternalAntenna(mInternalAntennaAvailable);
+ Log.d(LOGTAG, "setInternalAntenna done, Status :" + bStatus);
+
startNotification();
bStatus = true;
} else {
diff --git a/qcom/fmradio/FmTransceiver.java b/qcom/fmradio/FmTransceiver.java
index 589a2dc..cd619df 100644
--- a/qcom/fmradio/FmTransceiver.java
+++ b/qcom/fmradio/FmTransceiver.java
@@ -28,6 +28,7 @@
package qcom.fmradio;
+import android.os.SystemProperties;
import android.util.Log;
import java.io.File;
@@ -491,13 +492,9 @@
*/
public boolean getInternalAntenna()
{
-
- int re = FmReceiverJNI.getControlNative (sFd, V4L2_CID_PRIVATE_TAVARUA_ANTENNA);
-
- if (re == 1)
- return true;
-
- return false;
+ return ((FmReceiverJNI.getControlNative(sFd,
+ V4L2_CID_PRIVATE_TAVARUA_ANTENNA) == 1) ||
+ SystemProperties.getBoolean("hw.fm.internal_antenna", false));
}
/*==============================================================