Merge "Create a TetherInterfaceStateMachine when told the interface name."
am: 51ee00785c
Change-Id: If79a096375e6b9665d5ba4aa0bcd9dbec6a8adab
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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.
|
||||
mTethering.interfaceStatusChanged(mTestIfname, true);
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user