Upon changing the default SIM card, the radio will create a
new connection to the new subscription. If that subscription
works correctly, the stack will prefer it to the old one as
the new subscription will be marked with a Primary policy
flag it its score.
Normally, at this point the old network lingers to give apps
an opportunity to gracefully migrate their connections. But
with some radios, this may have a dramatic effect on the
performance of the new connection.
This patch introduces a flag so that devices with such radios
can be marked. In this case the stack will move to a degraded
mode and eschew the grace delay for apps and give them a hard
break instead, so that the new network can reach a good
performance immediately. Apps with existing connections will
suffer a worse experience.
If there is a request that can only be served by the old
connection, still keep it, as arguably the user still
expects their MMS be sent on the old connection, even if the
new connection doesn't work well until it's done.
Test: new test in this patch, and add relevant tests in both modes
also manually change the value of the flag and run
FrameworksNetTests and CtsNetTestCasesLatestSdk
Bug: 200226979
Change-Id: I4ace82f90e873bf06298cc689bb1d794ed5124bd
Add two test cases for matchesMobile and matchesMobileWildcard
Bug: 183776809
Test: FrameworksNetTests:NetworkTemplateTest
Change-Id: I14d31071655204fe6ad36c71f7f521640e01c96e
testRestrictedNetworkPermission would fail on Q image because
NetworkCapabilities#Builder method is not existed on Android Q.
Bug: 199686391
Test: atest CtsNetTestCasesLatestSdk:ConnectivityManagerTest#\
testRestrictedNetworkPermission on Q device.
Change-Id: I94b3551fce15489983ac159504cafe25c46fbe72
Before sForceAllNetworkTypes is removed, the network
type and meteredness will be ignored when matchesMobile
or matchesMobileWildcard is called.
After sForceAllNetworkTypes is removed, the matches
method should check the network type and the meteredness.
Thus, if the test data contains different type or it's
not metered should not be counted.
Bug: 183776809
Test: FrameworksNetTests
Change-Id: Ie7194495d26c0f5ef7a247733f43c64688626c67
It is flaky and redundant, functionality is covered in
ConnectivityManagerTest
Bug: 191856806
Test: N/A
Change-Id: I786f69f6f6cfb73e99cc5dea867024007f44d134
OEM_NETWORK_PREFERENCE_TEST prefers NOT_METERED&VALIDATED networks
then TEST networks. If the WiFi isn't validated by the time the
preference is set, then the TEST network is preferred and the test
fails. The best solution is simply to wait for the WiFi network to
validate before setting the preference.
Besides, some of the *wait* methods wait for validation and some
don't, creating confusion. Make this explicit on the
setWifiMeteredStatusAndWait method with a boolean argument, which
forces all users to make an explicit choice.
testSetOemNetworkPreferenceForTestOnlyPref is not affected, as
it does not change WiFi meteredness.
Bug: 195365654
Test: testSetOemNetworkPreferenceForTestPref
Change-Id: Icb9d7ff1ca5c3d93286ea3a79c27f15630d17ee6
Suspended network should be considered as temporary shortage of
connectivity of a connected network. Thus, it should not be
excluded from network state snapshots and causes data usage to
stop accounting or iptables rules to be removed on the interface
of the suspended network.
This change also address the naming confusion of default networks
parameter of expectNotifyNetworkStatus.
Test: atest ConnectivityServiceTest#testGetAllNetworkStateSnapshots
Bug: 196079981
Change-Id: I8096356f9a472fb1c1246fbdf3fd5f981387fb1c
- This method always reuturns false which is not able to use for
testing.
- Use test restricted network for testing instead.
Bug: 183485986
Test: atest ConnectivityManagerTest
Change-Id: If34d4f1952162f118d53be8074a96b07415a5c85
- This is a test only change.
- Remove calling startMonitoring() in setup() because this method
should be called only once, so each test needs to call
startMonitoring() if the testing function is running on it.
- Return empty list instead of null when getting installed
pacakges in setup(). This can help test to have default user
MOCK_USER1 when they call startMonitoring().
Bug: 192431153
Test: atests FrameworksNetTests
Change-Id: Id2ffb056b378873c3ba6a8bb31b7dedb56ad6d46