Fix multi-sim cell data pref ?
Bug: 26795856 Change-Id: I82e18c21d819d51712a65ccc37e4e3af9a006771
This commit is contained in:
@@ -182,7 +182,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;
|
||||||
}
|
}
|
||||||
@@ -193,14 +193,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);
|
||||||
@@ -208,11 +209,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user