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

Commit e32e812b authored by Robert Greenwalt's avatar Robert Greenwalt
Browse files

Always file DUN requests for tethering.

A bit of a hack so that first trySetupData call uses the proper APN in
strange edge cases.  Made a new startUsingNetworkFeature string
that ConnectivityService knows means always pass the request to telephony
even if telephony connections are not currently available.

bug:3133178
Change-Id: I2559b9cbaed4b4ec02bdf7ea78e6003ee2be64f2
parent 08a4186b
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -697,7 +697,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
                usedNetworkType = ConnectivityManager.TYPE_MOBILE_MMS;
                usedNetworkType = ConnectivityManager.TYPE_MOBILE_MMS;
            } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_SUPL)) {
            } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_SUPL)) {
                usedNetworkType = ConnectivityManager.TYPE_MOBILE_SUPL;
                usedNetworkType = ConnectivityManager.TYPE_MOBILE_SUPL;
            } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_DUN)) {
            } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_DUN) ||
                    TextUtils.equals(feature, Phone.FEATURE_ENABLE_DUN_ALWAYS)) {
                usedNetworkType = ConnectivityManager.TYPE_MOBILE_DUN;
                usedNetworkType = ConnectivityManager.TYPE_MOBILE_DUN;
            } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_HIPRI)) {
            } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_HIPRI)) {
                usedNetworkType = ConnectivityManager.TYPE_MOBILE_HIPRI;
                usedNetworkType = ConnectivityManager.TYPE_MOBILE_HIPRI;
@@ -712,7 +713,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {


                if (ni.isAvailable() == false) {
                if (ni.isAvailable() == false) {
                    if (DBG) log("special network not available");
                    if (DBG) log("special network not available");
                    if (!TextUtils.equals(feature,Phone.FEATURE_ENABLE_DUN_ALWAYS)) {
                        return Phone.APN_TYPE_NOT_AVAILABLE;
                        return Phone.APN_TYPE_NOT_AVAILABLE;
                    } else {
                        // else make the attempt anyway - probably giving REQUEST_STARTED below
                    }
                }
                }


                synchronized(this) {
                synchronized(this) {
+2 −2
Original line number Original line Diff line number Diff line
@@ -1138,8 +1138,8 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
                int result = Phone.APN_REQUEST_FAILED;
                int result = Phone.APN_REQUEST_FAILED;
                try {
                try {
                    result = service.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE,
                    result = service.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE,
                            (mDunRequired ? Phone.FEATURE_ENABLE_DUN : Phone.FEATURE_ENABLE_HIPRI),
                            (mDunRequired ? Phone.FEATURE_ENABLE_DUN_ALWAYS :
                            new Binder());
                            Phone.FEATURE_ENABLE_HIPRI), new Binder());
                } catch (Exception e) {
                } catch (Exception e) {
                }
                }
                switch (result) {
                switch (result) {
+1 −0
Original line number Original line Diff line number Diff line
@@ -132,6 +132,7 @@ public interface Phone {
    static final String FEATURE_ENABLE_SUPL = "enableSUPL";
    static final String FEATURE_ENABLE_SUPL = "enableSUPL";
    static final String FEATURE_ENABLE_DUN = "enableDUN";
    static final String FEATURE_ENABLE_DUN = "enableDUN";
    static final String FEATURE_ENABLE_HIPRI = "enableHIPRI";
    static final String FEATURE_ENABLE_HIPRI = "enableHIPRI";
    static final String FEATURE_ENABLE_DUN_ALWAYS = "enableDUNAlways";


    /**
    /**
     * Return codes for <code>enableApnType()</code>
     * Return codes for <code>enableApnType()</code>