diff options
author | Jeff Sharkey <jsharkey@android.com> | 2012-05-29 15:01:33 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-29 15:01:33 -0700 |
commit | 16bf0e0ec7dbd606ea5a5c8a1a9653f1cbb6d9b6 (patch) | |
tree | 2f849381a033cee7a687fbaa9612e06a6993507d /src | |
parent | 6de0ec640d4ddd618b7f9fa7c9fc131d13979b97 (diff) | |
parent | d8789099806a169309071d68cea5f8b82380044e (diff) | |
download | packages_apps_settings-16bf0e0ec7dbd606ea5a5c8a1a9653f1cbb6d9b6.zip packages_apps_settings-16bf0e0ec7dbd606ea5a5c8a1a9653f1cbb6d9b6.tar.gz packages_apps_settings-16bf0e0ec7dbd606ea5a5c8a1a9653f1cbb6d9b6.tar.bz2 |
Merge "Surface metered networks as "Mobile hotspots."" into jb-dev
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/DataUsageSummary.java | 19 | ||||
-rw-r--r-- | src/com/android/settings/net/DataUsageMeteredSettings.java | 4 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java index 94c8cda..c58e001 100644 --- a/src/com/android/settings/DataUsageSummary.java +++ b/src/com/android/settings/DataUsageSummary.java @@ -104,7 +104,6 @@ import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; -import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemSelectedListener; @@ -2164,15 +2163,19 @@ public class DataUsageSummary extends Fragment { final boolean hasEthernet = conn.isNetworkSupported(TYPE_ETHERNET); final long ethernetBytes; - try { - ethernetBytes = mStatsSession.getSummaryForNetwork( - NetworkTemplate.buildTemplateEthernet(), Long.MIN_VALUE, Long.MAX_VALUE) - .getTotalBytes(); - } catch (RemoteException e) { - throw new RuntimeException(e); + if (mStatsSession != null) { + try { + ethernetBytes = mStatsSession.getSummaryForNetwork( + NetworkTemplate.buildTemplateEthernet(), Long.MIN_VALUE, Long.MAX_VALUE) + .getTotalBytes(); + } catch (RemoteException e) { + throw new RuntimeException(e); + } + } else { + ethernetBytes = 0; } - // suppress ethernet unless traffic has occurred + // only show ethernet when both hardware present and traffic has occurred return hasEthernet && ethernetBytes > 0; } diff --git a/src/com/android/settings/net/DataUsageMeteredSettings.java b/src/com/android/settings/net/DataUsageMeteredSettings.java index 69326bc..ad12311 100644 --- a/src/com/android/settings/net/DataUsageMeteredSettings.java +++ b/src/com/android/settings/net/DataUsageMeteredSettings.java @@ -41,6 +41,8 @@ import com.android.settings.SettingsPreferenceFragment; */ public class DataUsageMeteredSettings extends SettingsPreferenceFragment { + private static final boolean SHOW_MOBILE_CATEGORY = false; + private NetworkPolicyManager mPolicyManager; private WifiManager mWifiManager; @@ -70,7 +72,7 @@ public class DataUsageMeteredSettings extends SettingsPreferenceFragment { } private void updateNetworks(Context context) { - if (hasReadyMobileRadio(context)) { + if (SHOW_MOBILE_CATEGORY && hasReadyMobileRadio(context)) { mMobileCategory.removeAll(); mMobileCategory.addPreference(buildMobilePref(context)); } else { |