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

Commit fa1b4546 authored by Devi Sandeep Endluri V V's avatar Devi Sandeep Endluri V V Committed by Gerrit - the friendly Code Review server
Browse files

Tethering : Enable/Disable IPv6 tethering feature

Enable/Disable IPV6 tethering feature through config value.
Default will enable qti solution and disable aosp solution
Config can be changed to switch between the qti and aosp solutions.
At anytime only one solution will be active.

CRs-Fixed: 1096746
Change-Id: I85feea7e2b4cadcfdad157e14c4eb32d96295612
parent bb102e09
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -261,6 +261,13 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
        return (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
    }

    private boolean  isIpv6TetheringEnabled() {
        int ipv6TetheringEnable = Settings.Global.getInt(mContext.getContentResolver(),
            "enable_aosp_v6_tethering", 0);

        return ipv6TetheringEnable == 1;
    }

    void updateConfiguration() {
        String[] tetherableUsbRegexs = mContext.getResources().getStringArray(
                com.android.internal.R.array.config_tether_usb_regexs);
@@ -2178,7 +2185,7 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
    private void trackNewTetherableInterface(String iface, int interfaceType) {
        TetherState tetherState;
        tetherState = new TetherState(new TetherInterfaceStateMachine(iface, mLooper,
                interfaceType, mNMService, mStatsService, this));
                interfaceType, mNMService, mStatsService, this, isIpv6TetheringEnabled()));
        mTetherStates.put(iface, tetherState);
        tetherState.mStateMachine.start();
    }
+9 −1
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ public class TetherInterfaceStateMachine extends StateMachine {
    private final String mIfaceName;
    private final int mInterfaceType;
    private final IPv6TetheringInterfaceServices mIPv6TetherSvc;
    private boolean mIpv6TetheringEnabled;

    private int mLastError;
    private String mMyUpstreamIfaceName;  // may change over time
@@ -102,6 +103,7 @@ public class TetherInterfaceStateMachine extends StateMachine {
        mIfaceName = ifaceName;
        mInterfaceType = interfaceType;
        mIPv6TetherSvc = new IPv6TetheringInterfaceServices(mIfaceName, mNMService);
        mIpv6TetheringEnabled = false;
        mLastError = ConnectivityManager.TETHER_ERROR_NO_ERROR;

        mInitialState = new InitialState();
@@ -114,6 +116,12 @@ public class TetherInterfaceStateMachine extends StateMachine {
        setInitialState(mInitialState);
    }

    public TetherInterfaceStateMachine(String ifaceName, Looper looper, int interfaceType,
                    INetworkManagementService nMService, INetworkStatsService statsService,
                    IControlsTethering tetherController,boolean Ipv6TetheringEnabled) {
           this(ifaceName,looper,interfaceType,nMService,statsService,tetherController);
           mIpv6TetheringEnabled = Ipv6TetheringEnabled;
    }
    public int interfaceType() {
        return mInterfaceType;
    }
@@ -214,7 +222,7 @@ public class TetherInterfaceStateMachine extends StateMachine {
                return;
            }

            if (!mIPv6TetherSvc.start()) {
            if (mIpv6TetheringEnabled && !mIPv6TetherSvc.start()) {
                Log.e(TAG, "Failed to start IPv6TetheringInterfaceServices");
            }