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

Commit 9e6b6e2a authored by Erik Kline's avatar Erik Kline Committed by android-build-merger
Browse files

Merge "Create a TetherInterfaceStateMachine when told the interface name."

am: 51ee0078

Change-Id: If79a096375e6b9665d5ba4aa0bcd9dbec6a8adab
parents ca0c91b9 51ee0078
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -877,6 +877,7 @@ public class Tethering extends BaseNetworkObserver {
        }

        if (!TextUtils.isEmpty(ifname)) {
            maybeTrackNewInterfaceLocked(ifname, ConnectivityManager.TETHERING_WIFI);
            changeInterfaceState(ifname, ipServingMode);
        } else {
            tetherMatchingInterfaces(ipServingMode, ConnectivityManager.TETHERING_WIFI);
@@ -1800,7 +1801,10 @@ public class Tethering extends BaseNetworkObserver {
            mLog.log(iface + " is not a tetherable iface, ignoring");
            return;
        }
        maybeTrackNewInterfaceLocked(iface, interfaceType);
    }

    private void maybeTrackNewInterfaceLocked(final String iface, int interfaceType) {
        // If we have already started a TISM for this interface, skip.
        if (mTetherStates.containsKey(iface)) {
            mLog.log("active iface (" + iface + ") reported as added, ignoring");
+12 −4
Original line number Diff line number Diff line
@@ -264,13 +264,16 @@ public class TetheringTest {
        mIntents.remove(bcast);
    }

    public void workingLocalOnlyHotspot(boolean enrichedApBroadcast) throws Exception {
    public void workingLocalOnlyHotspot(
            boolean withInterfaceStateChanged, boolean enrichedApBroadcast) throws Exception {
        when(mConnectivityManager.isTetheringSupported()).thenReturn(true);

        // Emulate externally-visible WifiManager effects, causing the
        // per-interface state machine to start up, and telling us that
        // hotspot mode is to be started.
        if (withInterfaceStateChanged) {
            mTethering.interfaceStatusChanged(mTestIfname, true);
        }
        if (enrichedApBroadcast) {
            sendWifiApStateChanged(WIFI_AP_STATE_ENABLED, mTestIfname, IFACE_IP_MODE_LOCAL_ONLY);
        } else {
@@ -320,12 +323,17 @@ public class TetheringTest {

    @Test
    public void workingLocalOnlyHotspotLegacyApBroadcast() throws Exception {
        workingLocalOnlyHotspot(false);
        workingLocalOnlyHotspot(true, false);
    }

    @Test
    public void workingLocalOnlyHotspotEnrichedApBroadcast() throws Exception {
        workingLocalOnlyHotspot(true);
        workingLocalOnlyHotspot(true, true);
    }

    @Test
    public void workingLocalOnlyHotspotEnrichedApBroadcastWithoutInterfaceUp() throws Exception {
        workingLocalOnlyHotspot(false, true);
    }

    public void workingWifiTethering(boolean enrichedApBroadcast) throws Exception {