Commit Graph

113 Commits

Author SHA1 Message Date
Hai Shalom
e58bdc6fd0 Support for Venue URL and friendly name from Network agent
Extend CaptivePortalData with a member to hold the venue friendly
name. If CaptivePortalData is initialized by both the network
agent and Capport, merge the two objects to include the venue
friendly name and prioritize the venue URL from the network
agent.

Bug: 162783305
Test: atest ConnectivityServiceTest
Test: atest CtsNetTestCasesLatestSdk:CaptivePortalDataTest
Test: End-to-end test
Change-Id: I4fdf356be42237c5b6c0ae5bacfd3cec4726861b
2021-01-11 18:45:34 -08:00
Remi NGUYEN VAN
f278ef3b02 Merge changes from topic "tcp_keepalive_fix"
* changes:
  Use API TcpKeepalivePacketData in ClientModeImpl
  Add TcpKeepalivePacketData to SystemApi
2020-12-15 09:02:55 +00:00
Remi NGUYEN VAN
5e6b51b895 Add TcpKeepalivePacketData to SystemApi
This is consistent with NattKeepalivePacketData, which is also a
subclass of KeepalivePacketData.

TcpKeepalivePacketData is already used by the wifi module, but
statically linked.

Bug: 172789687
Test: m
Change-Id: I6aee1ae205987521bea4a3838bbece279ffa0e37
2020-12-14 18:43:44 +09:00
Serik Beketayev
754c5be0f7 [Mainline Migration] Migrate NetworkUtils
Migrating makeStrings(), numericToInetAddress() APIs

Bug: 173089079
Test: atest FrameworksNetTests
Change-Id: Ie914fd41bc3ce16d07f5d2768b89ce805b9245a9
2020-12-06 22:33:04 -08:00
Remi NGUYEN VAN
bfc3c02f34 Merge "Do not query CS in NetworkProvider constructor" 2020-12-03 01:48:01 +00:00
Remi NGUYEN VAN
d707e7f5ae Do not query CS in NetworkProvider constructor
ConnectivityService may not be available in a NetworkProvider
constructor, if it is created (but still unused) before
ConnectivityService starts.

As ConnectivityManager is only necessary in
declareNetworkRequestUnfulfillable, which should not be called often,
just query ConnectivityManager at that point.

This is necessary for VcnManagementService, which is started before
ConnectivityService and creates its NetworkProvider in its constructor.
Fortunately VcnManagementService does not call
declareNetworkRequestUnfulfillable at this point.

ConnectivityManager may be migrated to classic service getters that
cache "null" when the service was not available the first time it is
queried, so no system service must query it before it starts.

Bug: 171540887
Test: atest FrameworksNetTests:NetworkProviderTest
Change-Id: I8dadcd0e1360a9464192f330493e13aa69dd9fe2
2020-11-30 12:42:15 +09:00
Remi NGUYEN VAN
e07a894bc3 Run OemNetworkPreferencesTest with DevSdkIgnoreRunner
The class-level @IgnoreUpTo annotation only applies with that runner.

Change-Id: I065618f2345c1d91de2fa1f2f558e5ed5b066f3e
Fixes: 174268969
Bug: 171505922
Test: atest FrameworksNetTests:android.net.OemNetworkPreferencesTest
2020-11-30 01:42:24 +00:00
James Mattis
b5cc74279d Adding @IgnoreUpTo to OemNetworkPreferencesTest
Adding @IgnoreUpTo to OemNetworkPreferencesTest so that it can run as
part of MTS.

Bug: 174268969
Bug: 171505922
Test: atest FrameworksNetTests:android.net.OemNetworkPreferencesTest
Change-Id: If7fb039c2cdb061f803c8a59e826e485e1f1c761
2020-11-25 15:34:11 -08:00
lucaslin
1d8505b456 Ignore verifying canBeSatisfiedBy() on Android Q
The method - satisfiedBy() has changed to canBeSatisfiedBy()
starting from Android R, so the method - canBeSatisfiedBy()
cannot be found when running this test on Android Q.
Ignore verifying canBeSatisfiedBy() on Android Q to fix this
problem.

Bug: 173911834
Test: Run MatchAllNetworkSpecifierTest on Android Q, R, S.
Change-Id: Ibe317b56f82d3ea100b1d78c3907dce4f2fd964d
2020-11-23 23:40:23 +08:00
lucaslin
20f7c6e60d Separate 2 tests to verify canBeSatisfiedBy()
In Android R, NetworkSpecifier#satisfiedBy() has changed to
NetworkSpecifier#canBeSatisfiedBy(), but its subclass -
MatchAllNetworkSpecifier hasn't.
In Android S, both of MatchAllNetworkSpecifier and
NetworkSpecifier has changed satisfiedBy() to canBeSatisfiedBy().
So if running the latest CTS on R device, it will verify
NetworkSpecifier#canBeSatisfiedBy() instead of
MatchAllNetworkSpecifier#satisfiedBy() and get the unexpected
result.
The fix is to separate 2 tests to verify canBeSatisfiedBy(), one
is for Android R or older version and the other is for Android
S+.

Bug: 172401624
Test: Run MatchAllNetworkSpecifierTest on Android R and S.
Change-Id: I1391bae9a0fc0298beb8fe80b5f388b492244566
2020-11-12 12:48:16 +08:00
James Mattis
356a879404 Adding API stubs for application network routing
Bug: 171795464
Test: atest FrameworksNetTests
Change-Id: Ib055aa37a7bf0c48c335307afc2258aa869c4267
2020-11-06 00:08:13 -08:00
James Mattis
4ebbddcf54 Adding @IgnoreUpTo for testOemPrivate
Adding @IgnoreUpTo for NetworkCapabilitiesTest.testOemPrivate so that
this test can run on previous releases.

Bug: 172400600
Bug: 171505922
Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest
Change-Id: Ibc728c986ad6faeed78c631ca2675956b95c6ac1
2020-11-04 16:52:11 -08:00
James Mattis
4fcbb03489 Add OEM_PRIVATE NetworkCapability
Adding network capability to be used with networks to be only used by
OEM apps.

Bug: 171505922
Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest
Change-Id: Ib55ebec0e178b6317d92f17e1aff060dacdfb2b1
2020-10-27 13:14:06 -07:00
Chalard Jean
2669b29f1d Address comments on aosp/1448415
Adds the necessary jarjar rules to FrameworksTestNet and
removes the test for CompareResult which has moved to its
right place.

Test: FrameworksTestNet
Change-Id: I50e51e72268e432a65a831aa5eebd606584ac721
2020-10-21 13:54:02 +09:00
Chalard Jean
4d6c93d315 Remove unused methods from LinkProperties.
LinkProperties.compare{Dnses,ValidatedPrivateDnses,AllRoutes,
AllInterfaceNames} actually have no users.

Test: LinkPropertiesTest
Change-Id: Ic54ab3c5520fbbc2be1309aeaf1e5a7857dbd194
2020-10-16 15:32:19 +09:00
Chalard Jean
39175f2670 Rename Kotlin util files to not include the Kt suffix
Callers don't care what language the utilities are written in

Test: builds
Change-Id: Ie212144f36c50db223c05f3fcb6bad745842cb5e
2020-08-12 10:02:50 +09:00
Chalard Jean
059356d83f Revert "Revert "Move Inet[4]AddressUtils to libs/net""
This patch is still needed and should go in now that the
error is fixed.
The patch was submitted into rvc-dev and is already in
rvc-dev-plus-aosp (patch in in ag/11923559, revert
skipped in ag/12072199). A follow-up will remove the
unused services.net-module-wifi target.

Test: originally tested in aosp/1324109
Test: m; manual: flashed, wifi and telephony working
Test: atest NetworkStackCoverageTests
Change-Id: I1074eedb0b0f156a1135e11210ec102de15ea674
Merged-In: Icd141a992c46290c74929785e261a1cd57bc001b
2020-08-07 03:31:04 +00:00
Chalard Jean
3b7591e1f5 Move utils from network stack to libs.
This package is using some common utilities from
a library that used to live in the network stack.
A better home for these utilities is frameworks/libs,
so this topic moves the files ther and also changes
the package of some utilities.

See aosp/1350222 and aosp/1350182 for a detailed
description of the specific files that moved.

Test: checkbuild
Change-Id: I76a9b7790f3997e3e6b3c2f75ba6308286457cde
2020-07-29 21:15:48 +09:00
Chalard Jean
064d18d188 Revert "Move Inet[4]AddressUtils to libs/net"
This reverts commit c98e38195d.

Reason for revert: Breaks the build b/160390899

Merged-In: Icd141a992c46290c74929785e261a1cd57bc001b
Change-Id: Ie10e66f61393602f17fbb61bf17230b176bf1f44
2020-07-02 23:47:35 +00:00
Remi NGUYEN VAN
c98e38195d Move Inet[4]AddressUtils to libs/net
The classes should not be picked up from frameworks/base, as they are
part of several mainline modules.

Also refine comments in DhcpResults following feedback in previous
change.

(cherry-pick from internal branch skipping wifi classes; no other
conflict)

Bug: 151052811
Test: m; manual: flashed, wifi and telephony working
Test: atest NetworkStackCoverageTests
Merged-In: I7074651c6a2a7a6b11bcf13cc4bb03833d7d655f

Change-Id: I7074651c6a2a7a6b11bcf13cc4bb03833d7d655f
2020-07-02 10:52:31 +09:00
Rubin Xu
bc4c5caa4f Treat RouteInfo with different interfaces as different routes
On Android different interfaces usually use different routing tables.
As a result, a change in interface should not be treated as route
update, but rather a remove and an add.

This change fixes a bug in VPN seamless handover where routes
failed to be updated when a new tunnel interface replaces the existing
one within the same network.

Bug: 158696878
Test: atest com.android.cts.net.HostsideVpnTests
Test: atest NetworkStackTests
Test: atest CtsNetTestCases
Test: atest FrameworksNetTests
Change-Id: I57987233d42a0253eaee2e1ca5f28728c2354620
2020-06-17 12:01:41 +01:00
Chiachang Wang
9774ceb3ea Update extra info before registering
The extra info is taken into NetworkMonitor from while creating
it. The NetworkMonitor is created when a new agent is registered
but the extra info is not available at that time. Make sure the
field is set in the NetworkInfo when registering.

Bug: 156173829
Test: adb shell dumpsys network and check the apn in the extra
      info shown correctly
Test: atest FrameworkNetTests
Change-Id: Ieaad8cbf1a28af3b97c7f98f74358e417fcad661
2020-06-03 13:01:01 +08:00
Rambo Wang
bf1206f8fa Merge "Rename satisfiedBy to canBeSatisfiedBy for MatchAllNetworkSpecifier" 2020-04-30 15:07:18 +00:00
Rambo Wang
f3508769ea Rename satisfiedBy to canBeSatisfiedBy for MatchAllNetworkSpecifier
MatchAllNetworkSpecifier is a subclass of NetworkSpecifer. The method
satisfiedBy should be renamed to canBeSatisfiedBy together with other
subclass of NetworkSpecifer in b/152238712.

Add annotation @Overide for the method to make sure it will not get
ignored when refactor in the future.

Bug: 154956584
Test: atest android.net.MatchAllNetworkSpecifierTest
Change-Id: Ibe32fd50fae43aa635c1c0dad66eaea82011c8b7
2020-04-30 15:06:35 +00:00
Chiachang Wang
de4a675836 Add test for NetworkSpecifier
Tests for canBeSatisfiedBy() and redact()

Bug: 154686765
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkSpecifierTest
Change-Id: Iade6a5b355b8812a5eb191345dfe393938ee272c
2020-04-23 18:03:16 +08:00
Aaron Huang
147d253956 Merge "Add network agent to enhance NetworkProvider test" 2020-04-20 07:20:25 +00:00
Aaron Huang
82948ddb1c Move DhcpInfoTest to frameworks/base/tests/net/common
Address comment from aosp/1162443.
Move to FrameworksNetCommonTests so that it can be run in
cts test and presubmit test.

Also change package name from android.net.cts to android.net

Bug: 154299158
Test: atest FrameworksNetTest
      atest CtsNetTestCasesLatestSdk:android.net.DhcpInfoTest
Change-Id: I42a965ae5cb748fdd80b4d5c0f8b26f36f74be72
2020-04-17 18:26:20 +08:00
Aaron Huang
8d2f514530 Add network agent to enhance NetworkProvider test
Add network agent to test more situation that could get the
onNetworkRequested callback.

Bug: 153614605
Bug: 153613690
Bug: 153612373
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkProviderTest
Change-Id: Id494a1697cc1b73e8e56ae585a69faec31c59f52
2020-04-17 17:26:07 +08:00
Aaron Huang
2bb072d54c Add cts test for NetworkProvider
It will skip whole tests on Q device since NetworkProvider class
is introduced in R.

Result on Q device would be:
[1/1] android.net.NetworkProviderTest#skippedClassForDevSdkMismatch: IGNORED (3ms)

Bug: 153614605
Bug: 153613690
Bug: 153612373
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkProviderTest
Change-Id: If7bfc7fae503e3497c37754697d0b148ff4cab3b
2020-04-16 06:40:20 +00:00
Chiachang Wang
d4a9e976e8 Add more tests for CaptivePortalData
Add missing tests to cover all system APIs

Bug: 152280218
Bug: 150640683
Test: atest CtsNetTestCasesLatestSdk:CaptivePortalDataTest on
      both Q and R device
Change-Id: I6d3826922f16816d5b18ed3540266442a0ed3e49
2020-04-13 08:58:48 +00:00
Chiachang Wang
210a4da6ed Move CaptivePortalDataTest to common test to support cts
Commit has to on top of aosp/1281921 to skip whole test in Q
device since CaptivePortalData class is introduced in R.

Result in Q will be:
[1/1] android.net.CaptivePortalDataTest#skippedClassForDevSdkMismatch: IGNORED

Bug: 152280218
Bug: 150640683
Test: atest CtsNetTestCasesLatestSdk:CaptivePortalDataTest on
      both Q and R device
Change-Id: Iddd00e1c85abe767b1a41a1761d3266ba322dba6
2020-04-13 08:13:04 +00:00
lucaslin
311bd48fe8 Set WifiAwareNetworkInfo into setTransportInfo()
Bug: 139268426
Bug: 135998869
Bug: 138306002
Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest
Change-Id: Ibbe1cd126d6538003fbb1e5e85892bfb15a920e8
Merged-In: Ibbe1cd126d6538003fbb1e5e85892bfb15a920e8
2020-04-08 10:09:16 +00:00
Junyu Lai
b0104c84f8 Merge "Fix NetworkStatsApiTest failed on Q device" 2020-04-07 10:49:19 +00:00
Treehugger Robot
7621ca16a3 Merge "Add trivial dependencies tests for the network stack" 2020-04-07 08:34:44 +00:00
junyulai
ff97691273 Fix NetworkStatsApiTest failed on Q device
Currently, the addEntry method is used in constructor of test,
which is not correct since there is no such method in Q devices.

Thus, initialize of NetworkStats variables outside of constructor.

Test: atest NetworkStatsApiTest
Test: atest CtsNetTestCasesLatestSdk:NetworkStatsApiTest on Q device
Bug: 150644692
Change-Id: Ibf2f8118c459a8d7a0992deca8f0f339ccd1bcea
2020-04-07 15:07:16 +08:00
Chalard Jean
77c7660522 Add trivial dependencies tests for the network stack
Test: this
Bug: 153033018
Change-Id: Ie3c15ed25ef3088d3b9b650ffc7f34f49efa6b81
2020-04-07 14:42:00 +09:00
lucaslin
3df2ebcb83 Add more tests in NetworkCapabilitiesTest.java
Test deduceRestrictedCapability(), getAdministratorUids(),
setAdministratorUids(), getNetworkSpecifier(), getOwnerUid(),
setLinkDownstreamBandwidthKbps(), setLinkUpstreamBandwidthKbps()
and setSignalStrength().

Bug: 139268426
Bug: 135998869
Bug: 138306002
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkCapabilitiesTest
Change-Id: I90c7a8c47710ea4ad8e8d2682c10440fd7f82270
2020-04-07 11:58:22 +08:00
Remi NGUYEN VAN
7e3fc61cf1 Merge "Fix setAdministratorUids tests on Q" 2020-04-03 07:54:59 +00:00
Remi NGUYEN VAN
824f80b129 Fix setAdministratorUids tests on Q
setAdministratorUids does not exist on Q, so such tests must be skipped
on Q devices.

Bug: 147903575
Test: atest CtsNetTestCasesLatestSdk on Q and AOSP devices
Change-Id: I1b362660de9733bb9f0ede1ed5cf62279bf1c05e
2020-04-02 13:58:03 +09:00
Lorenzo Colitti
5c5d1a1282 Merge "Only apply VPN isolation if it's fully routed" 2020-04-02 04:10:12 +00:00
Junyu Lai
e71d3cf971 Merge changes from topic "sp26-networkstats-cts"
* changes:
  [SP26] add CTS for NetworkStats
  [SP26.2] add a method in NetworkStats that removes empty entries
2020-04-02 02:00:59 +00:00
junyulai
e47c7e42e5 [SP26] add CTS for NetworkStats
Test: atest NetworkStatsApiTest
Test: atest CtsNetTestCasesLatestSdk:NetworkStatsApiTest on Q device
Bug: 150644692
Change-Id: I690704b43cfd16de70c4c83916f6d750cf613f67
2020-04-01 16:46:08 +08:00
Rubin Xu
ab8cf306ea Only apply VPN isolation if it's fully routed
VPN is considered fully routed if both IPv4 and IPv6 have
either a default route or a prohibit route.

Bug: 145332510
Test: atest FrameworksNetTests
Change-Id: I59cf48552bca98092d1212e3d718fd420add5458
2020-04-01 09:36:29 +01:00
Cody Kesting
c350963548 Merge "Sort administrator UIDs for NetworkCapabilities." 2020-03-31 17:43:02 +00:00
Cody Kesting
e4df39ba4b Merge "Add combine() and equals() for NetworkCapabilities admin UIDs." 2020-03-31 17:42:18 +00:00
Cody Kesting
ec5a0cb0ff Sort administrator UIDs for NetworkCapabilities.
Administrator UIDs stored in NetworkCapabilities should be sorted. This
allows for easier equals checks and hashCode computation. Additionally,
duplicate UIDs should be prevented.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: Ia5387ca2ce7c3fcbd04dc7fbff5266f7bcc71694
2020-03-30 14:51:24 -07:00
Chalard Jean
20e92eca29 Add combine() and equals() for NetworkCapabilities admin UIDs.
NetworkCapabilities#mAdministratorUids should be checked for equality
when combining NetworkCapabilities. Administrator UIDs should also be
included in NetworkCapabilities equals() and hashCode().

Bug: 147903575
Test: FrameworksNetTests
Change-Id: I803bdec80e27ee80d3a39844c5fb7aed584ab07d
2020-03-30 14:27:20 -07:00
Lucas Lin
b1bf1f2d36 Merge "Fix NetworkCapabilitiesTest fail on Q device" 2020-03-30 07:41:01 +00:00
Aaron Huang
9d66de5d5e Merge "Make LinkPropertiesTest compatible with Q" 2020-03-30 06:06:32 +00:00
lucaslin
be8bbacfa2 Fix NetworkCapabilitiesTest fail on Q device
The getSSID() has changed to getSsid() in Android R, adding
isAtLeastR() to prevent NetworkCapabilitiesTest fail on Android
Q.

Bug: 151322799
Test: Run "atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest"
      on Android Q & R device.
Change-Id: I602ae32dae1ad29fe3293c541fa6d2cef01b81d3
Merged-In: I602ae32dae1ad29fe3293c541fa6d2cef01b81d3
2020-03-30 03:47:00 +00:00