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

Commit 279a9fe1 authored by kaiyiz's avatar kaiyiz Committed by Gerrit - the friendly Code Review server
Browse files

SystemUI: Make DataUsageDetailView show the info for current DDS

DataUsageDetailView obtains the data info by MobileDataController. But
the controller just check the default subscription.

Make MobileDataController acquire and set the info for the current DDS.

CRs-Fixed: 782081

Change-Id: I025266ff60b05a1c83e2c4be34998bdd5f6a2667
parent fa9bddda
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ import android.net.NetworkStatsHistory;
import android.net.NetworkTemplate;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.format.DateUtils;
import android.text.format.Time;
@@ -189,7 +191,8 @@ public class MobileDataController {
    }

    public void setMobileDataEnabled(boolean enabled) {
        mTelephonyManager.setDataEnabled(enabled);
        mTelephonyManager.setDataEnabledUsingSubId(
                SubscriptionManager.getDefaultDataSubId(), enabled);
        if (mCallback != null) {
            mCallback.onMobileDataEnabled(enabled);
        }
@@ -198,16 +201,19 @@ public class MobileDataController {
    public boolean isMobileDataSupported() {
        // require both supported network and ready SIM
        return mConnectivityManager.isNetworkSupported(TYPE_MOBILE)
                && mTelephonyManager.getSimState() == SIM_STATE_READY;
                && mTelephonyManager.getSimState(
                        SubscriptionManager.getDefaultDataPhoneId()) == SIM_STATE_READY;
    }

    public boolean isMobileDataEnabled() {
        return mTelephonyManager.getDataEnabled();
        return Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.MOBILE_DATA + SubscriptionManager.getDefaultDataPhoneId(), 0) != 0;
    }

    private static String getActiveSubscriberId(Context context) {
        final TelephonyManager tele = TelephonyManager.from(context);
        final String actualSubscriberId = tele.getSubscriberId();
        final String actualSubscriberId =
                tele.getSubscriberId(SubscriptionManager.getDefaultDataSubId());
        return actualSubscriberId;
    }