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

Commit 310d3b6b authored by Wink Saville's avatar Wink Saville Committed by Natiq Ahmed
Browse files

Add subId as parameter for get/setDataEnabled

Bug: 18279333
Change-Id: I2496a2fd92b154e5e6981cbf6b5b5939cda59122
parent 8d961b6c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1398,7 +1398,7 @@ public class ConnectivityManager {
                ITelephony it = ITelephony.Stub.asInterface(b);
                int subId = SubscriptionManager.getDefaultDataSubId();
                Log.d("ConnectivityManager", "getMobileDataEnabled()+ subId=" + subId);
                boolean retVal = it.getDataEnabled();
                boolean retVal = it.getDataEnabled(subId);
                Log.d("ConnectivityManager", "getMobileDataEnabled()- subId=" + subId
                        + " retVal=" + retVal);
                return retVal;
+15 −5
Original line number Diff line number Diff line
@@ -3609,12 +3609,12 @@ public class TelephonyManager {
    /** @hide */
    @SystemApi
    public void setDataEnabled(boolean enable) {
        setDataEnabledUsingSubId(getDefaultSubscription(), enable);
        setDataEnabled(SubscriptionManager.getDefaultDataSubId(), enable);
    }

    /** @hide */
    @SystemApi
    public void setDataEnabledUsingSubId(int subId, boolean enable) {
    public void setDataEnabled(int subId, boolean enable) {
        try {
            AppOpsManager appOps = (AppOpsManager)mContext.getSystemService(Context.APP_OPS_SERVICE);
            if (enable) {
@@ -3623,7 +3623,8 @@ public class TelephonyManager {
                    return;
                }
            }
            getITelephony().setDataEnabledUsingSubId(subId, enable);
            Log.d(TAG, "setDataEnabled: enabled=" + enable);
            getITelephony().setDataEnabled(subId, enable);
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling setDataEnabled", e);
        }
@@ -3632,12 +3633,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;
    }

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

    /**
     * User enable/disable Mobile Data per subscription.
@@ -790,7 +790,7 @@ interface ITelephony {
     *
     * @return true on enabled
     */
    boolean getDataEnabled();
    boolean getDataEnabled(int subId);

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