summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/DataUsageSummary.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings/DataUsageSummary.java')
-rw-r--r--src/com/android/settings/DataUsageSummary.java50
1 files changed, 20 insertions, 30 deletions
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java
index 1c17ce5..3296ba1 100644
--- a/src/com/android/settings/DataUsageSummary.java
+++ b/src/com/android/settings/DataUsageSummary.java
@@ -769,8 +769,15 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
if (LOGD) Log.d(TAG, "updateBody() mobile tab");
setPreferenceTitle(mDataEnabledView, R.string.data_usage_enable_mobile);
setPreferenceTitle(mDisableAtLimitView, R.string.data_usage_disable_mobile_limit);
- mTemplate = buildTemplateMobileAll(getActiveSubscriberId(context,getSubId(currentTab)));
mDataEnabledSupported = isMobileDataAvailable(getSubId(currentTab));
+
+ // Match mobile traffic for this subscriber, but normalize it to
+ // catch any other merged subscribers.
+ mTemplate = buildTemplateMobileAll(
+ getActiveSubscriberId(context, getSubId(currentTab)));
+ mTemplate = NetworkTemplate.normalize(mTemplate,
+ mTelephonyManager.getMergedSubscriberIds());
+
} else if (TAB_3G.equals(currentTab)) {
if (LOGD) Log.d(TAG, "updateBody() 3g tab");
setPreferenceTitle(mDataEnabledView, R.string.data_usage_enable_3g);
@@ -959,22 +966,29 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
}
/**
- * Local cache of value, used to work around delay when
- * {@link ConnectivityManager#setMobileDataEnabled(boolean)} is async.
+ * Local cache of value, used to work around delays.
*/
private Boolean mMobileDataEnabled;
private boolean isMobileDataEnabled(int subId) {
+ if (LOGD) Log.d(TAG, "isMobileDataEnabled:+ subId=" + subId);
boolean isEnable = false;
if (mMobileDataEnabled != null) {
// TODO: deprecate and remove this once enabled flag is on policy
// Multiple Subscriptions, the value need to be reseted
isEnable = mMobileDataEnabled.booleanValue();
+ if (LOGD) {
+ Log.d(TAG, "isMobileDataEnabled: != null, subId=" + subId
+ + " isEnable=" + isEnable);
+ }
mMobileDataEnabled = null;
} else {
- //SUB SELECT
- isEnable = mTelephonyManager.getDataEnabled()
- && (subId == mSubscriptionManager.getDefaultDataSubId());
+ // SUB SELECT
+ isEnable = mTelephonyManager.getDataEnabled(subId);
+ if (LOGD) {
+ Log.d(TAG, "isMobileDataEnabled: == null, subId=" + subId
+ + " isEnable=" + isEnable);
+ }
}
return isEnable;
}
@@ -1394,30 +1408,6 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
}
};
- @Deprecated
- private boolean isMobilePolicySplit() {
- final Context context = getActivity();
- boolean retVal;
- if (hasReadyMobileRadio(context)) {
- final TelephonyManager tele = TelephonyManager.from(context);
- retVal = mPolicyEditor.isMobilePolicySplit(getActiveSubscriberId(context));
- } else {
- retVal = false;
- }
- if (LOGD) Log.d(TAG, "isMobilePolicySplit: retVal=" + retVal);
- return retVal;
- }
-
- @Deprecated
- private void setMobilePolicySplit(boolean split) {
- final Context context = getActivity();
- if (hasReadyMobileRadio(context)) {
- final TelephonyManager tele = TelephonyManager.from(context);
- if (LOGD) Log.d(TAG, "setMobilePolicySplit: split=" + split);
- mPolicyEditor.setMobilePolicySplit(getActiveSubscriberId(context), split);
- }
- }
-
private static String getActiveSubscriberId(Context context) {
final TelephonyManager tele = TelephonyManager.from(context);
final String actualSubscriberId = tele.getSubscriberId();