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

Commit 15b29ac7 authored by Wink Saville's avatar Wink Saville Committed by Android (Google) Code Review
Browse files

Merge "Add subId as parameter for get/setDataEnabled." into lmp-mr1-dev

parents 2f4ced30 36ffb049
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.os.Messenger;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.ArrayMap;
import android.util.Log;
@@ -1295,9 +1296,15 @@ public class ConnectivityManager {
        if (b != null) {
            try {
                ITelephony it = ITelephony.Stub.asInterface(b);
                return it.getDataEnabled();
                int subId = SubscriptionManager.getDefaultDataSubId();
                Log.d("ConnectivityManager", "getMobileDataEnabled()+ subId=" + subId);
                boolean retVal = it.getDataEnabled(subId);
                Log.d("ConnectivityManager", "getMobileDataEnabled()- subId=" + subId
                        + " retVal=" + retVal);
                return retVal;
            } catch (RemoteException e) { }
        }
        Log.d("ConnectivityManager", "getMobileDataEnabled()- remote exception retVal=false");
        return false;
    }

+1 −0
Original line number Diff line number Diff line
@@ -196,6 +196,7 @@ public class MobileDataControllerImpl implements NetworkController.MobileDataCon
    }

    public void setMobileDataEnabled(boolean enabled) {
        Log.d(TAG, "setMobileDataEnabled: enabled=" + enabled);
        mTelephonyManager.setDataEnabled(enabled);
        if (mCallback != null) {
            mCallback.onMobileDataEnabled(enabled);
+19 −3
Original line number Diff line number Diff line
@@ -3509,8 +3509,15 @@ public class TelephonyManager {
    /** @hide */
    @SystemApi
    public void setDataEnabled(boolean enable) {
        setDataEnabled(SubscriptionManager.getDefaultDataSubId(), enable);
    }

    /** @hide */
    @SystemApi
    public void setDataEnabled(int subId, boolean enable) {
        try {
            getITelephony().setDataEnabled(enable);
            Log.d(TAG, "setDataEnabled: enabled=" + enable);
            getITelephony().setDataEnabled(subId, enable);
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelephony#setDataEnabled", e);
        }
@@ -3519,12 +3526,21 @@ public class TelephonyManager {
    /** @hide */
    @SystemApi
    public boolean getDataEnabled() {
        return getDataEnabled(SubscriptionManager.getDefaultDataSubId());
    }

    /** @hide */
    @SystemApi
    public boolean getDataEnabled(int subId) {
        boolean retVal;
        try {
            return getITelephony().getDataEnabled();
            retVal = getITelephony().getDataEnabled(subId);
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelephony#getDataEnabled", e);
            retVal = false;
        }
        return false;
        Log.d(TAG, "getDataEnabled: retVal=" + retVal);
        return retVal;
    }

    /**
+2 −2
Original line number Diff line number Diff line
@@ -679,14 +679,14 @@ interface ITelephony {
     *
     * @param enable true to turn on, else false
     */
    void setDataEnabled(boolean enable);
    void setDataEnabled(int subId, boolean enable);

    /**
     * Get the user enabled state of Mobile Data.
     *
     * @return true on enabled
     */
    boolean getDataEnabled();
    boolean getDataEnabled(int subId);

    /**
     * Get P-CSCF address from PCO after data connection is established or modified.