Commit Graph

8883 Commits

Author SHA1 Message Date
Automerger Merge Worker
8e9e1a0374 Add support for registering test networks with administrators.
CTS testing for ConnectivityDiagnosticsManager requires registering
TestNetworks with the administrator UIDs set. This sets up the CTS
process to be an administrator over the test network, which allows it to
receive ConnectivityDiagnosticsCallback callbacks.

Bug: 148032944
Test: atest android.net.cts.ConnectivityDiagnosticsManagerTest
Test: atest IpSecManagerTunnelTest
Change-Id: I7a443c368cf1ac470fbe40883ca24bc3143153b0
Merged-In: I7a443c368cf1ac470fbe40883ca24bc3143153b0
(cherry picked from commit 7b105b6194679fad6afe3615f0654b547034be6c)
2020-03-17 00:22:09 -07: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
Automerger Merge Worker
7b468810d9 [automerger skipped] Merge "Ensure that NetworkFactory objects cannot be reused." am: 07c7c2aa67 am: 1ab2032d42 -s ours
am skip reason: Change-Id I793436ee0f4b5d778788ad34b8a2575d2ad0ed80 with SHA-1 487b677f3a is in history

Change-Id: I5672bf0133a8fa10a8d8332367d6a6fc046071e8
2020-03-17 05:19:06 +00:00
Automerger Merge Worker
1ab2032d42 Merge "Ensure that NetworkFactory objects cannot be reused." am: 07c7c2aa67
Change-Id: Ifc5cac306f1558c8560f1829eea538fe9a395b26
2020-03-17 04:55:06 +00:00
Lorenzo Colitti
07c7c2aa67 Merge "Ensure that NetworkFactory objects cannot be reused." 2020-03-17 04:35:01 +00:00
Automerger Merge Worker
9dbc3a6536 Merge "Make LinkPropertiesTest backwards compatible" am: 2fad017e86 am: 6d4b9d15dd
Change-Id: Ie1db141b72770490632c3974b904ee9b1438922e
2020-03-17 03:05:25 +00:00
Automerger Merge Worker
6d4b9d15dd Merge "Make LinkPropertiesTest backwards compatible" am: 2fad017e86
Change-Id: Iedcb704eba4a342058a7b6fdea3f1bd83dec4744
2020-03-17 02:48:05 +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
Automerger Merge Worker
78adbab8e9 Merge "Clean up unit testing for ConnectivityDiagnostics." am: 3fef3af249 am: fb08471764
Change-Id: Idb2167c10f18e3d551a653483ba9ea344b872b87
2020-03-16 20:09:39 +00:00
Automerger Merge Worker
fb08471764 Merge "Clean up unit testing for ConnectivityDiagnostics." am: 3fef3af249
Change-Id: Idb4019968a3b3689f1aaddb5e59f3c609890104e
2020-03-16 19:52:06 +00:00
Cody Kesting
3fef3af249 Merge "Clean up unit testing for ConnectivityDiagnostics." 2020-03-16 19:33:33 +00:00
Automerger Merge Worker
013e39e33e Merge "Add support for registering test networks with administrators." am: 5ec743bd25 am: 78f4f08bbf
Change-Id: Ib10e5f0e1b564a4dd8e5ae0bd4032741dcd4e2bb
2020-03-16 18:32:43 +00:00
Automerger Merge Worker
78f4f08bbf Merge "Add support for registering test networks with administrators." am: 5ec743bd25
Change-Id: Ic6251b26fbbce029063d3f83c4fa6dbc4d01df40
2020-03-16 18:18:59 +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
Cody Kesting
5ec743bd25 Merge "Add support for registering test networks with administrators." 2020-03-16 18:02:55 +00:00
Automerger Merge Worker
49ea63ed4e [automerger skipped] Merge "Replace com.android.internal.util.Preconditions.checkNotNull with java.util.Objects.requireNonNull" am: b303fc5222 am: ad7408a4e6 -s ours
am skip reason: Change-Id Idb1b6ba41af3b52f3376b1157259af3c30328c4e with SHA-1 d4e7dd113d is in history

Change-Id: I0186fe6a3dea5c9f955ea12e97c36d9f08b6ffac
2020-03-16 17:42:40 +00:00
Automerger Merge Worker
ad7408a4e6 Merge "Replace com.android.internal.util.Preconditions.checkNotNull with java.util.Objects.requireNonNull" am: b303fc5222
Change-Id: Ibcfc11f90c8caa34954db73f668ca35a34c50e8d
2020-03-16 17:27:39 +00:00
Cody Kesting
b303fc5222 Merge "Replace com.android.internal.util.Preconditions.checkNotNull with java.util.Objects.requireNonNull" 2020-03-16 17:11:54 +00: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
Automerger Merge Worker
c4e7c81829 Merge "Ensure that NetworkFactory objects cannot be reused." into rvc-dev am: 518e54c7b0
Change-Id: I8f54bd5dcbca8c1c0e4477209feebebfe2b4a6ea
2020-03-16 16:27:43 +00:00
TreeHugger Robot
518e54c7b0 Merge "Ensure that NetworkFactory objects cannot be reused." into rvc-dev 2020-03-16 16:23:23 +00:00
Automerger Merge Worker
6844a58151 [automerger skipped] Merge "Update Javadoc comments for ConnectivityDiagnostics constants." into rvc-dev am: e80b81a7a4 -s ours
am skip reason: Change-Id Ib08f05562dd4b17973eeee97452d9f56d37e80fe with SHA-1 83bc447911 is in history

Change-Id: I7c764ef28caba3a515fca36f3fe0171d055aeae3
2020-03-16 15:56:09 +00:00
Cody Kesting
e80b81a7a4 Merge "Update Javadoc comments for ConnectivityDiagnostics constants." into rvc-dev 2020-03-16 15:39:43 +00:00
Automerger Merge Worker
21b9c023ec Merge "Protect ConnectivityService from SecurityException in permission check." am: ed459f5f1a am: 26cb0b40bf
Change-Id: Ia3bda6925daf06b762e6c926bea1b6ff4e640e58
2020-03-16 14:54:02 +00:00
Automerger Merge Worker
26cb0b40bf Merge "Protect ConnectivityService from SecurityException in permission check." am: ed459f5f1a
Change-Id: I30d993e431b9d6486dcaebdc48c525a861301f70
2020-03-16 14:47:49 +00:00
Cody Kesting
ed459f5f1a Merge "Protect ConnectivityService from SecurityException in permission check." 2020-03-16 14:33:25 +00:00
Automerger Merge Worker
a0f72849ec Merge changes I801ddc49,Id1b8f41b am: ba350f4652 am: dc9aa00cb7
Change-Id: Ib25ca9a843f19fb3791afbe23c065a0a7bb3b11f
2020-03-16 11:56:41 +00:00
Automerger Merge Worker
dc9aa00cb7 Merge changes I801ddc49,Id1b8f41b am: ba350f4652
Change-Id: I604bcfab22d7b26b84bf126d02d9be612fcb6d29
2020-03-16 11:41:19 +00:00
Automerger Merge Worker
dbf98d44d5 [automerger skipped] Merge "Add test for getDeprecationTime and getExpirationTime" into rvc-dev am: 95d81dfeff -s ours
am skip reason: Change-Id I64cd2c914f2da71383af7cdef2cf64c60a7d268c with SHA-1 ac98e787d3 is in history

Change-Id: I90422f29362f90c43c4f32857b0f8a09f932731d
2020-03-16 10:00:42 +00:00
Aaron Huang
b782017f20 Removing some of the API don't have to be @SystemApi
Some of the API we made @SystemApi won't be used by mainline
module. Removing these from the surface.

Bug: 151266974
Test: atest FrameworksNetTests
      atest FrameworksTelephonyTests
      atest FrameworksWifiTests

Change-Id: Ie30efa172f93a7557fb6ef56f4daf80e958c3787
Merged-In: Ie30efa172f93a7557fb6ef56f4daf80e958c3787
2020-03-16 17:39:41 +08: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
Automerger Merge Worker
4f7105e30b [automerger skipped] Merge "Accept MAINLINE_NETWORK_STACK permission on register/unregister network provider" into rvc-dev am: 132b843b78 -s ours
am skip reason: Change-Id Id22113aa0db01244817b4b008f5573c5e7b317f0 with SHA-1 b6ba8e84f4 is in history

Change-Id: I0a46cc19cb5cfb0a90a96299f48195ab2e2c836f
2020-03-16 05:53:38 +00:00
Automerger Merge Worker
dceed35751 Merge "Removing some of the API don't have to be @SystemApi" into rvc-dev am: dda89138cd
Change-Id: I72f00d09e74eb0de1d837a29a2b869a4de45178d
2020-03-16 05:53:15 +00:00
Paul Hu
132b843b78 Merge "Accept MAINLINE_NETWORK_STACK permission on register/unregister network provider" into rvc-dev 2020-03-16 05:48:33 +00:00
Aaron Huang
dda89138cd Merge "Removing some of the API don't have to be @SystemApi" into rvc-dev 2020-03-16 05:47:34 +00:00
Automerger Merge Worker
d66327d20a Merge "[SP21] Address comments for API council review about aosp/1172143" am: 24ab7411ba am: c01d9f8266
Change-Id: Ic4d1d7f7ce4bf8c6bf03fbe1da57216a8179bca9
2020-03-16 03:14:45 +00:00
Automerger Merge Worker
bbb6da1e01 [SP21] Address comments for API council review about aosp/1172143 am: 0c88795cb5 am: 1b7fe1b6f7
Change-Id: I86cf3b57722f64c0989ce606fde71d6173f812bb
2020-03-16 03:14:01 +00:00
Automerger Merge Worker
c01d9f8266 Merge "[SP21] Address comments for API council review about aosp/1172143" am: 24ab7411ba
Change-Id: Ief866c87b9e69b892fca435e8555080ffdad4af7
2020-03-16 03:05:06 +00:00
Automerger Merge Worker
1b7fe1b6f7 [SP21] Address comments for API council review about aosp/1172143 am: 0c88795cb5
Change-Id: I8634d6f6ed65ec6b10009a90b147881fe1fc4530
2020-03-16 03:03:51 +00: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
0097611d5e Merge "Resolve ambiguous argument." into rvc-dev am: 6738abeabf
Change-Id: I6aa3f7f9c0dfc63ebd7ffb3b38662af29d8f59cb
2020-03-16 02:15:17 +00:00
Roshan Pius
fae5822946 services.net: Add a static library needed by wifi module
Add a new static library that compiles against system_current which
includes all the parts needed by the wifi mainline module.

Also,
a) Refactored TcpKeepalivePacketData to use public APIs. The parcel
read/write methods in the base class are @hide and they're not used by
the other child class (NatKeepalivePacketData). So, remove the @hide
method from base class and use it direcly in the child class.

Bug: 145825329
Test: Device boots up & connects to wifi networks.
Change-Id: Ifde69b579cfe5b813766f676acb10e436e64a44c
Merged-In: Ifde69b579cfe5b813766f676acb10e436e64a44c
2020-03-16 00:23:42 +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
Automerger Merge Worker
6d05e6dacc [automerger skipped] Merge "Add javadoc for Network#netId" into rvc-dev am: 962ea56bd0 -s ours
am skip reason: Change-Id Iea34a5c58a8b77c83258a39a8a44601e21a482f5 with SHA-1 43321d2e00 is in history

Change-Id: Ie69348158857b989b25c3f7531de4d26f2b7965e
2020-03-15 03:04:27 +00:00
Mark Chien
962ea56bd0 Merge "Add javadoc for Network#netId" into rvc-dev 2020-03-15 02:53:29 +00:00