Commit Graph

2131 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
c35936db0e Merge "services.net: Use the new ModuleNetworkStackClient" 2020-03-17 09:21:40 +00:00
TreeHugger Robot
6bf269b1b5 Merge "Add test for NetworkAgentConfig" into rvc-dev 2020-03-17 09:00:38 +00:00
Automerger Merge Worker
da59e2d258 Add test for NetworkAgentConfig
Bug: 139268426
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkAgentConfigTest
Change-Id: If9158d086bacb0ade94d59898ac223e4c8f4f73a
Merged-In: If9158d086bacb0ade94d59898ac223e4c8f4f73a
(cherry picked from aosp/1253722)
2020-03-17 08:44:38 +00:00
Remi NGUYEN VAN
abc08c2456 Merge "Move sensitive field parceling bool to constructor" 2020-03-17 07:49:38 +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
Automerger Merge Worker
1c7f159f44 Protect ConnectivityService from SecurityException in permission check.
ConnectivityService currently calls
LocationPermissionChecker#checkLocationPermission. This method call
throws a SecurityException if the given package name and UID do not
match. This permission check is made from the ConnectivityService
Thread, so any Exception being thrown will crash the SystemServer. This
is not acceptable, so surround the permission check in a try-catch in
case any SecurityExceptions are thrown.

Bug: 149119324
Test: atest ConnectivityServiceTest
Change-Id: Ibe2874f2a5249432270aa1b9eb7d004bbba35ac2
Merged-In: Ibe2874f2a5249432270aa1b9eb7d004bbba35ac2
(cherry picked from commit 9eacc855b63b36f5b937e703b20d4b0bb077ab75)
2020-03-17 00:21:50 -07:00
Cody Kesting
22d0bfd7c4 Update ConnectivityDiagnosticsCallback function name.
API Council feedback suggests renaming ConnectivityDiagnosticsCallback
'onConnectivityReport' function to be 'onConnectivityReportAvailable'.

Bug: 150598997
Test: atest FrameworksNetTests
Change-Id: Ieea727ecee6cf358a53a215fd4b06233dfe967ea
(cherry picked from commit 324b224cc48fcb12125bd1727be70ad2effbfce3)
2020-03-17 00:16:58 -07: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
Lorenzo Colitti
07c7c2aa67 Merge "Ensure that NetworkFactory objects cannot be reused." 2020-03-17 04:35:01 +00: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
Cody Kesting
3fef3af249 Merge "Clean up unit testing for ConnectivityDiagnostics." 2020-03-16 19:33:33 +00:00
Cody Kesting
d759ac61ee Restrict VPN Diagnostics callbacks to underlying networks.
ConnectivityDiagnosticsCallbacks should only be invoked for the
underlying networks declared by active VPNs. This encourages VPN apps to
declare their underlying networks.

The previous permission model for VPNs allowed active VPNs to receive
callbacks on any network.

Bug: 148903617
Test: atest FrameworksNetTests
Change-Id: Ic08cdd2e2532580fda0fd3034e2bdff27e0ff84b
2020-03-16 11:05:13 -07:00
Lorenzo Colitti
2c74e66034 Ensure that NetworkFactory objects cannot be reused.
NetworkFactory is turning into a one-time object that cannot be
re-used. Check for this in ConnectivityService.

Bug: 148635501
Test: test continues to pass
Change-Id: I793436ee0f4b5d778788ad34b8a2575d2ad0ed80
Merged-In: I793436ee0f4b5d778788ad34b8a2575d2ad0ed80
2020-03-17 01:39:23 +09:00
TreeHugger Robot
518e54c7b0 Merge "Ensure that NetworkFactory objects cannot be reused." into rvc-dev 2020-03-16 16:23:23 +00:00
Cody Kesting
ed459f5f1a Merge "Protect ConnectivityService from SecurityException in permission check." 2020-03-16 14:33:25 +00:00
Automerger Merge Worker
04b7e0b17c 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
Merged-In: I64cd2c914f2da71383af7cdef2cf64c60a7d268c
(cherry picked from commit 1e7f68f39c0855a45dbf4eeecbff430a2f6f3396)
2020-03-16 08:04:19 +00:00
junyulai
cc38304ad8 [SP24] Rename functions that add Entry unconditionally
Currently, in NetworkStats, there are many methods to manipulate
the records. However, some methods are similar and ambiguous,
such as addEntry, addValues, setValues, addIfaceValues,
combineValues and combineAllValues.

Thus, properly grouping and renaming methods are necessary.
In this change, for methods that add one record unconditionally,
name them insertEntry.
  setIfaceValues -> insertEntry
  addEntry -> insertEntry

Test: atest FrameworksNetTests ImsPhoneCallTrackerTest TetheringTests
Test: m doc-comment-check-docs
Bug: 148895143
Change-Id: I801ddc49e283a254b9586700c9b597c0adb0d459
2020-03-16 14:27:45 +08:00
Junyu Lai
24ab7411ba Merge "[SP21] Address comments for API council review about aosp/1172143" 2020-03-16 02:41:19 +00:00
Automerger Merge Worker
b0b8333e82 Resolve ambiguous argument.
CTS tests don't have access to TestNetworkAgent and therefore
require overloading this method, which means 'null' is ambiguous.

Bug: 139268426
Test: FrameworksNetTests
Change-Id: I5d7deea82d7114fa38f37b90f94fe7e6073bd848
(cherry picked from commit ff83f1d7eea38c4143869cbf10dca5972421f6cd)
2020-03-15 12:56:05 +00:00
Chalard Jean
16cad96e9f Merge "Resolve ambiguous argument." 2020-03-14 03:38:01 +00:00
Roshan Pius
468ca0fc4f Merge changes from topic "services.net-wifi" into rvc-dev
* changes:
  services.net: Add a static library needed by wifi module
  services.net: Use the new ModuleNetworkStackClient
2020-03-13 22:39:09 +00:00
Cody Kesting
417004a722 Merge "Clear UIDs when sharing NetworkCapabilties for ConnectivityDiagnostics." into rvc-dev 2020-03-13 18:44:50 +00:00
Chalard Jean
a7cc6d8eee Resolve ambiguous argument.
CTS tests don't have access to TestNetworkAgent and therefore
require overloading this method, which means 'null' is ambiguous.

Bug: 139268426
Test: FrameworksNetTests
Change-Id: I9279718bde30bd98eff901921fb3411d22da72e5
2020-03-13 21:17:33 +09:00
Treehugger Robot
62b8d6f24d Merge "Remove redundant connected notification" 2020-03-13 07:10:13 +00:00
Lorenzo Colitti
487b677f3a Ensure that NetworkFactory objects cannot be reused.
NetworkFactory is turning into a one-time object that cannot be
re-used. Check for this in ConnectivityService.

Bug: 148635501
Test: test continues to pass
Change-Id: I793436ee0f4b5d778788ad34b8a2575d2ad0ed80
2020-03-13 15:51:56 +09:00
Aaron Huang
d4db72dbfc Merge "Add test for NetworkAgentConfig" 2020-03-13 04:13:04 +00:00
Roshan Pius
e072ca8b35 services.net: Use the new ModuleNetworkStackClient
Use the new ModuleNetworkStackClient to retrieve instances IpMemoryStore
& IpClient.

Bug: 145825329
Test: Compiles
Change-Id: I065525fdbd64b9509ef0f47bb35954d267c65fd2
Merged-In: I065525fdbd64b9509ef0f47bb35954d267c65fd2
2020-03-12 18:55:31 -07:00
Roshan Pius
58d144f6ed services.net: Use the new ModuleNetworkStackClient
Use the new ModuleNetworkStackClient to retrieve instances IpMemoryStore
& IpClient.

Bug: 145825329
Test: Compiles
Change-Id: I065525fdbd64b9509ef0f47bb35954d267c65fd2
2020-03-12 18:26:13 -07:00
junyulai
0c88795cb5 [SP21] Address comments for API council review about aosp/1172143
Test: atest FrameworksNetTests ImsPhoneCallTrackerTest
Test: atest TetheringTests NetworkStackTests
Test: m doc-comment-check-docs
Fix: 148552904

Change-Id: I141393f229e772d2eb9f7c156849e379bd71b845
2020-03-12 21:34:17 +08: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
Automerger Merge Worker
1494a56ecf 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
Merged-In: I4b5a3dfb78b404d414b7dc358e6f16c3414a8b33
(cherry picked from aosp/1243868)
2020-03-12 01:45:22 +00:00
paulhu
27ca44913a Kill ConnectivityManager.CONNECTIVITY_ACTION_SUPL
CONNECTIVITY_ACTION_SUPL is marked as a "temporary hack" and has
never been public. Remove this intent definition since no one is
receiving this intent and should use network callback to know the
connection change.

Bug: 109636544
Test: atest FrameworksNetTests
Change-Id: Ie9e5127742beba04f1c191e894e8a29fe1e704bb
2020-03-11 22:14:11 +08:00
Paul Hu
da284dc189 Merge "Add CTS for SocketUtils.makePacketSocketAddress(int, int, byte[])" 2020-03-11 09:50:26 +00:00
Chiachang Wang
10736d2107 Merge "Skip Route tests that are R-specific on Q" into rvc-dev 2020-03-11 09:36:23 +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
Benedict Wong
b645699cdb Add tests for Tunnel, Transport mode application with released SPIs
This change adds tests to validate that both transport and tunnel mode
transforms continue to work even after the SPI resource has been
released. Specifically, since SPI resources are effectively subsumed by
the creation of a Transform, the SPI resource is still "alive", but
removed from the user-tracking sparse arrays.

Bug: 142072071
Test: Added these new tests. Failing prior to aosp/1133555, passes with.
Change-Id: I37dd459d08b57b14f72f3b28ea80fa231b152f10
2020-03-11 07:12:07 +00:00
Cody Kesting
807ce6621b Clean up unit testing for ConnectivityDiagnostics.
Connectivity Diagnostics included an unnecessary try-catch for verifying
that the permissions check for invoking ConnectivityDiagnosticsCallbacks
doesn't throw when the uid and package name do not match.

Bug: 149119324
Test: atest FrameworksNetTests
Change-Id: Ie302b1f4f437e819fdd15ec28adb0b56750c2c53
2020-03-10 23:27:01 -07:00
Lorenzo Colitti
f25e167d93 Merge "Merge NetworkStatsService handler changes." into rvc-dev 2020-03-11 06:19:18 +00:00
Benedict Wong
feff1cde9a Automatically set IPsec tunnel interface as up
This change makes IPsec tunnel interfaces automatically get brought up
once they are created. Originally this was considered to be an
additional safety check, as they would not be start routing traffic
until explicitly brought up. However, in the intervening time, the
NetworkManagementController now requires the NETWORK_STACK permission to
set an interface as up. Additionally, that call is a hidden API, and
thus not usable for use cases such as IWLAN.

Bug: 149348618
Test: FrameworksNetTests, CtsNetTestCases passing.
Change-Id: I55b63a748463a388e1e2991d2d5d6b3023545e60
2020-03-10 23:08:16 -07:00
Tyler Wear
e4314861e3 mtu: Add MTU parameter to Routes
- Change route to update existing route
- MTU parameter added to AddRoute

Bug: 142892223
Test: unit test
Change-Id: Ie339d0cee5be12c2232a4631fed61219a0facc64
2020-03-11 13:33:10 +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
Automerger Merge Worker
f78e440b27 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
Merged-In: Ibab9cfae0d35b26c6e4ca0defbb89769b04201d4
(cherry picked from commit 09e5726e158d543b7632cd6e22f6e4c29b0bef52)
2020-03-10 12:47:19 +00: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
c5d2170b64 Merge "Add test for getDeprecationTime and getExpirationTime" 2020-03-10 03:40:55 +00:00
Lucas Lin
ea7800cb54 Merge "Remove redundant connected notification" into rvc-dev 2020-03-10 02:21:07 +00:00
Remi NGUYEN VAN
449c8fd974 Merge "Ignore NetworkAgentConfigTest on Q" into rvc-dev 2020-03-10 00:59:50 +00:00