Loading packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java +1 −1 Original line number Diff line number Diff line Loading @@ -456,7 +456,7 @@ public class Tethering { mLog.e("setWifiTethering: failed to get WifiManager!"); return TETHER_ERROR_SERVICE_UNAVAIL; } if ((enable && mgr.startSoftAp(null /* use existing wifi config */)) if ((enable && mgr.startTetheredHotspot(null /* use existing softap config */)) || (!enable && mgr.stopSoftAp())) { mWifiTetherRequested = enable; return TETHER_ERROR_NO_ERROR; Loading packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringTest.java +8 −8 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ import android.net.ip.RouterAdvertisementDaemon; import android.net.util.InterfaceParams; import android.net.util.NetworkConstants; import android.net.util.SharedLog; import android.net.wifi.WifiConfiguration; import android.net.wifi.SoftApConfiguration; import android.net.wifi.WifiManager; import android.net.wifi.p2p.WifiP2pGroup; import android.net.wifi.p2p.WifiP2pInfo; Loading Loading @@ -806,12 +806,12 @@ public class TetheringTest { // TODO: Test with and without interfaceStatusChanged(). @Test public void failingWifiTetheringLegacyApBroadcast() throws Exception { when(mWifiManager.startSoftAp(any(WifiConfiguration.class))).thenReturn(true); when(mWifiManager.startTetheredHotspot(any(SoftApConfiguration.class))).thenReturn(true); // Emulate pressing the WiFi tethering button. mTethering.startTethering(TETHERING_WIFI, null, false); mLooper.dispatchAll(); verify(mWifiManager, times(1)).startSoftAp(null); verify(mWifiManager, times(1)).startTetheredHotspot(null); verifyNoMoreInteractions(mWifiManager); verifyNoMoreInteractions(mNMService); Loading @@ -833,12 +833,12 @@ public class TetheringTest { // TODO: Test with and without interfaceStatusChanged(). @Test public void workingWifiTetheringEnrichedApBroadcast() throws Exception { when(mWifiManager.startSoftAp(any(WifiConfiguration.class))).thenReturn(true); when(mWifiManager.startTetheredHotspot(any(SoftApConfiguration.class))).thenReturn(true); // Emulate pressing the WiFi tethering button. mTethering.startTethering(TETHERING_WIFI, null, false); mLooper.dispatchAll(); verify(mWifiManager, times(1)).startSoftAp(null); verify(mWifiManager, times(1)).startTetheredHotspot(null); verifyNoMoreInteractions(mWifiManager); verifyNoMoreInteractions(mNMService); Loading Loading @@ -907,13 +907,13 @@ public class TetheringTest { // TODO: Test with and without interfaceStatusChanged(). @Test public void failureEnablingIpForwarding() throws Exception { when(mWifiManager.startSoftAp(any(WifiConfiguration.class))).thenReturn(true); when(mWifiManager.startTetheredHotspot(any(SoftApConfiguration.class))).thenReturn(true); doThrow(new RemoteException()).when(mNMService).setIpForwardingEnabled(true); // Emulate pressing the WiFi tethering button. mTethering.startTethering(TETHERING_WIFI, null, false); mLooper.dispatchAll(); verify(mWifiManager, times(1)).startSoftAp(null); verify(mWifiManager, times(1)).startTetheredHotspot(null); verifyNoMoreInteractions(mWifiManager); verifyNoMoreInteractions(mNMService); Loading Loading @@ -1155,7 +1155,7 @@ public class TetheringTest { when(mUpstreamNetworkMonitor.getCurrentPreferredUpstream()).thenReturn(upstreamState); when(mUpstreamNetworkMonitor.selectPreferredUpstreamType(any())) .thenReturn(upstreamState); when(mWifiManager.startSoftAp(any(WifiConfiguration.class))).thenReturn(true); when(mWifiManager.startTetheredHotspot(any(SoftApConfiguration.class))).thenReturn(true); mTethering.interfaceStatusChanged(TEST_WLAN_IFNAME, true); mLooper.dispatchAll(); tetherState = callback.pollTetherStatesChanged(); Loading Loading
packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java +1 −1 Original line number Diff line number Diff line Loading @@ -456,7 +456,7 @@ public class Tethering { mLog.e("setWifiTethering: failed to get WifiManager!"); return TETHER_ERROR_SERVICE_UNAVAIL; } if ((enable && mgr.startSoftAp(null /* use existing wifi config */)) if ((enable && mgr.startTetheredHotspot(null /* use existing softap config */)) || (!enable && mgr.stopSoftAp())) { mWifiTetherRequested = enable; return TETHER_ERROR_NO_ERROR; Loading
packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringTest.java +8 −8 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ import android.net.ip.RouterAdvertisementDaemon; import android.net.util.InterfaceParams; import android.net.util.NetworkConstants; import android.net.util.SharedLog; import android.net.wifi.WifiConfiguration; import android.net.wifi.SoftApConfiguration; import android.net.wifi.WifiManager; import android.net.wifi.p2p.WifiP2pGroup; import android.net.wifi.p2p.WifiP2pInfo; Loading Loading @@ -806,12 +806,12 @@ public class TetheringTest { // TODO: Test with and without interfaceStatusChanged(). @Test public void failingWifiTetheringLegacyApBroadcast() throws Exception { when(mWifiManager.startSoftAp(any(WifiConfiguration.class))).thenReturn(true); when(mWifiManager.startTetheredHotspot(any(SoftApConfiguration.class))).thenReturn(true); // Emulate pressing the WiFi tethering button. mTethering.startTethering(TETHERING_WIFI, null, false); mLooper.dispatchAll(); verify(mWifiManager, times(1)).startSoftAp(null); verify(mWifiManager, times(1)).startTetheredHotspot(null); verifyNoMoreInteractions(mWifiManager); verifyNoMoreInteractions(mNMService); Loading @@ -833,12 +833,12 @@ public class TetheringTest { // TODO: Test with and without interfaceStatusChanged(). @Test public void workingWifiTetheringEnrichedApBroadcast() throws Exception { when(mWifiManager.startSoftAp(any(WifiConfiguration.class))).thenReturn(true); when(mWifiManager.startTetheredHotspot(any(SoftApConfiguration.class))).thenReturn(true); // Emulate pressing the WiFi tethering button. mTethering.startTethering(TETHERING_WIFI, null, false); mLooper.dispatchAll(); verify(mWifiManager, times(1)).startSoftAp(null); verify(mWifiManager, times(1)).startTetheredHotspot(null); verifyNoMoreInteractions(mWifiManager); verifyNoMoreInteractions(mNMService); Loading Loading @@ -907,13 +907,13 @@ public class TetheringTest { // TODO: Test with and without interfaceStatusChanged(). @Test public void failureEnablingIpForwarding() throws Exception { when(mWifiManager.startSoftAp(any(WifiConfiguration.class))).thenReturn(true); when(mWifiManager.startTetheredHotspot(any(SoftApConfiguration.class))).thenReturn(true); doThrow(new RemoteException()).when(mNMService).setIpForwardingEnabled(true); // Emulate pressing the WiFi tethering button. mTethering.startTethering(TETHERING_WIFI, null, false); mLooper.dispatchAll(); verify(mWifiManager, times(1)).startSoftAp(null); verify(mWifiManager, times(1)).startTetheredHotspot(null); verifyNoMoreInteractions(mWifiManager); verifyNoMoreInteractions(mNMService); Loading Loading @@ -1155,7 +1155,7 @@ public class TetheringTest { when(mUpstreamNetworkMonitor.getCurrentPreferredUpstream()).thenReturn(upstreamState); when(mUpstreamNetworkMonitor.selectPreferredUpstreamType(any())) .thenReturn(upstreamState); when(mWifiManager.startSoftAp(any(WifiConfiguration.class))).thenReturn(true); when(mWifiManager.startTetheredHotspot(any(SoftApConfiguration.class))).thenReturn(true); mTethering.interfaceStatusChanged(TEST_WLAN_IFNAME, true); mLooper.dispatchAll(); tetherState = callback.pollTetherStatesChanged(); Loading