Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e1baa2a authored by Marcos Marado's avatar Marcos Marado Committed by Ed Carrigan
Browse files

MSIM: Data Usage: data connection switch visibility

If the device is DSDS or TSTS, show the data connection switch only
on the tab for the SIM which has been chosen for mobile data

Change-Id: Ie38816122e9fb4f195d2c27e0e84173094eed9e3
parent baa40b06
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -768,6 +768,17 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
            for (int i = 0; i < TelephonyManager.getDefault()
                    .getPhoneCount(); i++) {
                if (currentTab.equals(getSubTag(i+1))) {
                    if (TelephonyManager.getDefault().getMultiSimConfiguration() ==
                            TelephonyManager.MultiSimVariants.DSDS ||
                            TelephonyManager.getDefault().getMultiSimConfiguration() ==
                            TelephonyManager.MultiSimVariants.TSTS) {
                        // only one of the SIMs can have Data enabled, so...
                        if (SubscriptionManager.getDefaultDataPhoneId() == i) {
                            mDataEnabledView.setVisibility(View.VISIBLE);
                        } else {
                            mDataEnabledView.setVisibility(View.GONE);
                        }
                    }
                    setPreferenceTitle(mDataEnabledView,
                            R.string.data_usage_enable_mobile);
                    setPreferenceTitle(mDisableAtLimitView,
@@ -1024,6 +1035,16 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
        boolean dataEnabledVisible = mDataEnabledSupported;
        boolean disableAtLimitVisible = mDisableAtLimitSupported;

        if (dataEnabledVisible &&
            (TelephonyManager.getDefault().getMultiSimConfiguration()
                == TelephonyManager.MultiSimVariants.DSDS
            || TelephonyManager.getDefault().getMultiSimConfiguration()
                == TelephonyManager.MultiSimVariants.TSTS) &&
            (!mTabHost.getCurrentTabTag().equals(getSubTag(SubscriptionManager.getDefaultDataPhoneId()+1)))
        ) {
            dataEnabledVisible = false;
        }

        if (isAppDetailMode()) {
            dataEnabledVisible = false;
            disableAtLimitVisible = false;