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

Commit 19b9ab46 authored by Robert Greenwalt's avatar Robert Greenwalt
Browse files

Turn off DUN connection after tethering.

Use matching feature type when turning tethering off or the request is ignored.

Also, turn on DUN apn right away so that we don't fail aggressive test cases.

Also don't report connections for enabled apn's that we're no longer connected to.

bug:3332880
bug:3338033
Change-Id: I7db2dfd4879f03465bc9f6d39488c078570dcaf3
parent 7a8f01ab
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -849,7 +849,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
                    usedNetworkType = ConnectivityManager.TYPE_MOBILE_MMS;
                } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_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;
                } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_HIPRI)) {
                    usedNetworkType = ConnectivityManager.TYPE_MOBILE_HIPRI;
@@ -870,6 +871,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
                    return 1;
                }
                callTeardown = true;
            } else {
                if (DBG) log("not a known feature - dropping");
            }
        }
        if (DBG) log("Doing network teardown");
+4 −3
Original line number Diff line number Diff line
@@ -1165,7 +1165,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
                            IConnectivityManager.Stub.asInterface(b);
                    try {
                        service.stopUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE,
                                (mDunRequired? Phone.FEATURE_ENABLE_DUN :
                                (mDunRequired? Phone.FEATURE_ENABLE_DUN_ALWAYS :
                                             Phone.FEATURE_ENABLE_HIPRI));
                    } catch (Exception e) {
                        return false;
@@ -1354,10 +1354,11 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
        }

        class TetherModeAliveState extends TetherMasterUtilState {
            boolean mTryCell = WAIT_FOR_NETWORK_TO_SETTLE;
            boolean mTryCell = !WAIT_FOR_NETWORK_TO_SETTLE;
            @Override
            public void enter() {
                mTryCell = WAIT_FOR_NETWORK_TO_SETTLE;  // first pass lets just see what we have.
                mTryCell = !WAIT_FOR_NETWORK_TO_SETTLE; // better try something first pass
                                                        // or crazy tests cases will fail
                chooseUpstreamType(mTryCell);
                mTryCell = !mTryCell;
                turnOnMasterTetherSettings(); // may transition us out
+1 −1
Original line number Diff line number Diff line
@@ -358,7 +358,7 @@ public abstract class DataConnectionTracker extends Handler {
        return new ArrayList<DataConnection>(mDataConnections.values());
    }

    protected boolean isApnTypeActive(String type) {
    public boolean isApnTypeActive(String type) {
        // TODO: support simultaneous with List instead
        return mActiveApn != null && mActiveApn.canHandleType(type);
    }
+2 −1
Original line number Diff line number Diff line
@@ -610,7 +610,8 @@ public class CDMAPhone extends PhoneBase {
            // If we're out of service, open TCP sockets may still work
            // but no data will flow
            ret = DataState.DISCONNECTED;
        } else if (mDataConnection.isApnTypeEnabled(apnType) == false) {
        } else if (mDataConnection.isApnTypeEnabled(apnType) == false ||
                mDataConnection.isApnTypeActive(apnType) == false) {
            ret = DataState.DISCONNECTED;
        } else {
            switch (mDataConnection.getState()) {
+2 −1
Original line number Diff line number Diff line
@@ -300,7 +300,8 @@ public class GSMPhone extends PhoneBase {
            // If we're out of service, open TCP sockets may still work
            // but no data will flow
            ret = DataState.DISCONNECTED;
        } else if (mDataConnection.isApnTypeEnabled(apnType) == false) {
        } else if (mDataConnection.isApnTypeEnabled(apnType) == false ||
                mDataConnection.isApnTypeActive(apnType) == false) {
            ret = DataState.DISCONNECTED;
        } else { /* mSST.gprsState == ServiceState.STATE_IN_SERVICE */
            switch (mDataConnection.getState()) {