Fix multi-sim popup issue in data usage.

+ Avoid sending popup dialog when data is enabled on currently active
data sim.

Bug: 31736014
Change-Id: I60e9e049f546cb176283bc4c4e20cb2d3e7ac386
This commit is contained in:
Sanket Padawe
2016-10-14 15:41:52 -07:00
parent 1146d6375c
commit 8591f26fa3

View File

@@ -111,11 +111,10 @@ public class CellDataPreference extends CustomDialogPreference implements Templa
@Override
protected void performClick(View view) {
MetricsLogger.action(getContext(), MetricsEvent.ACTION_CELL_DATA_TOGGLE, !mChecked);
if (mChecked) {
final SubscriptionInfo currentSir = mSubscriptionManager.getActiveSubscriptionInfo(
mSubId);
final SubscriptionInfo nextSir = mSubscriptionManager.getDefaultDataSubscriptionInfo();
if (mChecked) {
// If the device is single SIM or is enabling data on the active data SIM then forgo
// the pop-up.
if (!Utils.showSimCardTile(getContext()) ||
@@ -136,6 +135,12 @@ public class CellDataPreference extends CustomDialogPreference implements Templa
// If we are showing the Sim Card tile then we are a Multi-Sim device.
if (Utils.showSimCardTile(getContext())) {
mMultiSimDialog = true;
if (nextSir != null && currentSir != null &&
currentSir.getSubscriptionId() == nextSir.getSubscriptionId()) {
setMobileDataEnabled(true);
disableDataForOtherSubscriptions(mSubId);
return;
}
super.performClick(view);
} else {
setMobileDataEnabled(true);