diff options
author | Wink Saville <wink@google.com> | 2011-05-23 17:18:29 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-05-23 17:18:29 -0700 |
commit | ed5af6d93b2758b86175b13c380fcd164e537a7c (patch) | |
tree | 8ed899f00839af05f26aa12dbf2c216544e189af /telephony | |
parent | 37cd57772b27bb286aeec915cfaced4fa08508bd (diff) | |
parent | 61a5ab57b8a11d134ed3cfcab24a23d26ea4ddf0 (diff) | |
download | frameworks_base-ed5af6d93b2758b86175b13c380fcd164e537a7c.zip frameworks_base-ed5af6d93b2758b86175b13c380fcd164e537a7c.tar.gz frameworks_base-ed5af6d93b2758b86175b13c380fcd164e537a7c.tar.bz2 |
am 61a5ab57: am f89ea7a5: Merge "Change getLteOnCdmaModeStatic to dynamically determine its result." into honeycomb-LTE
* commit '61a5ab57b8a11d134ed3cfcab24a23d26ea4ddf0':
Change getLteOnCdmaModeStatic to dynamically determine its result.
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/java/com/android/internal/telephony/BaseCommands.java | 65 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/TelephonyProperties.java | 8 |
2 files changed, 67 insertions, 6 deletions
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.AsyncResult; 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 @@ public abstract class BaseCommands implements CommandsInterface { } /** + * 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 @@ public abstract class BaseCommands implements CommandsInterface { 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 @@ public abstract class BaseCommands implements CommandsInterface { * 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 @@ public interface TelephonyProperties */ 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"; |