diff options
author | jt1134 <jt1134@gmail.com> | 2013-04-02 21:37:07 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-04-13 05:53:28 -0700 |
commit | 4c51b45355b9d6fed973f946738bf455a8b7c9ea (patch) | |
tree | bbad55b386d837d1247f131ccb22f9c2c76002d2 /src | |
parent | 8182fd428aa91947c4202b260c5cbc018dcde0aa (diff) | |
download | packages_apps_settings-4c51b45355b9d6fed973f946738bf455a8b7c9ea.zip packages_apps_settings-4c51b45355b9d6fed973f946738bf455a8b7c9ea.tar.gz packages_apps_settings-4c51b45355b9d6fed973f946738bf455a8b7c9ea.tar.bz2 |
DataUsageSummary: fix mobile data usage display for sim-less devices
- Don't assume the device has a sim card. Check for a phone number
instead. Otherwise the mobile data usage screen will not show up
on sim-less CDMA devices.
Change-Id: Ic6e35dc209ff05e0c89dc990ad82f4ab4d3f337d
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/DataUsageSummary.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java index b6efb65..1bfb585 100644 --- a/src/com/android/settings/DataUsageSummary.java +++ b/src/com/android/settings/DataUsageSummary.java @@ -40,7 +40,6 @@ import static android.net.TrafficStats.GB_IN_BYTES; import static android.net.TrafficStats.MB_IN_BYTES; import static android.net.TrafficStats.UID_REMOVED; import static android.net.TrafficStats.UID_TETHERING; -import static android.telephony.TelephonyManager.SIM_STATE_READY; import static android.text.format.DateUtils.FORMAT_ABBREV_MONTH; import static android.text.format.DateUtils.FORMAT_SHOW_DATE; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; @@ -2192,7 +2191,7 @@ public class DataUsageSummary extends Fragment { } /** - * Test if device has a mobile data radio with SIM in ready state. + * Test if device has a mobile data radio in ready state. */ public static boolean hasReadyMobileRadio(Context context) { if (TEST_RADIOS) { @@ -2202,8 +2201,9 @@ public class DataUsageSummary extends Fragment { final ConnectivityManager conn = ConnectivityManager.from(context); final TelephonyManager tele = TelephonyManager.from(context); - // require both supported network and ready SIM - return conn.isNetworkSupported(TYPE_MOBILE) && tele.getSimState() == SIM_STATE_READY; + // require both supported network and phone number + return conn.isNetworkSupported(TYPE_MOBILE) && + !TextUtils.isEmpty(tele.getLine1Number()); } /** @@ -2321,7 +2321,7 @@ public class DataUsageSummary extends Fragment { final ArrayList<CharSequence> limited = Lists.newArrayList(); final TelephonyManager tele = TelephonyManager.from(context); - if (tele.getSimState() == SIM_STATE_READY) { + if (!TextUtils.isEmpty(tele.getLine1Number())) { final String subscriberId = getActiveSubscriberId(context); if (mPolicyEditor.hasLimitedPolicy(buildTemplateMobileAll(subscriberId))) { limited.add(getText(R.string.data_usage_list_mobile)); |