Loading services/core/java/com/android/server/connectivity/Tethering.java +4 −0 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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"); Loading tests/net/java/com/android/server/connectivity/TetheringTest.java +12 −4 Original line number Diff line number Diff line Loading @@ -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 { Loading Loading @@ -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 { Loading Loading
services/core/java/com/android/server/connectivity/Tethering.java +4 −0 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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"); Loading
tests/net/java/com/android/server/connectivity/TetheringTest.java +12 −4 Original line number Diff line number Diff line Loading @@ -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 { Loading Loading @@ -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 { Loading