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

Commit 3f4b141f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Tethering : Enable/Disable IPv6 tethering feature"

parents 6466bd57 fa1b4546
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");
            }