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

Commit 980e8ba8 authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Dave Langemak
Browse files

Move dis/enable of mobile data to Telephony

ConnectivityService doesn't do this anymore.

bug:15077247
Change-Id: I3208c91b2c0369b594987f39ca29da7478435513
(cherry picked from commit 3a6fa6e9)
parent 245d73b7
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -1246,6 +1246,16 @@ public interface Phone {
     */
     */
    void setDataRoamingEnabled(boolean enable);
    void setDataRoamingEnabled(boolean enable);


    /**
     * @return true if user has enabled data
     */
    boolean getDataEnabled();

    /**
     * @param @enable set {@code true} if enable data connection
     */
    void setDataEnabled(boolean enable);

    /**
    /**
     *  Query the CDMA roaming preference setting
     *  Query the CDMA roaming preference setting
     *
     *
+10 −0
Original line number Original line Diff line number Diff line
@@ -878,6 +878,16 @@ public class PhoneProxy extends Handler implements Phone {
        mActivePhone.setDataRoamingEnabled(enable);
        mActivePhone.setDataRoamingEnabled(enable);
    }
    }


    @Override
    public boolean getDataEnabled() {
        return mActivePhone.getDataEnabled();
    }

    @Override
    public void setDataEnabled(boolean enable) {
        mActivePhone.setDataEnabled(enable);
    }

    @Override
    @Override
    public void queryCdmaRoamingPreference(Message response) {
    public void queryCdmaRoamingPreference(Message response) {
        mActivePhone.queryCdmaRoamingPreference(response);
        mActivePhone.queryCdmaRoamingPreference(response);
+10 −0
Original line number Original line Diff line number Diff line
@@ -796,6 +796,16 @@ public class CDMAPhone extends PhoneBase {
        return mDcTracker.getDataOnRoamingEnabled();
        return mDcTracker.getDataOnRoamingEnabled();
    }
    }


    @Override
    public void setDataEnabled(boolean enable) {
        mDcTracker.setDataEnabled(enable);
    }

    @Override
    public boolean getDataEnabled() {
        return mDcTracker.getDataEnabled();
    }

    @Override
    @Override
    public void setVoiceMailNumber(String alphaTag,
    public void setVoiceMailNumber(String alphaTag,
                                   String voiceMailNumber,
                                   String voiceMailNumber,
+21 −0
Original line number Original line Diff line number Diff line
@@ -682,6 +682,27 @@ public abstract class DcTrackerBase extends Handler {
        }
        }
    }
    }


    /**
     * Modify {@link android.provider.Settings.Global#MOBILE_DATA} value.
     */
    public void setDataEnabled(boolean enable) {
        Message msg = obtainMessage(DctConstants.CMD_SET_USER_DATA_ENABLE);
        msg.arg1 = enable ? 1 : 0;
        sendMessage(msg);
    }

    /**
     * Return current {@link android.provider.Settings.Global#MOBILE_DATA} value.
     */
    public boolean getDataEnabled() {
        try {
            final ContentResolver resolver = mPhone.getContext().getContentResolver();
            return Settings.Global.getInt(resolver, Settings.Global.MOBILE_DATA) != 0;
        } catch (SettingNotFoundException snfe) {
            return false;
        }
    }

    // abstract methods
    // abstract methods
    protected abstract void restartRadio();
    protected abstract void restartRadio();
    protected abstract void log(String s);
    protected abstract void log(String s);
+10 −0
Original line number Original line Diff line number Diff line
@@ -1054,6 +1054,16 @@ public class GSMPhone extends PhoneBase {
        mDcTracker.setDataOnRoamingEnabled(enable);
        mDcTracker.setDataOnRoamingEnabled(enable);
    }
    }


    @Override
    public boolean getDataEnabled() {
        return mDcTracker.getDataEnabled();
    }

    @Override
    public void setDataEnabled(boolean enable) {
        mDcTracker.setDataEnabled(enable);
    }

    /**
    /**
     * Removes the given MMI from the pending list and notifies
     * Removes the given MMI from the pending list and notifies
     * registrants that it is complete.
     * registrants that it is complete.
Loading