This is a part of preliminary work for sending a v6 NAT-T
keepalive packet in a v6 only network. This commit
release the constraint on constructing a v6 NAT-T keepalive
packet.
Bug: 196453719
Test: Manually connect to v6 only network and check if the
keepalive packets are sent with subsequent commit
Test: atest FrameworksNetTests with the updated test
Change-Id: I9dc96e840265c5dee6b9e3ef2b3901a0aeb4ff9e
Fix the bug where subscription IDs will be cleared
on a restricted test network
Bug: 263415068
Test: NetworkCapabilitiesTest
Change-Id: I977781cd81f9d86858bd264825d66a2a69f6ce53
This commit expands the allowed capabilities of non cellular test
networks to include another three values, so that CTS can verify
features that do network selection based on those capabilities.
It is relatively safe becuase for apps that request TRANSPORT_CELLULAR
and the affected capabilities, test networks will still not become their
default networks.
Bug: 263415068
Test: atest NetworkCapabilitiesTest(new tests)
Change-Id: I2e348e4722ecdaa6e277fe77968916ffa2f16af9
Somewhat surprisingly, HandlerThread#quitSafely is *not* a synchronous
method, so the tearDown() method still needs to wait for the thread to
join.
Test: TH
Change-Id: I0433e2100adf9299a67af5c259a518cf44f4be57
This tests @hide API which doesn't really officially supported.
Removed from coverage test.
Test: build, FrameworksNetTests
Change-Id: I6375e7713b8ae67486b3df80d13c19b3adaa3560
A template with type MATCH_MOBILE could have empty subscriber
IDs but it should not contain one of subscriber IDs is null.
An app might still build a template through the constructor
which is annotated with @UnsupportedAppUsage. NetworkTemplate
will throw an exception when the app trying to construct a
template with type *_WILDCARD. The constructor should be
backward compatible with old version so this change is to add
the backward compatibility to have NetworkTemplate not throw
an exception.
Bug: 267701889
Test: FrameworksNetTests
Change-Id: I23a607dae508e0c53520e2edf187cb611ed36b68
ConnectivityCompatChanges.java becomes the centralized place for all the
CompatChanges used in the Connectivity module. By putting all the
CompatChanges here, we are able to manage them under a single
platform_compat_config.
Bug: 268440216
Test: atest FrameworksNetTests
Change-Id: I3e17af545718073d7d1c96e27298e7790563fd33
NetworkTemplate was moved into mainline module and
provide Builder for external users to build template.
MATCH_MOBILE_WILDCARD and MATCH_WIFI_WILDCARD are not
exposed so currently the usage of these two constants
only in module. This change is to remove the constants.
After removing the constants, two methods matchesWifi
and matchesMobile are changed to adapt the original
matches[Wifi|Mobile]Wildcard behavior.
Bug: 238843364
Test: FrameworksNetTests
Change-Id: I9e156b504ce4eb903b39279e443fad27bc921186
Currently NetworkTemplate provides Builder for users to build a
template and it supports multiple subscriber ids. The mSubscriberId
is a local variable in current design so it can be removed from
NetworkTemplate and also can be removed from the parameter of a
constructor as long as the constructor is not annotated with
@UnsupportedAppUsage.
Bug: 238843364
Test: build, FrameworksNetTests
CtsNetTestCases
Change-Id: Ic6a695e1c1719111bf26ba905a38673952a24736
Currently, mSubscriberIdMatchRule is only used in NetworkTemplate
and it depends on if mMatchSubscriberIds is empty or not. Thus,
remove it since is not really necessary and replace it with
checking matchSubscriberIds if needed.
Bug: 238843364
Test: build, FrameworksNetTests
CtsNetTestCases
Change-Id: Ic66d2ff2826846778b004bb15a4718a62fa1f470
Add VpnTransportInfo.areLongLivedTcpConnectionsExpensive() in API
surface to allow privileged apps to know whether the long-lived
TCP connections should be expensive in the VPN network.
This is expected to be used combined with getBypassable()
because connections should always go through a VPN that is not
bypassable.
Bug: 259000745
Test: atest FrameworksNetTests
Change-Id: Ic9bcdf43f252f22d12a1136902cc8bbf9cc731f5
In current design, mMatchSubscriberIds can be null which has the
same meaning with empty set, and is not easy to maintain since it
need more checks for this variable when mSubscriberId is null.
Thus make mMatchSubscriberIds NonNull for the maintenance.
Bug: 238843364
Test: build, FrameworksNetTests
Change-Id: I6cfc529b5f4a39ded8598283ff968f2f4d1bc89f
Move VpnTransportInfoTest to common test to add the cts
coverage.
Annotate @ConnectivityModuleTest so that the test will
not fail with module that is not up-to-date, and use
assertParcelingIsLossless to prevent similar order module
in device case.
Bug: 256775913
Test: atest CtsNetTestCases:android.net.VpnTransportInfoTest
Change-Id: I1c40a4fc42468748d71c3df5c18b2ceb5b3769e1
(these are never called, but must exist for API reasons)
Bug: 257393783
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2f1cb29c5176539abe25bf767997ab4ed5eca6de
This will be useful for diagnosing default network changes.
Logs may look like, for example :
Update capabilities for net 100 : -NET_CAPABILITY_OEM_PAID+NET_CAPABILITY_TRUSTED
Or :
Update score for net 100 : -POLICY_EVER_EVALUATED+POLICY_IS_VPN+POLICY_IS_DESTROYED
Test: FrameworksNetTests
manual
Change-Id: Ic4788c599573aae9daeca995b8853800aaaba0b8
The test does not wait for sending all log events done, just
check the total received event number after 200ms. If one of
thread is running slowly, the test would be flaky. Thus, use
the Thread#join() to ensure the log events sending out
completely.
Bug: 245005401
Test: atest CtsNetTestCases
Change-Id: I90ad6960453c4639b6429a2e36e35d2d53148131
Currently these tests run as hostside tests and require a lot of
boilerplate, including their own CtsHostsideNetworkTestsApp3
build target.
Move the coverage to LinkPropertiesTest using the new-ish
@CtsNetTestCasesMaxTargetSdk31 annotation, and remove the
hostside tests.
The only test that is not being moved is one that checks the
behaviour of disabling the compat change on T. This test is not
very useful because it can only run on userdebug builds and not
on production builds, because CtsHostsideNetworkTestsApp3 targets
SDK 33. We do have test coverage for disabling the compat change
on an app targeting SDK 31, where it is allowed.
Fix: 236087258
Test: atest CtsNetTestCasesMaxTargetSdk31
Test: atest CtsNetTestCasesLatestSdk:android.net.LinkPropertiesTest
Change-Id: I6d4b1ba40f6cb63b30a600c227e9628858c03d73
Revert the previous change to filter out all non-RTN_THROW routes when
EXCLUDED_ROUTES is disabled, as that behavior is CTS tested for T, and
has been used by T for a while. The previous change already ensured that
there is no behavior change on S, so this is the safest approach.
This fixes HostsideLinkPropertiesGatingTests.
Bug: 239046959
Test: atest LinkPropertiesTest CtsHostsideNetworkTests
Change-Id: I55e078cdc06341f4957fe7bc743c0022b2c7d3da
Starting from T, VpnService supports exclude routes, which will
make the caller to get both of include routes and exclude routes
from LinkProperties#getRoutes(), and it's not expected to get the
exclude routes before T in production code even though the code
returns all routes.
But there is a CTS - LinkPropertiesTest#testRouteAddWithSameKey()
will try to add an exclude route and check if the result of
LinkProperties#getRoutes() contains that exclude route or not.
And the test is failed now since LinkProperties#getRoutes() will
only return include route if compat feature - EXCLUDED_ROUTES is
disabled. (EXCLUDED_ROUTES is enabled starting from target SDK T)
To fix this test failure, let LinkProperties#getRoutes() keeps
returning all routes if SDK is before T. This avoids changing
behavior on S, and even though there is still a behavior change
when upgrading to T, apps are unlikely to be relying on such
behavior, especially outside of tests.
Bug: 238061814
Test: Run "atest CtsNetTestCases:LinkPropertiesTest" on S build
with mainline module which contains this patch.
Change-Id: Iac4362c4fe347ee3f06d5b21b0325fa69a7f27b6
The tests fail on user builds because they target T and attempt
to override the compat change, which is not allowed on user
builds because the change defaults to on for apps targeting T+.
Fix this by marking the tests max target SDK 31.
Also improve the tests a bit:
- Use a RuleChain to make it explicit that
CtsNetTestCasesMaxTargetSdk31 should be evaluated before
EnableCompatChanges (otherwise the compat change rule would
crash on user builds even if the max target SDK rule was going
to skip the test anyway).
- Fix the IgnoreUpTo for all exclude route tests to say S+.
Currently:
- One says R+, which is incorrect because the updated
LinkProperties code is in the connectivity module, which only
goes back to S, not R.
- The others say T+, which is incorrect because the update code
is present on S.
Fix: 233553525
Test: LinkProperties test in CtsNetTestCasesLatestSdk passes on T user build
Test: LinkProperties test in CtsNetTestCasesMaxTargetSdk31 passes on T user build
Change-Id: Ie0e2f6761b90a65813ed3610c7b5e930a9fdc982
NetworkStatsHistory internally assumes that bucketStart is
sorted at all times. However, in the fields, we've found there
are some buckets of NetworkStatsHistory do not preserve the
order of timestamp, which is caught by the IAE when addEntry
is called.
In order to provide backward compatibility, return sorted items
instead of throwing IAE when adding entry into
NetworkStatsHistory instance.
Test: atest android.net.netstats.NetworkStatsHistoryTest#testBuilder
Bug: 233825704
Change-Id: If3187384bd1e90770ca5873b8ec73e852fff543d
Merged-In: If3187384bd1e90770ca5873b8ec73e852fff543d
(pure cherry-picked from ag/18581718)
* changes:
Skip PersistentIntTest on S- device
Don't clobber existing history entries.
Ensure NetworkStats migrated snapshot is identical
[MS82.1] Support network stats data migration process
Add a PersistentInt class.
This test crashes if run from an APK that has target SDK 33 or
above because it tries to disable a compat change that on those
SDK versions is enabled by default.
Run it only in CtsNetTestCasesMaxTargetSdk31 and skip it in our
regular CTS modules.
Bug: 233553525
Test: test-only change
Change-Id: Iaf9c46591c13505c9d2a2a09994b9ee22a22390c
Currently, adding a history to a NetworkStatsCollection.Builder
will overwrite any history that was previously passed in with the
same key. This breaks the importer (which is the primary/only
caller of this code), because the importer re-uses the same
NetworkStatsCollection object to import multiple files.
Instead, simply add any passed-in entries after the ones that
were already there. Require the caller to pass in entries in
order, because NetworkStatsHistory internally assumes that
entris are always sorted.
Bug: 230289468
Test: manually verified this unbreaks the importer
Change-Id: Ic8647ff28fca78d579d5f759f96a864877f8158b
Merged-In: Ic8647ff28fca78d579d5f759f96a864877f8158b
(pure cherry-picked from ag/18453213)
Test update for renaming InternalNetworkManagementException to
EthernetNetworkManagementException.
Bug: 210485380
Test: atest FrameworksNetTests
Change-Id: I8b48655dc090eecda1dfd0542092308036fe6da7
NetworkIdentitySet is hidden API and may change on subsequent module
updates.
Use the module_lib NetworkStatsCollection.Key constructor that uses a
set of NetworkIdentity instead.
Bug: 217129444
Test: atest NetworkStatsCollectionTest
Change-Id: Icd1160ae920059306c3319f7298707f1e14cbb48
- Skip NetworkCapabilitiesTest on Q. The test covers code that is very
localized in NetworkCapabilities.java, and is only updatable on S+,
so does not need to be in MTS before that.
- Fix ConnectivityManagerTest to remove external references to
CaptivePortalData instances in the lambdas, as this is compiled into
a method taking CaptivePortalData as argument, and because the class
does not exist on Q, the test runner would crash enumerating method
arguments.
- Remove call to getSystemService(ETHERNET_SERVICE) on Q from the test
thread, as it will crash when called from a thread that does not have
a Looper.
Test: atest CtsNetTestCases
Bug: 227253613
Change-Id: I97c64b24c767e874dfba00aa1f46be2c4972f917
Gate presence of excluded routes in LinkProperties on target sdk T.
Bug: 186082280
Test: atest LinkPropertiesTest
Change-Id: If8fdb468a0a4968c5f2a878b7aacfeb4f7d9a9e5