Commit Graph

8762 Commits

Author SHA1 Message Date
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
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
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
TreeHugger Robot
518e54c7b0 Merge "Ensure that NetworkFactory objects cannot be reused." into rvc-dev 2020-03-16 16:23:23 +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
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
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
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
Mark Chien
962ea56bd0 Merge "Add javadoc for Network#netId" into rvc-dev 2020-03-15 02:53:29 +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
Automerger Merge Worker
025f73910a Update Javadoc comments for ConnectivityDiagnostics constants.
API Council feedback requested adding documentation for detection method
constants used in DataStallReport to indicate how the Data Stall was
detected.

Bug: 150598997
Test: n/a
Change-Id: Ib08f05562dd4b17973eeee97452d9f56d37e80fe
Merged-In: Ib08f05562dd4b17973eeee97452d9f56d37e80fe
(cherry picked from commit 52d9e61121883945931de533b5cfd44da30c0248)
2020-03-13 21:00:31 +00:00
Cody Kesting
417004a722 Merge "Clear UIDs when sharing NetworkCapabilties for ConnectivityDiagnostics." into rvc-dev 2020-03-13 18:44:50 +00:00
Roshan Pius
1378facba4 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.
b) Add jar-jar rules for all the statically linked dependencies in wifi
service jar rules.

Exempt-From-Owner-Approval: Minor change on top of owner's approval.
Bug: 145825329
Test: Device boots up & connects to wifi networks.
Change-Id: Ifde69b579cfe5b813766f676acb10e436e64a44c
2020-03-13 14:42:09 +00:00
Aaron Huang
d884e63e61 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
2020-03-13 15:08:05 +08: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
Automerger Merge Worker
7b4eada7c2 Add javadoc for Network#netId
Bug: 151156820
Test: m doc-comment-check-docs

Change-Id: I18e6022c7b0b8bf132069f33d916d1b16d53d4f0
Merged-In: Iea34a5c58a8b77c83258a39a8a44601e21a482f5
(cherry picked from commit ab23c0fef8c02a9d63b1b48628eb687f589aac72)
2020-03-13 02:31:30 +00: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
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
Chiachang Wang
10736d2107 Merge "Skip Route tests that are R-specific on Q" into rvc-dev 2020-03-11 09:36:23 +00:00
Lorenzo Colitti
f25e167d93 Merge "Merge NetworkStatsService handler changes." into rvc-dev 2020-03-11 06:19:18 +00: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
Automerger Merge Worker
6617c9be42 Accept MAINLINE_NETWORK_STACK permission on register/unregister network provider
Registering/Unregistering network provider needs NETWORK_FACTORY
which is signature only permission. But mainline modules can't
grant this permission because it's not signed with platform key.
Hence, these APIs should also accept MAINLINE_NETWORK_STACK
permission that allow mainline module to register/unregister
network provider.

Bug: 150733435
Test: atest FrameworksNetTests
Change-Id: Id22113aa0db01244817b4b008f5573c5e7b317f0
Merged-In: Id22113aa0db01244817b4b008f5573c5e7b317f0
(cherry picked from aosp/1248727)
2020-03-10 09:38:50 +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
Remi NGUYEN VAN
6137e3cd42 Merge "Skip LinkAddress tests that are R-specific on Q" into rvc-dev 2020-03-10 00:59:32 +00:00
Remi NGUYEN VAN
70bb7064cf Merge "Ignore testReevaluateNetwork until Q" into rvc-dev 2020-03-10 00:59:12 +00:00
Cody Kesting
5f3c53a268 Clear UIDs when sharing NetworkCapabilties for ConnectivityDiagnostics.
ConnectivityDiagnostics shares NetworkCapabilities in
ConnectivityReports and DataStallReports. These NetworkCapabilities need
to have their UIDs scrubbed before they are shared with callbacks.

Bug: 148942124
Test: atest FrameworksNetTests
Change-Id: I5bde5a8116f7e36b8f4de49adf4cab8ec45a5aa4
Merged-In: I5bde5a8116f7e36b8f4de49adf4cab8ec45a5aa4
(cherry picked from commit 3de243265558fb5505b4daabe715a5090104450f)
2020-03-09 08:27:10 -07:00
Automerger Merge Worker
911106c17c Merge NetworkStatsService handler changes.
=====
Remove the need of accessing handler in NSS unit test

Currently, to wait for handler becomes idle, specific message
is used and the test would wait for condition variable to be
open when the message is processed.

However, this is already done in the HandlerUtils. Thus,
there is no need to post such message manually in the handler.

Test: atest FrameworksNetTests
Bug: 150664039

Change-Id: Iab32b2dbab01634ca159dcb90fc9f929d1fed1a2
=====
Remove setHandler in NetworkStatsService

Currently, internal handler is set by setHandler after
constructing NSS object. This was introduced in ag/866187 to
access the handler in the unit test.

However, the design put NSS in a bad situation where all classes
that need handler or executor could not be final and need to be
dynamically allocated in order to get a valid handler.

Thus, since the usage of handler is removed in previous patch,
this change eliminate setHandler by initializing the handler in
the constructor.

Test: atest FrameworksNetTests
Bug: 150664039

Change-Id: I794a24d00b0ca9fdc78091e7b9ab7307e0f034b7
=====

Bug: 150664039
Change-Id: If256ed4437ddcbcc72a6f766cff2f4cc512ee3f7
Merged-In: If256ed4437ddcbcc72a6f766cff2f4cc512ee3f7
(cherry picked from commit 2a6439d7e2a3926e10a0b9a4dc730b1a022d8138)
2020-03-09 07:59:27 +00:00
Automerger Merge Worker
d7e80c1f34 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
Merged-In: I913b6eaa61bfd4f1964b324dcb4dd272aa8cc583
(cherry picked from commit 4d166d7bd95d9582335aafaa03fb242206449054)

Change-Id: I2ddeee53d4ef63f01b791e3e95161194e29d3978
2020-03-09 06:34:01 +00:00
Automerger Merge Worker
890f021f5a 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
Merged-In: I98b14727eabcf569829eee8df34afc057eba6f93
(cherry picked from commit 4e00259d220590acf781382de0542cbae75ec16f)

Change-Id: I9599afa8ae64bb13c93d5f26ebedf3f8dedff6d9
2020-03-09 06:33:28 +00:00
Automerger Merge Worker
78d504da06 Ignore NetworkAgentConfigTest on Q
NetworkAgentConfig did not exist on Q.

Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkAgentConfigTest
          on Q and R devices
Bug: 150918852
Merged-In: I5414d7767c39327ff41673ff13ccd34982e10742
(cherry picked from commit d7fedf26d03759cb26a19a6558cf39189b66a681)

Change-Id: I868398148d80afb73659df4d7312f1c2e245ead9
2020-03-09 06:32:14 +00:00
Automerger Merge Worker
de03bda1c3 Remove polling of TetheringManager in ConnectivityManager.
Test: manual

Bug: 144742179
Merged-In: I7d88b38eb3d741534e980b7d1e226a411b71fae2
(cherry picked from commit f8a55a19faa938b4e58310f9a90926276b7936ea)

Change-Id: I5cc4231bfb9a0709d677acbb317ee98af31bd041
2020-03-09 06:29:22 +00:00
Chalard Jean
e34d090bce Merge "Remove the NetworkScore class." into rvc-dev 2020-03-09 05:54:30 +00:00
Automerger Merge Worker
e58e7a4d85 Add more assertions to testStackedLinkProperties.
Check all routes that are added and removed instead of just some
of them. This is in preparation of an upcoming change that
switches to adding and creating routes by issuing direct calls to
netd.

Also rename the misleading ipv4Default route variable to
ipv4Subnet, which is what it actually is.

Bug: 142892223
Test: test-only change
Change-Id: I7d111382be215a926a7d7d4701bd3c3e94372b99
Merged-In: I7d111382be215a926a7d7d4701bd3c3e94372b99
(cherry picked from commit dcb35cb9a5d1c250e6564b6e66a4b436dd11c795)
2020-03-09 03:48:15 +00:00
Automerger Merge Worker
76eead56aa Remove the NetworkScore class.
This class is useless at this point and introduces overhead.

Bug: 113554781
Test: FrameworksNetTests
Change-Id: Ib5f540070222865260c16c7182cc13c710a243c2
Merged-In: Ib5f540070222865260c16c7182cc13c710a243c2
(cherry picked from commit c3489ad3a6ce98218ce223cea877586781025b98)
2020-03-09 03:46:34 +00:00
Automerger Merge Worker
13a85611f8 test: ConnectivityService: Validate Route Add/Del
Validate route addition and deletion after linkProperties are
changed.

Bug: 142892223
Test: atest ConnectivityServiceTest#testStackedLinkProperties
Change-Id: I18296b933e856a0f8a4c1dbd75bd35024853bfbb
Merged-In: I18296b933e856a0f8a4c1dbd75bd35024853bfbb
(cherry picked from commit a22a979a0caf3e3533ede410d48127084052aec5)
2020-03-09 03:36:10 +00:00
Automerger Merge Worker
87cdb7c771 test: LinkProperties: Unique Route Destinations
Routes will always have unique destinations. Update tests
to use unique destinations when adding multiple routes.

Bug: 142892223
Test: treehugger
Change-Id: I238899b0643407a1be29eb66d28728ca5d5dbc80
Merged-In: I238899b0643407a1be29eb66d28728ca5d5dbc80
(cherry picked from commit 891ea460b10c3ee3c74298dad828bd550e66b81f)
2020-03-09 03:33:03 +00:00
lucaslin
73f992fd80 Remove redundant connected notification
Remove the old connected notification since there is a new file
- NetworkStackNotifier.java which will send the connected
notification when captive portal validated.

Bug: 149883761
Test: 1. atest FrameworksNetTests
      2. Sign-in a captive portal and see if there is a redundant
      connected notification.

Change-Id: Id11a9b99dd04772a92af8d527104906c47bf64cd
Merged-In: Id11a9b99dd04772a92af8d527104906c47bf64cd
2020-03-05 06:48:12 +00:00
Chalard Jean
fdb872c4ed Revert "Add public fields to NetworkScore and make it @SystemApi"
This reverts commit 511f7e3792.

Bug: 113554781
Test: FrameworksNetTests FrameworksTelephonyTests FrameworksWifiTests
Change-Id: Ie1e84bd2a16f088307b195f924f4e49335cbe367
2020-02-28 06:26:27 +00:00
Chalard Jean
4c2f233f6b Merge changes Ia91b3b3c,Id9ecdac5,I4b17d1b1
* changes:
  Revert "[NS D01] Remove candidates that don't satisfy the request."
  Revert "[NS D02] Mix in the ignore on wifi policy."
  Revert "Address comments on ag/10316753"
2020-02-21 11:06:55 +00:00
Automerger Merge Worker
f76bed30a9 Merge "Remove useless thread checks" am: 269d32a0fa am: bb87d5aeb5 am: 374e1adce8
Change-Id: Ib091ec185495184867b77528aee7492b9b571ada
2020-02-21 10:21:50 +00:00
Automerger Merge Worker
374e1adce8 Merge "Remove useless thread checks" am: 269d32a0fa am: bb87d5aeb5
Change-Id: I7a1fe60971b733cb6bc3c848eeed8624210d97ff
2020-02-21 10:00:45 +00:00
Automerger Merge Worker
bb87d5aeb5 Merge "Remove useless thread checks" am: 269d32a0fa
Change-Id: I1dc9ce4e5ef5ca2012264fdb736606a36f20c8a3
2020-02-21 09:37:21 +00:00
Chalard Jean
d15ca10d6d Revert "[NS D01] Remove candidates that don't satisfy the request."
This reverts commit a19115d482.

Reason for revert: The feature was punted out of R.

Change-Id: Ia91b3b3c55f735dae64ffa3194614a6f2631a087
2020-02-21 09:29:00 +00:00
Chalard Jean
1d9a206bca Revert "[NS D02] Mix in the ignore on wifi policy."
This reverts commit 7a56387e2c.

Reason for revert: The feature was punted out of R.

Change-Id: Id9ecdac5292eeddf7c12f2330421248b0f8355a9
2020-02-21 09:28:18 +00:00