Commit Graph

8906 Commits

Author SHA1 Message Date
junyulai
8dd5ea04d6 [SP25] Rename functions that add Entry conditionally
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 conditionally,
name them addEntry.
  addValues -> addEntry

Test: atest FrameworksNetTests ImsPhoneCallTrackerTest TetheringTests
Fix: 148895143
Change-Id: I9495a198cf247e6c79100f7ac1edcea370b071de
2020-03-17 14:59:59 +00:00
junyulai
11ad688fc7 [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
Merged-In: I801ddc49e283a254b9586700c9b597c0adb0d459
(cherry picked from aosp/1256352)
2020-03-17 14:59:31 +00:00
junyulai
268e185cae [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
Merged-In: I141393f229e772d2eb9f7c156849e379bd71b845
(cherry picked from aosp/1253717)
2020-03-17 14:57:59 +00:00
Lorenzo Colitti
08707366d0 Shorten the output of NetworkAgentInfo#toString().
Currently, printing a NetworkAgentInfo results in a very long
string. Make it a bit shorter by:

- Not printing a number of fields in NetworkInfo that are no
  longer used.
- Instead of printing flags regardless of whether they are true
  false, only print ones that are true. For example, this changes
    everCaptivePortalDetected{true} lastCaptivePortalDetected{false} captivePortalValidationPending{false}
  to:
    everCaptivePortalDetected
- Only printing clat information if clatd is started.

Also, put the long and variable-length fields lp and nc at the
end of the output.

Test: manual
Change-Id: I3312286be307ef1762890cbc6b717f12ce5b2b92
2020-03-17 22:29:37 +09:00
Automerger Merge Worker
98d390c72e [automerger skipped] Merge "Removing some of the API don't have to be @SystemApi" am: b0863e0f5b am: 3507c7d8c7 -s ours
am skip reason: Change-Id Ie30efa172f93a7557fb6ef56f4daf80e958c3787 with SHA-1 d884e63e61 is in history

Change-Id: I3f81a90e806947d60fb8fe4f4856491284a43ed0
2020-03-17 13:15:17 +00:00
Automerger Merge Worker
3507c7d8c7 Merge "Removing some of the API don't have to be @SystemApi" am: b0863e0f5b
Change-Id: I6687ba646982ea924feae7d8da6732a04184321e
2020-03-17 13:04:11 +00:00
Treehugger Robot
b0863e0f5b Merge "Removing some of the API don't have to be @SystemApi" 2020-03-17 12:51:25 +00:00
Automerger Merge Worker
64b87e0b7c Merge changes I97015365,Ic9db4b9b am: 4d08f370af am: d714cd3f6d
Change-Id: I058fcb4d7dac3ef384c3ccbe5a2cc880c6aed2a3
2020-03-17 10:16:15 +00:00
Automerger Merge Worker
d714cd3f6d Merge changes I97015365,Ic9db4b9b am: 4d08f370af
Change-Id: Ic99385f58c7a0ee246d7dfeb12eb1723fda65c4b
2020-03-17 09:54:53 +00:00
Chiachang Wang
4d08f370af Merge changes I97015365,Ic9db4b9b
* changes:
  Add NattKeepalivePacketDataTest
  Add KeepalivePacketDataTest
2020-03-17 09:38:41 +00:00
Automerger Merge Worker
e9091054b9 [automerger skipped] Merge "services.net: Add a static library needed by wifi module" am: d7a6ba0cbb am: 98fd86ff4d -s ours
am skip reason: Change-Id Ifde69b579cfe5b813766f676acb10e436e64a44c with SHA-1 1378facba4 is in history

Change-Id: Ia476746bb37fee381245f49a801bf9abb32ba04d
2020-03-17 09:35:52 +00:00
Automerger Merge Worker
247c45e31a [automerger skipped] Merge "services.net: Use the new ModuleNetworkStackClient" am: c35936db0e am: 363ea3e26c -s ours
am skip reason: Change-Id I065525fdbd64b9509ef0f47bb35954d267c65fd2 with SHA-1 58d144f6ed is in history

Change-Id: I25e57f7208899f370a5131daa271dbf40ffcbe49
2020-03-17 09:35:40 +00:00
Automerger Merge Worker
98fd86ff4d Merge "services.net: Add a static library needed by wifi module" am: d7a6ba0cbb
Change-Id: I9088ccdec461145b16597d50834d231c9ea771d5
2020-03-17 09:28:23 +00:00
Automerger Merge Worker
363ea3e26c Merge "services.net: Use the new ModuleNetworkStackClient" am: c35936db0e
Change-Id: I97918b59b98a76267935680ceae19881f5f42e7b
2020-03-17 09:27:07 +00:00
Treehugger Robot
d7a6ba0cbb Merge "services.net: Add a static library needed by wifi module" 2020-03-17 09:22:12 +00:00
Remi NGUYEN VAN
c35936db0e Merge "services.net: Use the new ModuleNetworkStackClient" 2020-03-17 09:21:40 +00:00
Automerger Merge Worker
f643d0cae0 [automerger skipped] Merge "Add test for NetworkAgentConfig" into rvc-dev am: 6bf269b1b5 -s ours
am skip reason: Change-Id If9158d086bacb0ade94d59898ac223e4c8f4f73a with SHA-1 97ae1a81fa is in history

Change-Id: I28afe6a88dc5972527f1f2949062813ca83295c6
2020-03-17 09:16:01 +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
Automerger Merge Worker
2172759ccc Merge "Move sensitive field parceling bool to constructor" am: abc08c2456 am: 594f036a0e
Change-Id: Ice332671a4b97dad595c79c8c42ce47dca52b8e2
2020-03-17 08:17:51 +00:00
Automerger Merge Worker
594f036a0e Merge "Move sensitive field parceling bool to constructor" am: abc08c2456
Change-Id: Ib5619a2173d838e81091415fe6323370f61c9461
2020-03-17 08:05:40 +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
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