summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/DataUsageSummary.java
diff options
context:
space:
mode:
authorChaitanya Saggurthi <csaggurt@codeaurora.org>2015-08-24 13:07:00 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:21:15 -0600
commit5def03792ca8a0e0daaafe756b70b8e0f471c05c (patch)
tree87eb58d2e2a00aa7b71680eb465f88c243a7c93f /src/com/android/settings/DataUsageSummary.java
parent6b7afc7053da9e1b451eecd3ff7aca37d697d96f (diff)
downloadpackages_apps_Settings-5def03792ca8a0e0daaafe756b70b8e0f471c05c.zip
packages_apps_Settings-5def03792ca8a0e0daaafe756b70b8e0f471c05c.tar.gz
packages_apps_Settings-5def03792ca8a0e0daaafe756b70b8e0f471c05c.tar.bz2
Fix issue disable data of other SUB
if we enable data for non DDS SUB. Current implementation will ask for user confirmation to change DDS and disable data of current DDS SUB. It will block our DATA + MMS feature and we can't send MMS on non DDS SUB. Change-Id: I13f5ef1075e42b1dba8c10e58e7f156fbe0bc2f3
Diffstat (limited to 'src/com/android/settings/DataUsageSummary.java')
-rw-r--r--src/com/android/settings/DataUsageSummary.java78
1 files changed, 11 insertions, 67 deletions
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java
index e014465..d0b916f 100644
--- a/src/com/android/settings/DataUsageSummary.java
+++ b/src/com/android/settings/DataUsageSummary.java
@@ -1073,8 +1073,16 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
}
private void setMobileDataEnabled(int subId, boolean enabled) {
- if (LOGD) Log.d(TAG, "setMobileDataEnabled()");
- mTelephonyManager.setDataEnabled(subId, enabled);
+ if (LOGD) Log.d(TAG, "setMobileDataEnabled: subId = " + subId + " enabled = " + enabled);
+ int dataSubId = mSubscriptionManager.getDefaultDataSubId();
+ if (subId == dataSubId || TelephonyManager.getDefault().getSimCount() == 1) {
+ mTelephonyManager.setDataEnabled(subId, enabled);
+ } else {
+ // Update mobile data status of a non DDS sub in provider
+ final Context context = getActivity();
+ android.provider.Settings.Global.putInt(context.getContentResolver(),
+ android.provider.Settings.Global.MOBILE_DATA + subId, enabled ? 1 : 0);
+ }
mMobileDataEnabled.put(String.valueOf(subId), enabled);
updatePolicy(false);
}
@@ -1228,16 +1236,6 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
}
}
- private void disableDataForOtherSubscriptions(SubscriptionInfo currentSir) {
- if (mSubInfoList != null) {
- for (SubscriptionInfo subInfo : mSubInfoList) {
- if (subInfo.getSubscriptionId() != currentSir.getSubscriptionId()) {
- setMobileDataEnabled(subInfo.getSubscriptionId(), false);
- }
- }
- }
- }
-
private View.OnClickListener mDataEnabledListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -1248,12 +1246,7 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
if (isMobileTab(currentTab)) {
MetricsLogger.action(getContext(), MetricsLogger.ACTION_CELL_DATA_TOGGLE, enabled);
if (enabled) {
- // If we are showing the Sim Card tile then we are a Multi-Sim device.
- if (Utils.showSimCardTile(getActivity())) {
- handleMultiSimDataDialog();
- } else {
- setMobileDataEnabled(getSubId(currentTab), true);
- }
+ setMobileDataEnabled(getSubId(currentTab), true);
} else {
// disabling data; show confirmation dialog which eventually
// calls setMobileDataEnabled() once user confirms.
@@ -1265,55 +1258,6 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
}
};
- private void handleMultiSimDataDialog() {
- final Context context = getActivity();
- final SubscriptionInfo currentSir = getCurrentTabSubInfo(context);
-
- //If sim has not loaded after toggling data switch, return.
- if (currentSir == null) {
- return;
- }
-
- final SubscriptionInfo nextSir = mSubscriptionManager.getDefaultDataSubscriptionInfo();
-
- // If the device is single SIM or is enabling data on the active data SIM then forgo
- // the pop-up.
- if (!Utils.showSimCardTile(context) ||
- (nextSir != null && currentSir != null &&
- currentSir.getSubscriptionId() == nextSir.getSubscriptionId())) {
- setMobileDataEnabled(currentSir.getSubscriptionId(), true);
- if (nextSir != null && currentSir != null &&
- currentSir.getSubscriptionId() == nextSir.getSubscriptionId()) {
- disableDataForOtherSubscriptions(currentSir);
- }
- updateBody();
- return;
- }
-
- final String previousName = (nextSir == null)
- ? context.getResources().getString(R.string.sim_selection_required_pref)
- : nextSir.getDisplayName().toString();
-
- AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
-
- builder.setTitle(R.string.sim_change_data_title);
- builder.setMessage(getActivity().getResources().getString(R.string.sim_change_data_message,
- currentSir.getDisplayName(), previousName));
-
- builder.setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- mSubscriptionManager.setDefaultDataSubId(currentSir.getSubscriptionId());
- setMobileDataEnabled(currentSir.getSubscriptionId(), true);
- disableDataForOtherSubscriptions(currentSir);
- updateBody();
- }
- });
- builder.setNegativeButton(R.string.cancel, null);
-
- builder.create().show();
- }
-
private View.OnClickListener mDisableAtLimitListener = new View.OnClickListener() {
@Override
public void onClick(View v) {