Commit Graph

8625 Commits

Author SHA1 Message Date
markchien
ed55c7ad03 Expose netId by adding getter API
Bug: 151156820
Test: m
      atest TetetheringTests
Change-Id: Ieb1483c146aa2f7d8f251157e6e81d71c44ae899
(cherry picked from commit 8831c4b54178753013d568c0b76bbf7487db8122)
2020-03-19 15:57:31 +09:00
Cody Kesting
5c6b1f1fd0 Merge "Change NetworkCapabilities administrator UIDs to be stored as int[]." into rvc-dev 2020-03-18 19:40:39 +00:00
Cody Kesting
46a0db809f Change NetworkCapabilities administrator UIDs to be stored as int[].
NetworkCapabilities#mAdministratorUids is used to track the UIDs that
are administrators of the given Network. This value was previously
stored as List<Integer>. However, general Android API Council guidelines
recommend using Arrays for primitive values. In order to be consistent
with the guidelines, updating the field to use an Array.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: I2652a5b0f276b8944454af5cb4b1383a3e054cfa
2020-03-18 17:40:24 +00:00
TreeHugger Robot
a9c8f382d9 Merge "Fix flaky ConnectivityServiceTest#testNetworkFactoryUnregister" into rvc-dev 2020-03-18 11:49:09 +00:00
Chiachang Wang
f3777c09f5 Merge changes I97015365,Ic9db4b9b into rvc-dev
* changes:
  Add NattKeepalivePacketDataTest
  Add KeepalivePacketDataTest
2020-03-18 10:15:15 +00:00
Junyu Lai
84c3f44278 Fix flaky ConnectivityServiceTest#testNetworkFactoryUnregister
Test: atest ConnectivityServiceTest#testNetworkFactoryUnregister \
      --geneate-new-metrics 100
Bug: 151792032

Change-Id: I1ee7a26186885d3a79a32ec9e45f5bcd656a6680
Merged-In: I1ee7a26186885d3a79a32ec9e45f5bcd656a6680
Merged-In: Iece9e8ad5c51170cd404ac995d0005392d37fe0c
(cherry picked from commit 31c26cdbeb35a6fd6a53a1c25cce6d36b825bf41)
2020-03-18 10:09:44 +00:00
Chiachang Wang
b05dcda675 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
Merged-In: I97015365604be1846e3ecbaf60ac99e334705565
2020-03-18 05:44:26 +00:00
Chiachang Wang
fa4521c1a7 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
Merged-In: Ic9db4b9b83ff96c87f41c5f381763c3ee8dd27c8
2020-03-18 05:43:42 +00:00
Junyu Lai
6fb3f0aafa Merge changes from topics "am-ad04c8ad832c4674be35bfc5fe4280dd-rvc-dev", "sp21-api-review-feedback", "sp25-networkstats-rename" into rvc-dev
* changes:
  [SP25] Rename functions that add Entry conditionally
  [SP24] Rename functions that add Entry unconditionally
  [SP23] Address misc API review comment about NetworkStats
  [SP21] Address comments for API council review about aosp/1172143
  [SP20] Check signature permission when accessing network stats provider
2020-03-17 23:11:34 +00:00
Cody Kesting
13e16c007f Merge "Add support for registering test networks with administrators." into rvc-dev 2020-03-17 15:31:26 +00:00
Cody Kesting
e2f56e3d36 Merge "Protect ConnectivityService from SecurityException in permission check." into rvc-dev 2020-03-17 15:31:06 +00:00
Cody Kesting
ed28f2db59 Merge "Update ConnectivityDiagnosticsCallback function name." into rvc-dev 2020-03-17 15:29:55 +00:00
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
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