Commit Graph

130 Commits

Author SHA1 Message Date
Lorenzo Colitti
6bed8201a3 Merge "Add new network capabilities to support automotive head unit via USB" into sc-dev 2021-03-30 14:36:56 +00:00
Lorenzo Colitti
27e1d0473e Merge changes If539cf5d,I9765f1c9,I6d3007a1 am: f2babbbd67 am: e18ea6cb80 am: 34792dd0c9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1652262

Change-Id: I94e5cf19a7b7dac8400cb7acf80b39a864099956
2021-03-30 02:24:00 +00:00
Lorenzo Colitti
a27075fe12 Merge "Add session ID to VpnTransportInfo" into sc-dev 2021-03-30 00:39:38 +00:00
Lorenzo Colitti
9364b3a406 Add a setTeardownDelayMs API to NetworkAgent.
This allows transports to request that when the network is
disconnected, the system should delay destroying the native
network until the specified time has passed after the network
disconnected.

Bug: 181941583
Test: next CL in the stack
Change-Id: I9765f1c9d1e55c23c6d583d6709dbe06505975b1
2021-03-29 21:33:08 +09:00
lucaslin
593a1b4dfa Add new network capabilities to support automotive head unit via USB
- Add a new transport type for USB and a new network capability
to support automotive head unit.
- In order to pass DnsManagerTest#testTransportTypesEqual, Android.bp
needs to link to dnsresolver_aidl_interface-V8-java. That test checks
whether the TRANSPORT types defined in NetworkCapabilities are the
same as IDnsResolver.aidl.

Bug: 181742019
Test: atest FrameworksNetTests
Change-Id: Iec2df09a776d779108f95098e01b7ffdf6f8867a
2021-03-29 10:59:06 +00:00
lifr
d90927f218 [TL02]Remove hidden API usage of NetworkAgent
The connection service will become the mainline module.
Remove the hidden API usage of NetworkAgent.

Bug: 170598012
CTS-Coverage-Bug: 170598012
Test: atest FrameworksNetTests FrameworksTelephonyTests
      atest FrameworksWifiTests
Change-Id: I4e4040ae7f94bdf479c7df9ec2ffabafbe06331c
Merged-In: I4e4040ae7f94bdf479c7df9ec2ffabafbe06331c
2021-03-29 15:33:44 +08:00
lifr
4d604c81db Add session ID to VpnTransportInfo
- This will be visible only to apps with the NETWORK_SETTINGS
  permissions (signature), and will be redacted for all other callers.
- This string is expected to be the same as set by
  VpnService#setSession, and in general, VpnConfig.session. But it
  will be a general API that Vpn.java can call when setting the
  VpnTransportInfo.
- This string cannot be updated once the VPN NetworkAgent is connected.

Bug: 171872481
Test: atest ConnectivityServiceTest
      atest VpnTransportInfoTest
      atest android.net.cts.NetworkAgentTest
Change-Id: I8d09e25b83f7ee8be21ec9c9bd3c72a251f1370d
2021-03-29 10:12:17 +08:00
Treehugger Robot
c1657fb7f8 Merge "Add network disconnected callback" 2021-03-26 05:47:33 +00:00
Lorenzo Colitti
92aa222f02 Merge changes from topic "blocked-reasons-callback-tests" am: 2108a92452 am: 05c65a10f5 am: 5aa6b8d707
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1652214

Change-Id: I4d69b1ce096d83c311620950650460024ae348c0
2021-03-26 05:27:47 +00:00
Chalard Jean
1a0debaab0 Merge changes from topic "ns05" into sc-dev
* changes:
  [NS06] Implement the don't-reap mechanism
  [NS05] Feed network offer callbacks
2021-03-26 05:07:39 +00:00
Chiachang Wang
1c5f57f921 Add network disconnected callback
Create a network callback to notify network agent after the
native network being destroyed by netd which means the network
is fully disconnected. The NetworkAgent may handle this event
after sending disconnect state to ConnectivityService to proceed
its pending works that have to be done after it.

Bug: 178725261
Test: make update-api
Change-Id: I602ff2c688909473b03b72c9407d4286608cff4c
Merged-In: I602ff2c688909473b03b72c9407d4286608cff4c
2021-03-26 02:53:29 +00:00
Chiachang Wang
ebbc803638 Merge "Expose BIP and VSIM relavent definitions" into sc-dev 2021-03-26 02:38:34 +00:00
Lorenzo Colitti
8ad5812ebc Add onBlockedStatusChanged(Network, int) to NetworkCallback.
This is similar to onBlockedStatusChanged(Network, boolean) but
it allows the callback holder to know the exact reason why
networking was blocked. It is useful to privileged system
components such as JobScheduler that are able to ignore some
blocked reasons but not others.

Also add a new BLOCKED_REASON_LOCKDOWN_VPN that is used when
networking is blocked because an always-on VPN is in
lockdown mode.

Also move BLOCKED_METERED_REASON_MASK to ConnectivityManager.
This is necessary because ConnectivityService must ensure that
the blocked status callbacks are correctly sent when meteredness
changes (e.g., a UID that is blocked on metered networks will
become unblocked on a network that becomes unmetered). In order
to do this it needs to know which reasons apply only on metered
networks.

Bug: 165835257
Test: unit tests in subsequent CLs in the stack
Change-Id: I647db4f5a01280be220288e73ffa85c15bec9370
2021-03-26 02:37:19 +09:00
paulhu
7a4eeed62f Add MOBILE_DATA_PREFERRED_APPS setting
This setting is OEM upstream requirement for mobile data
preferred apps feature.

Bug: 171872461
Test: atest FrameworksNetTests
Merged-In: Ic5e0515b2b948de3d333c8d8e073d0b15514562a
Change-Id: Iba17bf68cffbe39d1c08ad94364b41bbf851bf57
2021-03-26 02:37:19 +09:00
paulhu
6865eb6dda Add PRIVATE_DNS_MODE setting setter
Bug: 182538166
Test: atest FrameworksNetTests
Merged-In: If234426f041606c4881de1eca31b6f5bdb3c6bfe
Change-Id: Iaa9e6cc92f1805ab341c308fc60e947ec4c674f0
2021-03-26 02:37:16 +09:00
paulhu
9443095517 Expose ConnectivitySettingsManager as module-lib API
Have getter/setter methods for external modules that can
get/set the setting values.

Bug: 182538166
Test: atest FrameworksNetTests
Merged-In: I82225a43f95e3e1d3e52c4e7a0fc541c0087292e
Change-Id: I61cb00216494e35b6e0dfe444b177cad36ad8afb
2021-03-26 02:35:07 +09:00
Paul Hu
1cda176f02 Merge "Add MOBILE_DATA_PREFERRED_APPS setting" into sc-dev 2021-03-25 15:01:30 +00:00
Chalard Jean
fa33bef466 [NS06] Implement the don't-reap mechanism
This exposes a mechanism for network providers to tell
the network stack that a given network must be kept up
for some specific reason. This is meant to be easier
for them than to have to file a request, in particular
because there is no guaranteed way to make sure the
request will be best matched by any given network.

Test: new test for this
Bug: 167544279
Change-Id: I238a3ee5ee9262477a23b897e4141769dd1505d1
2021-03-25 14:10:06 +00:00
Paul Hu
fe704c3d7e Merge "Add PRIVATE_DNS_MODE setting setter" into sc-dev 2021-03-25 13:59:18 +00:00
Paul Hu
50c73a6865 Merge "Expose ConnectivitySettingsManager as module-lib API" into sc-dev 2021-03-25 13:50:45 +00:00
Chiachang Wang
1b7563cb1e Merge "Add network created callback support" 2021-03-25 13:22:17 +00:00
Chiachang Wang
d3881b98ed Expose BIP and VSIM relavent definitions
In order to support special APNs below, OEM may need extra
NetworkCapabilities and apn type definition to support the
carriers request. Add corresponding definition into API
surface.

VSIM: for Virtual SIM service
BIP: for Bearer Independent Protocol

Bug: 130869457
Test: make update-api
Change-Id: I41e881c6fe39e92d5cdac2d0a02fa8a8e814c9c5
2021-03-25 21:19:37 +08:00
paulhu
63cf0d0e82 Add MOBILE_DATA_PREFERRED_APPS setting
This setting is OEM upstream requirement for mobile data
preferred apps feature.

Bug: 171872461
Test: atest FrameworksNetTests
Change-Id: Ic5e0515b2b948de3d333c8d8e073d0b15514562a
2021-03-25 13:13:15 +00:00
Chalard Jean
428b913abd [NS05] Feed network offer callbacks
The design is very simply expressed :
An offer is needed for a request if and only if that offer
might beat the satisfier for that request.

The implementation of "might beat" is NetworkRanker#mightBeat.

Test: FrameworksNetTests FrameworksWifiTests NetworkStackTests
Bug: 167544279
Change-Id: I0fe911eef2483ecbac48c733d56283b81538690a
2021-03-25 22:13:10 +09:00
paulhu
d559441862 Add PRIVATE_DNS_MODE setting setter
Bug: 182538166
Test: atest FrameworksNetTests
Change-Id: If234426f041606c4881de1eca31b6f5bdb3c6bfe
2021-03-25 13:11:54 +00:00
paulhu
b05c16b2a4 Expose ConnectivitySettingsManager as module-lib API
Have getter/setter methods for external modules that can
get/set the setting values.

Bug: 182538166
Test: atest FrameworksNetTests
Change-Id: I82225a43f95e3e1d3e52c4e7a0fc541c0087292e
2021-03-25 20:12:43 +08:00
Lucas Lin
8e4ae68ddd Merge "Expose some APIs from ConnectivityManager" 2021-03-25 11:29:08 +00:00
Lucas Lin
514e8ad39c Merge changes Ic2357dcf,Iddf8c71a
* changes:
  Expose NetworkAgent constructor taking a NetworkScore parameter
  Expose NetworkScore to external caller
2021-03-25 11:28:28 +00:00
Chiachang Wang
e211de2893 Add network created callback support
Create a network callback to notify network agent after
netd has created the network, so that the NetworkAgent may
wait for this callback and ensure the pre-work to communicate
with netd completed.

Bug: 178725261
Test: make update-api
Change-Id: I8c2ff7bd6980ae838abc5669f9419d62741b8666
Merged-In: I8c2ff7bd6980ae838abc5669f9419d62741b8666
2021-03-25 18:27:24 +08:00
Chiachang Wang
9affe28062 Add network disconnected callback
Create a network callback to notify network agent after the
native network being destroyed by netd which means the network
is fully disconnected. The NetworkAgent may handle this event
after sending disconnect state to ConnectivityService to proceed
its pending works that have to be done after it.

Bug: 178725261
Test: make update-api
Change-Id: I602ff2c688909473b03b72c9407d4286608cff4c
CTS-Coverage-Bug: 178725261
2021-03-25 09:58:48 +00:00
TreeHugger Robot
affca14fe6 Merge "Add network created callback support" into sc-dev 2021-03-25 08:52:56 +00:00
Chiachang Wang
4694a2ab04 Expose NetworkAgent constructor taking a NetworkScore parameter
Vpn constructs NetworkAgent with this exposed NetworkAgent
constructor. Given NetworkAgent is moving into the incoming
connectivity module, Vpn which is outside the module will not
be able to access it if it's not in the API surface. Thus,
expose it to allow Vpn to use it.

Bug: 182963397
Test: make update-api
Change-Id: Ic2357dcfff3233e0dd17b48b0e376a5095ef60fa
Merged-In: Ic2357dcfff3233e0dd17b48b0e376a5095ef60fa
CTS-Coverage-Bug: 172183305
  (cherry-picked from ag/13966707)
2021-03-25 08:40:27 +00:00
lucaslin
39907ba9d6 Expose NetworkScore to external caller
NetworkScore will be a part of mainline module, so the external
callers cannot call its hidden APIs. Expose needed APIs to
the external callers.

CTS-Coverage-Bug: 182963397
Bug: 182963397
Test: m
Change-Id: Iddf8c71a5f51a40bc6ff78626b3e8ee530d1b7eb
Merged-In: Iddf8c71a5f51a40bc6ff78626b3e8ee530d1b7eb
  (cherry-picked from ag/13947595)
2021-03-25 08:15:09 +00:00
lucaslin
29278eef92 Expose some APIs from ConnectivityManager
- Expose setRequireVpnForUids to Vpn.java
- Expose setLegacyLockdownVpnEnabled to LockdownVpnTracker.java
- Expose requestRouteToHostAddress to
  GnssNetworkConnectivityHandler.java

Bug: 182963397
Test: m
Change-Id: I1fb5ecfbe37878ba3534e6c6c7599ca29db2735c
Merged-In: I1fb5ecfbe37878ba3534e6c6c7599ca29db2735c
  (cherry-picked from ag/13927657)
2021-03-25 08:07:53 +00:00
Chiachang Wang
18d4281317 Add network created callback support
Create a network callback to notify network agent after
netd has created the network, so that the NetworkAgent may
wait for this callback and ensure the pre-work to communicate
with netd completed.

Bug: 178725261
Test: make update-api
Change-Id: I8c2ff7bd6980ae838abc5669f9419d62741b8666
CTS-Coverage-Bug: 178725261
2021-03-25 00:27:11 +00:00
Jayachandran Chinnakkannu
dd89c6876a Merge "Add 5G/NR QOS support" am: 0deb814870 am: 05e4507857 am: 6c981f1bd3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1643762

Change-Id: I74c0d7d771d0b7e067dddc582389f77b8a899542
2021-03-24 18:58:50 +00:00
Jayachandran Chinnakkannu
0deb814870 Merge "Add 5G/NR QOS support" 2021-03-24 17:44:48 +00:00
Sudheer Shanka
f1520bb8dc Move BLOCKED_REASON_* constants from NPMS into ConnectivityManager.
These constants will now be including all the reasons for why an
uid's network access can be blocked, instead of only the
restrictions that could be imposed by NPMS.

Bug: 183473548
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Merged-In: I4c544415e12adf442fd2415c371b1b70a39c3aa4
Change-Id: I6dcea43fbefa9eac8b5a971b822a5be5422a54b4
2021-03-25 01:33:26 +09:00
TreeHugger Robot
eb04adf4bc Merge "Move BLOCKED_REASON_* constants from NPMS into ConnectivityManager." into sc-dev 2021-03-24 16:02:56 +00:00
Sarah Chin
3c405692ad Merge "API to get network visible network capability name" into sc-dev 2021-03-24 05:27:45 +00:00
Jayachandran C
d57b2853a3 Add 5G/NR QOS support
Bug: 155176305
Bug: 182317794
Test: atest ConnectivityServiceTest
      atest QosCallbackTrackerTest

Change-Id: Idf6d8a7c3b80bc50a2c1244ceaefea9381d40c2f
2021-03-23 19:14:21 -07:00
Sarah Chin
34fbbbb6b9 API to get network visible network capability name
Test: atest DataConnectionTest, DcTrackerTest
Bug: 181916712
CTS-Coverage-Bug: 183553812
Change-Id: Iae63ac4d62641cee2bd0f0c5f50dd729750d514c
2021-03-24 00:27:11 +00:00
Sudheer Shanka
1d0d9b4627 Move BLOCKED_REASON_* constants from NPMS into ConnectivityManager.
These constants will now be including all the reasons for why an
uid's network access can be blocked, instead of only the
restrictions that could be imposed by NPMS.

Bug: 183473548
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Merging internally first to handle conflicts.
Change-Id: I4c544415e12adf442fd2415c371b1b70a39c3aa4
2021-03-23 15:26:29 -07:00
Lorenzo Colitti
d86c8c2c8a Merge "Have a new method in NetworkAgentConfig.Builder to set allowBypass" am: 1a6e0ea3fd am: 17b490ed13 am: 5a0360c6a1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649288

Change-Id: Ibc6553b1471ee8e0ab362979ba9525c2e328a275
2021-03-23 14:02:47 +00:00
Lorenzo Colitti
f7cf543a86 Merge changes I638ed5cd,I29f15571,I21a22ed1 am: 750e8ca69e am: b1fbb5ca62 am: 787caa8c08
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1648068

Change-Id: I6d897cdcfb5b0e4809a32312071eb77623754f94
2021-03-23 14:01:19 +00:00
TreeHugger Robot
3cccf48918 Merge "Expose NetworkAgent constructor taking a NetworkScore parameter" into sc-dev 2021-03-23 12:45:24 +00:00
Lucas Lin
d8e8a9557b Merge "Expose NetworkScore to external caller" into sc-dev 2021-03-23 12:18:23 +00:00
Chiachang Wang
074c7d7537 Merge "Add NetworkRequest.Builder creating from an existing instance" 2021-03-23 10:46:20 +00:00
Chiachang Wang
3ee63e5132 Expose NetworkAgent constructor taking a NetworkScore parameter
Vpn constructs NetworkAgent with this exposed NetworkAgent
constructor. Given NetworkAgent is moving into the incoming
connectivity module, Vpn which is outside the module will not
be able to access it if it's not in the API surface. Thus,
expose it to allow Vpn to use it.

Bug: 182963397
Test: make update-api
Change-Id: Ic2357dcfff3233e0dd17b48b0e376a5095ef60fa
CTS-Coverage-Bug: 172183305
2021-03-23 08:51:05 +00:00
lucaslin
18158aa33b Expose NetworkScore to external caller
NetworkScore will be a part of mainline module, so the external
callers cannot call its hidden APIs. Expose needed APIs to
the external callers.

CTS-Coverage-Bug: 182963397
Bug: 182963397
Test: m
Change-Id: Iddf8c71a5f51a40bc6ff78626b3e8ee530d1b7eb
2021-03-23 16:17:37 +08:00