am 61a5ab57: am f89ea7a5: Merge "Change getLteOnCdmaModeStatic to dynamically determine its result." into honeycomb-LTE
* commit '61a5ab57b8a11d134ed3cfcab24a23d26ea4ddf0':
Change getLteOnCdmaModeStatic to dynamically determine its result.
diff --git a/telephony/java/com/android/internal/telephony/BaseCommands.java b/telephony/java/com/android/internal/telephony/BaseCommands.java
index 9fc4667..0c4581b 100644
--- a/telephony/java/com/android/internal/telephony/BaseCommands.java
+++ b/telephony/java/com/android/internal/telephony/BaseCommands.java
@@ -25,6 +25,11 @@
import android.os.SystemProperties;
import android.util.Log;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
/**
* {@hide}
*/
@@ -794,6 +799,34 @@
}
/**
+ * The contents of the /proc/cmdline file
+ */
+ private static String getProcCmdLine()
+ {
+ String cmdline = "";
+ FileInputStream is = null;
+ try {
+ is = new FileInputStream("/proc/cmdline");
+ byte [] buffer = new byte[2048];
+ int count = is.read(buffer);
+ if (count > 0) {
+ cmdline = new String(buffer, 0, count);
+ }
+ } catch (IOException e) {
+ Log.d(LOG_TAG, "No /proc/cmdline exception=" + e);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ Log.d(LOG_TAG, "/proc/cmdline=" + cmdline);
+ return cmdline;
+ }
+
+ /**
* {@inheritDoc}
*/
@Override
@@ -801,6 +834,17 @@
return getLteOnCdmaModeStatic();
}
+ /** Kernel command line */
+ private static final String sKernelCmdLine = getProcCmdLine();
+
+ /** Pattern for selecting the product type from the kernel command line */
+ private static final Pattern sProductTypePattern =
+ Pattern.compile("\\sproduct_type\\s*=\\s*(\\w+)");
+
+ /** The ProductType used for LTE on CDMA devices */
+ private static final String sLteOnCdmaProductType =
+ SystemProperties.get(TelephonyProperties.PROPERTY_LTE_ON_CDMA_PRODUCT_TYPE, "");
+
/**
* Return if the current radio is LTE on CDMA. This
* is a tri-state return value as for a period of time
@@ -810,9 +854,24 @@
* or {@link Phone#LTE_ON_CDMA_TRUE}
*/
public static int getLteOnCdmaModeStatic() {
- int retVal = SystemProperties.getInt(TelephonyProperties.PROPERTY_NETWORK_LTE_ON_CDMA,
- Phone.LTE_ON_CDMA_FALSE);
- Log.d(LOG_TAG, "getLteOnCdmaMode=" + retVal);
+ int retVal;
+ String productType;
+
+ Matcher matcher = sProductTypePattern.matcher(sKernelCmdLine);
+ if (matcher.find()) {
+ productType = matcher.group(1);
+ if (sLteOnCdmaProductType.equals(productType)) {
+ retVal = Phone.LTE_ON_CDMA_TRUE;
+ } else {
+ retVal = Phone.LTE_ON_CDMA_FALSE;
+ }
+ } else {
+ retVal = Phone.LTE_ON_CDMA_FALSE;
+ productType = "";
+ }
+
+ Log.d(LOG_TAG, "getLteOnCdmaMode=" + retVal + " product_type='" + productType +
+ "' lteOnCdmaProductType='" + sLteOnCdmaProductType + "'");
return retVal;
}
}
diff --git a/telephony/java/com/android/internal/telephony/TelephonyProperties.java b/telephony/java/com/android/internal/telephony/TelephonyProperties.java
index 4927006..4309309 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyProperties.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyProperties.java
@@ -72,10 +72,12 @@
*/
static final String PROPERTY_OPERATOR_ISO_COUNTRY = "gsm.operator.iso-country";
- /** 'true' if device supports both LTE and CDMA mode of operation.
- * Availability: Set only on devices supporting LTE and CDMA.
+ /**
+ * The contents of this property is the value of the kernel command line
+ * product_type variable that corresponds to a product that supports LTE on CDMA.
+ * {@see BaseCommands#getLteOnCdmaMode()}
*/
- static final String PROPERTY_NETWORK_LTE_ON_CDMA = "telephony.lte_on_cdma";
+ static final String PROPERTY_LTE_ON_CDMA_PRODUCT_TYPE = "telephony.lteOnCdmaProductType";
static final String CURRENT_ACTIVE_PHONE = "gsm.current.phone-type";