summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Chen <jimmycmchen@google.com>2020-06-15 15:58:11 +0800
committerJimmy Chen <jimmycmchen@google.com>2020-06-15 10:36:01 +0000
commitf9db9eb1fd52975a6570fdd1bd346efb896b890c (patch)
tree1237c91c14f7de54d9acc8be5415b33f5cc7f370
parentc7a1d6a7ddcfad8a3971a76765ec25ad86024f92 (diff)
wifi: remove LTE voice network check for wifi off deferring
LTE can also be available with partial registration with voice network type while IMS is registered on IWLAN as voice network. The fact that IMS is registered over IWLAN would suffice the need of delaying the wifi off (or disconnect) Bug: 158821908 Test: atest FrameworksWifiTests Change-Id: Ifdb3fe2ac4d8fd5679e256cde767fe14d5c8944a
-rw-r--r--service/java/com/android/server/wifi/ClientModeManager.java11
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ClientModeManagerTest.java118
2 files changed, 20 insertions, 109 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeManager.java b/service/java/com/android/server/wifi/ClientModeManager.java
index 608933950..4fb4b870d 100644
--- a/service/java/com/android/server/wifi/ClientModeManager.java
+++ b/service/java/com/android/server/wifi/ClientModeManager.java
@@ -35,7 +35,6 @@ import android.telephony.AccessNetworkConstants;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
import android.telephony.ims.ImsException;
import android.telephony.ims.ImsMmTelManager;
import android.telephony.ims.ImsReasonInfo;
@@ -322,16 +321,6 @@ public class ClientModeManager implements ActiveModeManager {
return 0;
}
- TelephonyManager defaultVoiceTelephonyManager =
- mContext.getSystemService(TelephonyManager.class)
- .createForSubscriptionId(subId);
- // if LTE is available, no delay needed as IMS will be registered over LTE
- if (defaultVoiceTelephonyManager.getVoiceNetworkType()
- == TelephonyManager.NETWORK_TYPE_LTE) {
- Log.d(TAG, "LTE available and is default voice network type");
- return 0;
- }
-
CarrierConfigManager configManager =
(CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
PersistableBundle config = configManager.getConfigForSubId(subId);
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeManagerTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeManagerTest.java
index 1102d1f26..92f3d9bac 100644
--- a/tests/wifitests/src/com/android/server/wifi/ClientModeManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ClientModeManagerTest.java
@@ -52,7 +52,6 @@ import android.telephony.AccessNetworkConstants;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
import android.telephony.ims.ImsMmTelManager;
import android.telephony.ims.RegistrationManager;
import android.test.suitebuilder.annotation.SmallTest;
@@ -96,7 +95,6 @@ public class ClientModeManagerTest extends WifiBaseTest {
@Mock SarManager mSarManager;
@Mock WakeupController mWakeupController;
@Mock ClientModeImpl mClientModeImpl;
- @Mock TelephonyManager mTelephonyManager;
@Mock CarrierConfigManager mCarrierConfigManager;
@Mock PersistableBundle mCarrierConfigBundle;
@Mock ImsMmTelManager mImsMmTelManager;
@@ -125,7 +123,6 @@ public class ClientModeManagerTest extends WifiBaseTest {
* from the context.
*/
private void setUpSystemServiceForContext() {
- when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager);
when(mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE))
.thenReturn(mCarrierConfigManager);
when(mContext.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE))
@@ -199,10 +196,6 @@ public class ClientModeManagerTest extends WifiBaseTest {
when(mActiveSubscriptionInfo.getSubscriptionId()).thenReturn(TEST_ACTIVE_SUBSCRIPTION_ID);
when(mSubscriptionManager.getActiveSubscriptionInfoList())
.thenReturn(mSubscriptionInfoList);
- when(mTelephonyManager.createForSubscriptionId(eq(TEST_ACTIVE_SUBSCRIPTION_ID)))
- .thenReturn(mTelephonyManager);
- when(mTelephonyManager.getVoiceNetworkType())
- .thenReturn(TelephonyManager.NETWORK_TYPE_UNKNOWN);
when(mCarrierConfigManager.getConfigForSubId(anyInt())).thenReturn(mCarrierConfigBundle);
when(mCarrierConfigBundle
.getInt(eq(CarrierConfigManager.Ims.KEY_WIFI_OFF_DEFERRING_TIME_MILLIS_INT)))
@@ -604,7 +597,6 @@ public class ClientModeManagerTest extends WifiBaseTest {
private void setUpVoWifiTest(
boolean isWifiCallingAvailable,
- int voiceNetworkType,
int wifiOffDeferringTimeMs) {
mCurrentImsRegistrationState = (isWifiCallingAvailable)
? RegistrationManager.REGISTRATION_STATE_REGISTERED
@@ -613,8 +605,6 @@ public class ClientModeManagerTest extends WifiBaseTest {
? AccessNetworkConstants.TRANSPORT_TYPE_WLAN
: AccessNetworkConstants.TRANSPORT_TYPE_WWAN;
when(mImsMmTelManager.isAvailable(anyInt(), anyInt())).thenReturn(isWifiCallingAvailable);
- when(mTelephonyManager.getVoiceNetworkType())
- .thenReturn(voiceNetworkType);
when(mCarrierConfigBundle
.getInt(eq(CarrierConfigManager.Ims.KEY_WIFI_OFF_DEFERRING_TIME_MILLIS_INT)))
.thenReturn(wifiOffDeferringTimeMs);
@@ -626,7 +616,6 @@ public class ClientModeManagerTest extends WifiBaseTest {
@Test
public void clientModeStopWithWifiOffDeferringTimeNoWifiCalling() throws Exception {
setUpVoWifiTest(false,
- TelephonyManager.NETWORK_TYPE_UNKNOWN,
TEST_WIFI_OFF_DEFERRING_TIME_MS);
startClientInConnectModeAndVerifyEnabled();
@@ -652,7 +641,6 @@ public class ClientModeManagerTest extends WifiBaseTest {
@Test
public void clientModeStopWithWifiOffDeferringTimeAndImsOnWwan() throws Exception {
setUpVoWifiTest(true,
- TelephonyManager.NETWORK_TYPE_UNKNOWN,
TEST_WIFI_OFF_DEFERRING_TIME_MS);
mCurrentImsConnectionType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN;
@@ -678,41 +666,11 @@ public class ClientModeManagerTest extends WifiBaseTest {
}
/**
- * ClientMode stop properly with IMS deferring time, Wifi calling, and LTE.
+ * ClientMode stop properly with IMS deferring time, Wifi calling.
*/
@Test
- public void clientModeStopWithWifiOffDeferringTimeWithWifiCallingAndLte() throws Exception {
+ public void clientModeStopWithWifiOffDeferringTimeWithWifiCalling() throws Exception {
setUpVoWifiTest(true,
- TelephonyManager.NETWORK_TYPE_LTE,
- TEST_WIFI_OFF_DEFERRING_TIME_MS);
-
- startClientInConnectModeAndVerifyEnabled();
- reset(mContext, mListener);
- setUpSystemServiceForContext();
- mClientModeManager.stop();
- mLooper.dispatchAll();
- verify(mListener).onStopped();
-
- verify(mImsMmTelManager, never()).registerImsRegistrationCallback(any(), any());
- verify(mImsMmTelManager, never()).unregisterImsRegistrationCallback(any());
- verify(mWifiMetrics).noteWifiOff(eq(false), eq(false), anyInt());
-
- verifyConnectModeNotificationsForCleanShutdown(WIFI_STATE_ENABLED);
-
- // on an explicit stop, we should not trigger the callback
- verifyNoMoreInteractions(mListener);
- }
-
- /**
- * ClientMode stop properly with IMS deferring time and Wifi calling, but no LTE.
- *
- * IMS deregistration is done before reaching the timeout.
- */
- @Test
- public void clientModeStopWithWifiOffDeferringTimeAndWifiCallingNoLteOnImsUnregistered()
- throws Exception {
- setUpVoWifiTest(true,
- TelephonyManager.NETWORK_TYPE_UNKNOWN,
TEST_WIFI_OFF_DEFERRING_TIME_MS);
startClientInConnectModeAndVerifyEnabled();
@@ -751,15 +709,14 @@ public class ClientModeManagerTest extends WifiBaseTest {
}
/**
- * ClientMode stop properly with IMS deferring time and Wifi calling, but no LTE.
+ * ClientMode stop properly with IMS deferring time and Wifi calling.
*
* IMS deregistration is done before reaching the timeout.
*/
@Test
- public void clientModeStopWithWifiOffDeferringTimeAndWifiCallingNoLteOnImsRegistered()
+ public void clientModeStopWithWifiOffDeferringTimeAndWifiCallingOnImsRegistered()
throws Exception {
setUpVoWifiTest(true,
- TelephonyManager.NETWORK_TYPE_UNKNOWN,
TEST_WIFI_OFF_DEFERRING_TIME_MS);
startClientInConnectModeAndVerifyEnabled();
@@ -795,15 +752,14 @@ public class ClientModeManagerTest extends WifiBaseTest {
}
/**
- * ClientMode stop properly with IMS deferring time and Wifi calling, but no LTE.
+ * ClientMode stop properly with IMS deferring time and Wifi calling.
*
* IMS deregistration is NOT done before reaching the timeout.
*/
@Test
- public void clientModeStopWithWifiOffDeferringTimeAndWifiCallingNoLteTimedOut()
+ public void clientModeStopWithWifiOffDeferringTimeAndWifiCallingTimedOut()
throws Exception {
setUpVoWifiTest(true,
- TelephonyManager.NETWORK_TYPE_UNKNOWN,
TEST_WIFI_OFF_DEFERRING_TIME_MS);
startClientInConnectModeAndVerifyEnabled();
@@ -840,15 +796,14 @@ public class ClientModeManagerTest extends WifiBaseTest {
}
/**
- * ClientMode stop properly with IMS deferring time and Wifi calling, but no LTE.
+ * ClientMode stop properly with IMS deferring time and Wifi calling.
*
* IMS deregistration is NOT done before reaching the timeout with multiple stop calls.
*/
@Test
- public void clientModeStopWithWifiOffDeferringTimeAndWifiCallingNoLteTimedOutMultipleStop()
+ public void clientModeStopWithWifiOffDeferringTimeAndWifiCallingTimedOutMultipleStop()
throws Exception {
setUpVoWifiTest(true,
- TelephonyManager.NETWORK_TYPE_UNKNOWN,
TEST_WIFI_OFF_DEFERRING_TIME_MS);
startClientInConnectModeAndVerifyEnabled();
@@ -888,17 +843,16 @@ public class ClientModeManagerTest extends WifiBaseTest {
}
/**
- * ClientMode does not stop with IMS deferring time and Wifi calling, but no LTE
+ * ClientMode does not stop with IMS deferring time and Wifi calling
* when the target role is not ROLE_UNSPECIFIED.
*
* Simulate a user toggle wifi multiple times before doing wifi stop and stay at
* ON position.
*/
@Test
- public void clientModeNotStopWithWifiOffDeferringTimeAndWifiCallingNoLteTimedOut()
+ public void clientModeNotStopWithWifiOffDeferringTimeAndWifiCallingTimedOut()
throws Exception {
setUpVoWifiTest(true,
- TelephonyManager.NETWORK_TYPE_UNKNOWN,
TEST_WIFI_OFF_DEFERRING_TIME_MS);
startClientInConnectModeAndVerifyEnabled();
@@ -947,7 +901,6 @@ public class ClientModeManagerTest extends WifiBaseTest {
@Test
public void switchToScanOnlyModeWithWifiOffDeferringTimeNoWifiCalling() throws Exception {
setUpVoWifiTest(false,
- TelephonyManager.NETWORK_TYPE_UNKNOWN,
TEST_WIFI_OFF_DEFERRING_TIME_MS);
startClientInConnectModeAndVerifyEnabled();
@@ -971,7 +924,6 @@ public class ClientModeManagerTest extends WifiBaseTest {
@Test
public void switchToScanOnlyModeWithWifiOffDeferringTimeAndImsOnWwan() throws Exception {
setUpVoWifiTest(true,
- TelephonyManager.NETWORK_TYPE_UNKNOWN,
TEST_WIFI_OFF_DEFERRING_TIME_MS);
mCurrentImsConnectionType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN;
@@ -996,40 +948,14 @@ public class ClientModeManagerTest extends WifiBaseTest {
}
/**
- * Switch to scan mode properly with IMS deferring time, Wifi calling, and LTE.
- */
- @Test
- public void
- switchToScanOnlyModeWithWifiOffDeferringTimeAndWifiCallingAndLte() throws Exception {
- setUpVoWifiTest(true,
- TelephonyManager.NETWORK_TYPE_LTE,
- TEST_WIFI_OFF_DEFERRING_TIME_MS);
-
- startClientInConnectModeAndVerifyEnabled();
- reset(mContext, mListener);
- setUpSystemServiceForContext();
- when(mWifiNative.switchClientInterfaceToScanMode(any()))
- .thenReturn(true);
-
- mClientModeManager.setRole(ActiveModeManager.ROLE_CLIENT_SCAN_ONLY);
- mLooper.dispatchAll();
-
- verify(mWifiNative).switchClientInterfaceToScanMode(TEST_INTERFACE_NAME);
- verify(mImsMmTelManager, never()).registerImsRegistrationCallback(any(), any());
- verify(mImsMmTelManager, never()).unregisterImsRegistrationCallback(any());
- verify(mWifiMetrics).noteWifiOff(eq(false), eq(false), anyInt());
- }
-
- /**
- * Switch to scan mode properly with IMS deferring time and Wifi calling, but no LTE.
+ * Switch to scan mode properly with IMS deferring time and Wifi calling.
*
* IMS deregistration is done before reaching the timeout.
*/
@Test
- public void switchToScanOnlyModeWithWifiOffDeferringTimeAndWifiCallingNoLteOnImsUnregistered()
+ public void switchToScanOnlyModeWithWifiOffDeferringTimeAndWifiCallingOnImsUnregistered()
throws Exception {
setUpVoWifiTest(true,
- TelephonyManager.NETWORK_TYPE_UNKNOWN,
TEST_WIFI_OFF_DEFERRING_TIME_MS);
startClientInConnectModeAndVerifyEnabled();
@@ -1066,15 +992,14 @@ public class ClientModeManagerTest extends WifiBaseTest {
}
/**
- * Switch to scan mode properly with IMS deferring time and Wifi calling, but no LTE.
+ * Switch to scan mode properly with IMS deferring time and Wifi calling.
*
* IMS deregistration is done before reaching the timeout.
*/
@Test
- public void switchToScanOnlyModeWithWifiOffDeferringTimeAndWifiCallingNoLteOnImsRegistered()
+ public void switchToScanOnlyModeWithWifiOffDeferringTimeAndWifiCallingOnImsRegistered()
throws Exception {
setUpVoWifiTest(true,
- TelephonyManager.NETWORK_TYPE_UNKNOWN,
TEST_WIFI_OFF_DEFERRING_TIME_MS);
startClientInConnectModeAndVerifyEnabled();
@@ -1108,15 +1033,14 @@ public class ClientModeManagerTest extends WifiBaseTest {
}
/**
- * Switch to scan mode properly with IMS deferring time and Wifi calling, but no LTE.
+ * Switch to scan mode properly with IMS deferring time and Wifi calling.
*
* IMS deregistration is NOT done before reaching the timeout.
*/
@Test
- public void switchToScanOnlyModeWithWifiOffDeferringTimeAndWifiCallingNoLteTimedOut()
+ public void switchToScanOnlyModeWithWifiOffDeferringTimeAndWifiCallingTimedOut()
throws Exception {
setUpVoWifiTest(true,
- TelephonyManager.NETWORK_TYPE_UNKNOWN,
TEST_WIFI_OFF_DEFERRING_TIME_MS);
startClientInConnectModeAndVerifyEnabled();
@@ -1152,16 +1076,15 @@ public class ClientModeManagerTest extends WifiBaseTest {
}
/**
- * Switch to scan mode properly with IMS deferring time and Wifi calling, but no LTE.
+ * Switch to scan mode properly with IMS deferring time and Wifi calling.
*
* IMS deregistration is NOT done before reaching the timeout with multiple stop calls.
*/
@Test
public void
- switchToScanOnlyModeWithWifiOffDeferringTimeAndWifiCallingNoLteTimedOutMultipleSwitch()
+ switchToScanOnlyModeWithWifiOffDeferringTimeAndWifiCallingTimedOutMultipleSwitch()
throws Exception {
setUpVoWifiTest(true,
- TelephonyManager.NETWORK_TYPE_UNKNOWN,
TEST_WIFI_OFF_DEFERRING_TIME_MS);
startClientInConnectModeAndVerifyEnabled();
@@ -1199,7 +1122,7 @@ public class ClientModeManagerTest extends WifiBaseTest {
}
/**
- * Stay at connected mode with IMS deferring time and Wifi calling, but no LTE
+ * Stay at connected mode with IMS deferring time and Wifi calling
* when the target state is not ROLE_CLIENT_SCAN_ONLY.
*
* Simulate a user toggle wifi multiple times before doing wifi stop and stay at
@@ -1207,10 +1130,9 @@ public class ClientModeManagerTest extends WifiBaseTest {
*/
@Test
public void
- stayAtConnectedModeWithWifiOffDeferringTimeAndWifiCallingNoLteTimedOutMultipleSwitch()
+ stayAtConnectedModeWithWifiOffDeferringTimeAndWifiCallingTimedOutMultipleSwitch()
throws Exception {
setUpVoWifiTest(true,
- TelephonyManager.NETWORK_TYPE_UNKNOWN,
TEST_WIFI_OFF_DEFERRING_TIME_MS);
startClientInConnectModeAndVerifyEnabled();