Commit Graph

169 Commits

Author SHA1 Message Date
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
Lucas Lin
28ff516ba7 Merge "Add MatchAllNetworkSpecifierTest" 2020-03-30 03:08:48 +00:00
Lucas Lin
246821b7b4 Merge "Add more tests in LinkPropertiesTests.java" 2020-03-30 03:08:40 +00:00
Remi NGUYEN VAN
e3aade0a30 Merge "Create a builder for NetworkCapabilities." 2020-03-30 02:58:45 +00:00
Aaron Huang
7988471ec9 Make LinkPropertiesTest compatible with Q
CompareResult had been moved from LinkProperties to LinkPropertiesUtils
so this change ignores testCompareResult() on Q and only check
compareAllRoutes() works while android version is at least R.

Bug: 151782584
Test: atest CtsNetTestCasesLatestSdk:LinkPropertiesTest
Change-Id: I38b0d83abf983b3bcc01fc6aea2e5cc307734198
2020-03-27 16:41:21 +08:00
lucaslin
55c6a844fc Add more tests in LinkPropertiesTests.java
Test getAllInterfaceNames(), hasIpv4DefaultRoute(),
hasIpv4DnsServer() and hasIpv6DnsServer().

Bug: 139268426
Bug: 135998869
Bug: 138306002
Test: atest CtsNetTestCasesLatestSdk:android.net.LinkPropertiesTest
Change-Id: Ie77dd7eb5c7ecc763c661e8510f9a308e695e77f
2020-03-26 19:15:55 +08:00
lucaslin
5bf0d2de9d Add MatchAllNetworkSpecifierTest
Bug: 139268426
Bug: 135998869
Test: atest CtsNetTestCasesLatestSdk:MatchAllNetworkSpecifierTest
Change-Id: Ib593708d5621ff20e6a0c31e5698b2b658f64d45
2020-03-26 18:58:08 +08:00
Chalard Jean
542e60001a Create a builder for NetworkCapabilities.
Bug: 151322799
Test: FrameworksWifiTests
Change-Id: I69c00c9e3963950e55d7105d8825f7d3a3ec9b2f
Merged-In: I06eb97e50d5583579b3c26d1365d2dbaec8bfc99
(cherry picked from commit 9771f34dae9cdeb857636cac2b3c2d473713914e)
2020-03-25 13:27:04 +09:00
Xiao Ma
2772ddd5bd Add CTS tests for ApfCapabilities static APIs.
Add tests for getApfEtherTypeBlackList and getApfDrop8023Frames APIs.

Bug: 150640397
Test: atest CtsNetTestCasesLatestSdk:android.net.apf.ApfCapabilitiesTest
      on both of Q and R devices.
Change-Id: I06c5d84d7025420a1e45a953c8c7a5cc3c452e24
2020-03-24 19:38:21 +09:00
Lucas Lin
30faad6d0f Merge "Add version check to prevent test fail on Android Q" 2020-03-18 03:56:37 +00:00
Chiachang Wang
4d08f370af Merge changes I97015365,Ic9db4b9b
* changes:
  Add NattKeepalivePacketDataTest
  Add KeepalivePacketDataTest
2020-03-17 09:38:41 +00:00
Chiachang Wang
5b710612a2 Add NattKeepalivePacketDataTest
Add test for constructor and parcel

Test: atest CtsNetTestCasesLatestSdk:android.net.NattKeepalivePacketDataTest
      on both Q and R devices
Bug: 151402211
Change-Id: I97015365604be1846e3ecbaf60ac99e334705565
2020-03-17 15:48:02 +08:00
Chiachang Wang
c780d27eda Add KeepalivePacketDataTest
Add test for constructor of KeepalivePacketData and
InvalidPacketException

Bug: 151109466
Test: atest CtsNetTestCasesLatestSdk:android.net.KeepalivePacketDataTest
      on both Q and R devices
Change-Id: Ic9db4b9b83ff96c87f41c5f381763c3ee8dd27c8
2020-03-17 14:24:50 +08:00
Remi NGUYEN VAN
8dd694d1d3 Move sensitive field parceling bool to constructor
This addresses API review comments recommending to use a copy
constructor with additional parameters instead of a dedicated method.
makeSensitiveFieldsParcelingCopy becomes LinkProperties(base, true).

Bug: 150877475
Test: atest FrameworksNetTests NetworkStackTests NetworkStackNextTests
Change-Id: Ib145ca7f36dcbee6ef47d09862a181fc04a28f03
2020-03-17 11:42:33 +09:00
Remi NGUYEN VAN
2fad017e86 Merge "Make LinkPropertiesTest backwards compatible" 2020-03-17 02:27:27 +00:00
Remi NGUYEN VAN
3994e73b75 Make LinkPropertiesTest backwards compatible
LinkPropertiesTest must be backwards compatible with Q for CTS.

In Q 4 fields were added: DhcpServerAddress, WakeOnLanSupported,
CaptivePortalApiUrl, CaptivePortalData. The new test only tests these
fields on R and above.
testLinkPropertiesParcelable_Q still verifies that there are 14 fields
on Q, so the 4 extra fields can be ignored.

The changes use androidx.core.os.BuildCompat.isAtLeastR(), so
androidx.core_core is added as a dependency to FrameworksNetCommonTests.

Test: atest CtsNetTestCasesLatestSdk:android.net.LinkPropertiesTest
        on Q and R devices
Bug: 150918852
Change-Id: I570efa4eb483a717d4204a18473d02653a69f46d
2020-03-17 11:23:13 +09:00
Aaron Huang
d4db72dbfc Merge "Add test for NetworkAgentConfig" 2020-03-13 04:13:04 +00:00
lucaslin
9e90c02511 Add version check to prevent test fail on Android Q
Include androidx.core_core for androidx.core.os.BuildCompat.

Bug: 151293251
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkCapabilitiesTest
Change-Id: I73ef7eececec757a6e9683b231bf73fcd8d49f8d
2020-03-12 11:54:40 +00:00
Paul Hu
da284dc189 Merge "Add CTS for SocketUtils.makePacketSocketAddress(int, int, byte[])" 2020-03-11 09:50:26 +00:00
paulhu
4c48b0a060 Add CTS for SocketUtils.makePacketSocketAddress(int, int, byte[])
Bug: 149426063
Bug: 150640362
Test: atest CtsNetTestCasesLatestSdk:android.net.util.SocketUtilsTest
      on both Q and R devices
Change-Id: I4b5a3dfb78b404d414b7dc358e6f16c3414a8b33
2020-03-11 15:20:26 +08:00
Aaron Huang
73808bd4cf Merge "Remove framework code that has moved to frameworks/libs/net" 2020-03-11 04:22:09 +00:00
Aaron Huang
97ae1a81fa Add test for NetworkAgentConfig
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkAgentConfigTest
Change-Id: If9158d086bacb0ade94d59898ac223e4c8f4f73a
2020-03-10 21:01:14 +08:00
Chiachang Wang
1d74bab6e7 Skip Route tests that are R-specific on Q
MTU was added in R so test for it should be run on Q. Also
revise test to adopt rule.

Test: atest CtsNetTestCasesLatestSdk:android.net.LinkAddressTest
      on both devices
Bug: 150918852
Change-Id: Ibab9cfae0d35b26c6e4ca0defbb89769b04201d4
2020-03-10 10:24:38 +00:00
Aaron Huang
0e1759bdfa Remove framework code that has moved to frameworks/libs/net
Add srcs to framework and change import path.
Remove the codes which are moved to frameworks/libs/net.

Bug: 139268426
Bug: 135998869
Bug: 138306002
Bug: 143925787
Test: atest FrameworksNetTests
      atest FrameworksTelephonyTests
      ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: Ia5692aade490fbc8a037186fcdfc453e0dd8045b
Merged-In: Ibf2f370c97a602f186e37ea9ffbe177dd2ee0f1c
2020-03-10 06:45:16 +00:00
Chiachang Wang
ac98e787d3 Add test for getDeprecationTime and getExpirationTime
Add for cts coverage for system API

Bug: 139268426
Bug: 135998869
Test: atest FrameworksNetTests
Test: atest CtsNetTestCasesLatestSdk:android.net.LinkAddressTest
Change-Id: I64cd2c914f2da71383af7cdef2cf64c60a7d268c
2020-03-09 06:59:50 +00:00
Remi NGUYEN VAN
186adbf536 Ignore NetworkAgentConfigTest on Q
NetworkAgentConfig did not exist on Q.

Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkAgentConfigTest
          on Q and R devices
Bug: 150918852
Change-Id: I5414d7767c39327ff41673ff13ccd34982e10742
2020-03-09 12:04:39 +09:00
Remi NGUYEN VAN
1306f533e6 Skip LinkAddress tests that are R-specific on Q
Address lifetime was added in R so tests for it should not be run on Q.

Test: CtsNetTestCasesLatestSdk:android.net.LinkAddressTest on both
          devices
Bug: 150918852
Change-Id: I98b14727eabcf569829eee8df34afc057eba6f93
2020-03-09 10:42:53 +09:00
Remi NGUYEN VAN
df86d7b416 Ignore testReevaluateNetwork until Q
The method did not exist until Q, so the test is not relevant on such
devices.

Test: atest CtsNetTestCasesLatestSdk:android.net.CaptivePortalTest on Q
          and R devices
Bug: 150918852
Change-Id: I913b6eaa61bfd4f1964b324dcb4dd272aa8cc583
2020-03-06 18:21:45 +09:00
Automerger Merge Worker
6bef08258f New NetworkAgentConfig API to replace NetworkInfo WiFi stuff. am: cd457ea5ec
Change-Id: I94e3b25aa202e75338115f82c6db0dd0e41deb48
2020-03-03 03:53:58 +00:00
Lorenzo Colitti
c3f8d41d4d Merge "test: LinkProperties: Unique Route Destinations" 2020-02-25 00:34:07 +00:00
Chalard Jean
cd457ea5ec New NetworkAgentConfig API to replace NetworkInfo WiFi stuff.
Bug: 139268426
Test: FrameworkWifiTests
Change-Id: Id13fcf41e05fd1eb26c86717e2684c724b94e401
Merged-In: Id13fcf41e05fd1eb26c86717e2684c724b94e401
2020-02-21 16:08:17 +08:00
Tyler Wear
44999a7247 test: LinkProperties: Unique Route Destinations
Routes will always have unique destinations. Update tests
to use unique destinations when adding multiple routes.

Test: treehugger
Change-Id: I238899b0643407a1be29eb66d28728ca5d5dbc80
2020-02-18 11:12:17 -08:00
Isabelle Taylor
50e2cbde28 Merge "Revert "Remove framework code that has moved to frameworks/libs/net"" 2020-02-14 13:42:37 +00:00
Isabelle Taylor
175627fafb Revert "Remove framework code that has moved to frameworks/libs/net"
Revert "Use createRandomUnicastAddress from MacAddressUtils"

Revert "Add net-utils-framework-net to telephony-common"

Revert submission 1191997-net-utils-framework-net

Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_qt-qpr1-dev-plus-aosp&target=aosp_taimen-userdebug&lkgb=6208131&lkbb=6208273&fkbb=6208273, bug b/149551544
Reverted Changes:
Ib1c807d64:Use createRandomUnicastAddress from MacAddressUtil...
I9e0f297e0:Add net-utils-framework-net to telephony-common
Ieb8927f9a:Remove framework code that has moved to frameworks...

Change-Id: I2824f781babd9f7e0bb9df524dadf6b8397dcaa1
2020-02-14 13:09:16 +00:00
Aaron Huang
0122cf102f Merge "Remove framework code that has moved to frameworks/libs/net" 2020-02-14 09:42:49 +00:00
Roshan Pius
08c94fb8a9 RELAND: NetworkRequest: Embed requestor uid & packageName
Add the requestorUid & requestorPackageName fields to
NetworkCapabilities. This is populated by CS when
a new network request is received.
These 2 requestor fields are also optionally used for network
matching. All of the regular app initiated requests will have the
requestor uid and package name set by connectivity service. Network
agents can optionally set the requestorUid and requestorPackageName
to restrict the network created only to the app that requested the network.

This will help removing the necessity for the various specifiers to embed
the uid & package name info in the specifier for network matching.

Note: NetworkSpecifier.assertValidFromUid() is deprecated & removed in
favor of setting the uid/package name on the agent to restrict the
network to a certain app (useful for wifi peer to peer API & wifi aware).

Bug: 144102365
Test: Verified that wifi network request related CTS verifier tests
pass.
Test: Device boots up and connects to wifi networks
Merged-In: I207c446108afdac7ee2c25e6bbcbc37c4e3f6529

Change-Id: I58775e82aa7725aac5aa27ca9d2b5ee8f0be4242
2020-02-12 16:58:36 -08:00
Roshan Pius
d85de75bfa Revert "NetworkRequest: Embed requestor uid & packageName"
This reverts commit d499517306.

Reason for revert: b/149425896
Bug: b/149425896

Change-Id: I9fe31509c040cc421ccb00ea60f15e6f199e8bc6
2020-02-12 23:33:43 +00:00
Roshan Pius
d499517306 NetworkRequest: Embed requestor uid & packageName
Add the requestorUid & requestorPackageName fields to
NetworkCapabilities. This is populated by CS when
a new network request is received.
These 2 requestor fields are also optionally used for network
matching. All of the regular app initiated requests will have the
requestor uid and package name set by connectivity service. Network
agents can optionally set the requestorUid and requestorPackageName
to restrict the network created only to the app that requested the network.

This will help removing the necessity for the various specifiers to embed
the uid & package name info in the specifier for network matching.

Note: NetworkSpecifier.assertValidFromUid() is deprecated & removed in
favor of setting the uid/package name on the agent to restrict the
network to a certain app (useful for wifi peer to peer API & wifi aware).

Bug: 144102365
Test: Verified that wifi network request related CTS verifier tests
pass.
Test: Device boots up and connects to wifi networks
Change-Id: I207c446108afdac7ee2c25e6bbcbc37c4e3f6529
Merged-In: I207c446108afdac7ee2c25e6bbcbc37c4e3f6529
2020-02-12 04:42:58 +00:00
Aaron Huang
5ff8baa340 Remove framework code that has moved to frameworks/libs/net
Add srcs to framework and change import path.
Remove the codes which are moved to frameworks/libs/net.

Bug: 139268426
Bug: 135998869
Bug: 138306002
Bug: 143925787
Test: atest FrameworksNetTests
      atest FrameworksTelephonyTests
      ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: Ieb8927f9af7f87a5ae038bd6c7daeb3d70117fef
Merged-In: Ieb8927f9af7f87a5ae038bd6c7daeb3d70117fef
2020-02-03 08:16:43 +00:00
Sarah Chin
f75d09fac1 API changes for IPv6 MTU support
Change mtu->mtuV4 and add mtuV6 for DataProfile and DataCallResult
Add mtu to RouteInfo and update test

Test: atest FrameworksTelephonyTests
Bug: 146668814
Change-Id: I43c7e088e46e40f38d8114548e0fc4e39d7f91cb
Merged-In: I43c7e088e46e40f38d8114548e0fc4e39d7f91cb
2020-01-30 00:17:19 +09:00
Jack Yu
d956e5b326 Fixed the documentation and unit tests
Fixed the documentation and re-eanble the
broken unit tests.

Test: LinkAddressTest
Bug: 142949345
Merged-In: I0ac8c022f70cdf9305c183996c2464a8e04ba5ae
Change-Id: I0ac8c022f70cdf9305c183996c2464a8e04ba5ae
(cherry picked from commit b67261b01c)
2020-01-26 21:37:36 -08:00
Jack Yu
632771fd43 Disabled the tests
Will re-enable after fixing the negative time issue

Test: LinkAddressTest

Bug: 148257086
Merged-In: Ia6ce0608a2ce95be980e4f9ea62315076c4453be
Change-Id: Ia6ce0608a2ce95be980e4f9ea62315076c4453be
(cherry picked from commit d40e5498d0)
2020-01-26 21:34:00 -08:00
Jack Yu
590d408a06 Added expiration time and deprecation time support
Added link address deprecation time and expiration
time for SSC mode 3 support.

Bug: 135717900
Bug: 142949345
Test: LinkAddressTest

Merged-In: Ibc030d2a70ded66e00dd3bdae209609b9118de78
Change-Id: Ibc030d2a70ded66e00dd3bdae209609b9118de78
(cherry picked from commit 05d5b3b59f)
2020-01-26 21:32:12 -08:00
Qingxi Li
bb8da980ae Add API for apps to check if they are the network owner
This CL extends NetworkCapabilities#mEstablishingVpnAppUid
to the network owner app UID and introduces a new public API
to get this owner app's UID.

Bug: 142072839
Test: atest FrameworksNetTests
Change-Id: Id83cdea62b89b586aff74e51e3fee60e53d37d4c
2020-01-24 17:28:23 +00:00
Cody Kesting
896939854b Add list of Administrator UIDs to NetworkCapabilities.
Adds a list of administrator UIDs to NetworkCapabilties. The carrier
privilege permission model allows multiple uids to be granted
network-management privileges via certificates stored on a SIM card or
in CarrierConfigManager. The current NetworkCapabilities only allows a
single uid to be stored to track the owner of the network - this change
remedies that discrepancy.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: I3169d31e0270c976a720e80363cb268cbafd0455
2020-01-22 23:59:56 -08:00