Commit 61e9aa99 authored by Jason Monk's avatar Jason Monk Committed by The Android Automerger

Fix multi-sim cell data pref ?

Bug: 26795856
Change-Id: I82e18c21d819d51712a65ccc37e4e3af9a006771
parent c5876938
...@@ -180,7 +180,7 @@ public class CellDataPreference extends CustomDialogPreference implements Templa ...@@ -180,7 +180,7 @@ public class CellDataPreference extends CustomDialogPreference implements Templa
setMobileDataEnabled(true); setMobileDataEnabled(true);
if (nextSir != null && currentSir != null && if (nextSir != null && currentSir != null &&
currentSir.getSubscriptionId() == nextSir.getSubscriptionId()) { currentSir.getSubscriptionId() == nextSir.getSubscriptionId()) {
disableDataForOtherSubscriptions(currentSir); disableDataForOtherSubscriptions(mSubId);
} }
return; return;
} }
...@@ -191,14 +191,15 @@ public class CellDataPreference extends CustomDialogPreference implements Templa ...@@ -191,14 +191,15 @@ public class CellDataPreference extends CustomDialogPreference implements Templa
builder.setTitle(R.string.sim_change_data_title); builder.setTitle(R.string.sim_change_data_title);
builder.setMessage(getContext().getString(R.string.sim_change_data_message, builder.setMessage(getContext().getString(R.string.sim_change_data_message,
currentSir.getDisplayName(), previousName)); String.valueOf(currentSir != null ? currentSir.getDisplayName() : null),
previousName));
builder.setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() { builder.setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
mSubscriptionManager.setDefaultDataSubId(currentSir.getSubscriptionId()); mSubscriptionManager.setDefaultDataSubId(mSubId);
setMobileDataEnabled(true); setMobileDataEnabled(true);
disableDataForOtherSubscriptions(currentSir); disableDataForOtherSubscriptions(mSubId);
} }
}); });
builder.setNegativeButton(R.string.cancel, null); builder.setNegativeButton(R.string.cancel, null);
...@@ -206,11 +207,11 @@ public class CellDataPreference extends CustomDialogPreference implements Templa ...@@ -206,11 +207,11 @@ public class CellDataPreference extends CustomDialogPreference implements Templa
builder.create().show(); builder.create().show();
} }
private void disableDataForOtherSubscriptions(SubscriptionInfo currentSir) { private void disableDataForOtherSubscriptions(int subId) {
List<SubscriptionInfo> subInfoList = mSubscriptionManager.getActiveSubscriptionInfoList(); List<SubscriptionInfo> subInfoList = mSubscriptionManager.getActiveSubscriptionInfoList();
if (subInfoList != null) { if (subInfoList != null) {
for (SubscriptionInfo subInfo : subInfoList) { for (SubscriptionInfo subInfo : subInfoList) {
if (subInfo.getSubscriptionId() != currentSir.getSubscriptionId()) { if (subInfo.getSubscriptionId() != subId) {
mTelephonyManager.setDataEnabled(subInfo.getSubscriptionId(), false); mTelephonyManager.setDataEnabled(subInfo.getSubscriptionId(), false);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment