Commit Graph

12650 Commits

Author SHA1 Message Date
Chiachang Wang
eefea38ae5 Merge "Add NetworkRequest.Builder creating from an existing instance" am: 08bebe4609
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649294

Change-Id: Ib990cb25d50c11b103e248c0c13c584e78aa3450
2021-03-23 11:36:07 +00:00
Chiachang Wang
08bebe4609 Merge "Add NetworkRequest.Builder creating from an existing instance" 2021-03-23 10:46:20 +00:00
Chiachang Wang
992047ed78 Add NetworkRequest.Builder creating from an existing instance
Provide a formal way to construct a new NetworkRequest from an
existing instance. The network capabilities inside the
NetworkRequest is hidden. There is no way to pass a
NetworkRequest and update its capabilities. Add
NetworkRequest.Builder creating from an existing instance to
allow to clone the network capabilities.

Bug: 172183305
Test: make update-api
Change-Id: I068462b2a1410daf67b0c95f2b643d396f079531
Merged-In: I068462b2a1410daf67b0c95f2b643d396f079531
2021-03-23 14:50:03 +08:00
Junyu Lai
4a074bc753 Merge "[VCN15] expose addUnwantedCapability and related APIs" am: 20d187254b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1639654

Change-Id: Ie88ff422c473d3891a054fa75b5175b30c10cec9
2021-03-23 05:27:53 +00:00
Lorenzo Colitti
70e7af26c4 Merge "Have a new method in NetworkAgentConfig.Builder to set allowBypass" am: c643098b0b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649288

Change-Id: I71d541b3578169410349356a149528954e1c8789
2021-03-23 05:18:03 +00:00
Junyu Lai
20d187254b Merge "[VCN15] expose addUnwantedCapability and related APIs" 2021-03-23 05:02:22 +00:00
Lorenzo Colitti
c643098b0b Merge "Have a new method in NetworkAgentConfig.Builder to set allowBypass" 2021-03-23 04:40:50 +00:00
Lorenzo Colitti
068f44831d Merge changes I638ed5cd,I29f15571,I21a22ed1 am: 71996469d2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1648068

Change-Id: I74e0c3eae3bf22c9a05968e2daf5b59da33f01bb
2021-03-23 01:37:03 +00:00
Lorenzo Colitti
71996469d2 Merge changes I638ed5cd,I29f15571,I21a22ed1
* changes:
  Expose registerDefaultNetworkCallbackAsUid.
  Support calling registerDefaultNetworkCallback for another UID.
  Store the effective UID in NetworkRequestInfo.
2021-03-23 01:27:58 +00:00
lucaslin
c276e2bb77 Have a new method in NetworkAgentConfig.Builder to set allowBypass
Have a new method in NetworkAgentConfig.Builder for Vpn to set
allowBypass.

Bug: 182963397
Test: m
Change-Id: I3f244464438325ee7f8a1b953d3fb28186293628
2021-03-23 09:01:40 +09:00
Chiachang Wang
fd13f9223f Expose uids related APIs in NetworkRequest and NetworkCapabilities
NetworkRequest is moving into the incoming connectivity mainline
module. The hidden setUids becomes inaccessible outside the
module. Shims for support cts in different API levels will need
to use it to verify the behavior of NetworkRequest. Thus, expose
it to the API surface.

Also, VPN uses getUids and setUids to control network
capabilities. Networkcapabilities is a part of incoming
connectivity mainline module but VPN is not. Thus, exposing these
two methods are needed to allow VPN to continue using it.

Test: make update-api
Bug: 172183305
Merged-In: I107c329d4d7130d488772166eae8b5e7aaa2ff04
Merged-In: If76877e6bde7abe3b5ddde078f87eefd027e675c
Change-Id: If76877e6bde7abe3b5ddde078f87eefd027e675c
2021-03-23 01:34:54 +09:00
Chiachang Wang
e0ace0533c Replace the usage of UidRange
UidRange is used in a shared way between ConnectivityService
and VPN through the use of NetworkCapabilities. UidRange will
be part of the ConnectivityService mainline but Vpn.java will
stay in the framework. We need a way to replace the APIs using
UidRange, or to make UidRange system API. The only really
relevant surface here is NetworkCapabilities#{setUids, getUids}.
The need for UidRange could be replaced by an integer Range, so
replace the usage of UidRange by a integer Range in
NetworkCapabilities#{setUids, getUids} and update the relevant
callers.

Bug: 172183305
Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk
Merged-In: I4e5aec6ef1ea02e038fcd7ed117a3b67b69c5cb9
Merged-In: Idb7f353788c5779a4fbbd107595e9326b99fe0a8
Change-Id: Idb7f353788c5779a4fbbd107595e9326b99fe0a8
2021-03-23 01:11:20 +09:00
Lorenzo Colitti
3949d6ed96 Expose registerDefaultNetworkCallbackAsUid.
Bug: 165835257
Test: atest FrameworksNetTests
Change-Id: I638ed5cd5273d456919630aba1e22f099df1b36c
2021-03-22 19:50:27 +09:00
Lorenzo Colitti
c3e38ade53 Merge changes I90bf7957,If58524b0 am: 029ba17cb0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1646972

Change-Id: I1c3de9d738a294e9d21314de84384fa89745285d
2021-03-22 10:17:37 +00:00
Lorenzo Colitti
029ba17cb0 Merge changes I90bf7957,If58524b0
* changes:
  Fix privileged apps calling registerDefaultNetworkCallback.
  Test a bug with NETWORK_SETTINGS+registerDefaultNetworkCallback.
2021-03-22 09:43:53 +00:00
Lorenzo Colitti
b199b960c7 Support calling registerDefaultNetworkCallback for another UID.
This is to be used by privileged components (e.g., JobScheduler)
to request callbacks about the state of other UIDs on the system.

Bug: 165835257
Test: new unit test coverage
Change-Id: I29f155710394e58c14fcef488db6271d8d83033a
2021-03-22 17:52:20 +09:00
junyulai
767c9f26de [VCN15] expose addUnwantedCapability and related APIs
Test: m -j doc-comment-check-docs
Bug: 175662146
Merged-In: I3f2e6a99e015f09cc4405f6804eac4ae33e3dcc7
Change-Id: I3f2e6a99e015f09cc4405f6804eac4ae33e3dcc7
  (cherry-picked from ag/13929102)
2021-03-22 16:51:50 +08:00
Chiachang Wang
60450deb67 [automerger skipped] Merge "Revert "Correct the logic in NetworkCapabilitiesTest"" am: 3f603fae13 -s ours
am skip reason: skipped by user chiachangwang

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645005

Change-Id: Ib56fafd17dc88b9ded6cd39501a3bfa4cf5fe1b5
2021-03-22 07:17:25 +00:00
Treehugger Robot
8297bc95a0 [automerger skipped] Merge "Correct the logic in NetworkCapabilitiesTest" am: 58f4cdf3b3 -s ours
am skip reason: skipped by user chiachangwang

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1640144

Change-Id: Ib61e9100ff497a22a900aa13a83027242ddddecb
2021-03-22 06:55:09 +00:00
Chiachang Wang
3f603fae13 Merge "Revert "Correct the logic in NetworkCapabilitiesTest"" 2021-03-22 06:26:33 +00:00
Chiachang Wang
f2b0b41764 Revert "Correct the logic in NetworkCapabilitiesTest"
This reverts commit 628ada1d2d.

Reason for revert: <Merge abnormal in automerger>

Change-Id: I0cdb401f4962050bf24dc9d9871d4ef15cf52629
2021-03-22 06:15:02 +00:00
Lorenzo Colitti
f2514125b6 Store the effective UID in NetworkRequestInfo.
This is necessary for privileged components such as
JobScheduler to file NetworkCallbacks on behalf of other
UIDs.

This CL adds the field to NetworkRequestInfo and updates some
of the matching code, but does not set the field to anything
other than the UID that created the request. Thus, it should
cause no behaviour changes.

Bug: 165835257
Test: refactoring with no change in behaviour, passes existing tests
Change-Id: I21a22ed1b851b8511d36f5202c9eac03e7158d3d
2021-03-22 14:52:38 +09:00
Remi NGUYEN VAN
6a4a9423ef Merge "Remove Preconditions usage in TestNetworkSpecifier" am: afdb6a7347
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1644991

Change-Id: Ifca29ba189f58655b0229467e2d86b0b6426b2d1
2021-03-22 03:32:31 +00:00
Remi NGUYEN VAN
5024171a1f Merge "Revert "Revert "Remove connectivity dependency on Preconditions""" am: aa1d743312
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1635319

Change-Id: I0a933c31e05428526a5c6fb4ef694f7c4cf818bb
2021-03-22 03:29:41 +00:00
Remi NGUYEN VAN
1a7066d0a5 Merge "Add TEST_MAPPING for Connectivity" am: b2fe416e82
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1646851

Change-Id: I829c839620849e3a49be0f2629157f4adb9a1dcb
2021-03-22 03:26:46 +00:00
Treehugger Robot
dea1480c0b Merge "Move trimV4AddrZeros to libs/net" am: 33b1df7ec4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1636022

Change-Id: Ifbad5630a39f8990479a5f20e018a3a499334fe1
2021-03-22 03:23:48 +00:00
Remi NGUYEN VAN
02e5fcf301 Merge "Add SystemMessages protos to Connectivity" am: cf638d345b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1626204

Change-Id: I8648b09a97485dcecac2e5075d605e79a730ec3f
2021-03-22 03:20:45 +00:00
Jayachandran Chinnakkannu
f3f342370a Merge "Swap parameters in QosCallback#registerQosCallback" am: fce4049a1d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1628901

Change-Id: I2c371b6f1dc25f84a389480e46d9d582e9da148b
2021-03-22 03:18:17 +00:00
Treehugger Robot
58f4cdf3b3 Merge "Correct the logic in NetworkCapabilitiesTest" 2021-03-22 02:20:19 +00:00
Remi NGUYEN VAN
afdb6a7347 Merge "Remove Preconditions usage in TestNetworkSpecifier" 2021-03-22 01:40:44 +00:00
Remi NGUYEN VAN
aa1d743312 Merge "Revert "Revert "Remove connectivity dependency on Preconditions""" 2021-03-22 01:40:28 +00:00
Remi NGUYEN VAN
b2fe416e82 Merge "Add TEST_MAPPING for Connectivity" 2021-03-22 01:39:51 +00:00
Treehugger Robot
33b1df7ec4 Merge "Move trimV4AddrZeros to libs/net" 2021-03-22 01:37:06 +00:00
Remi NGUYEN VAN
508d3cf1d6 Remove Preconditions usage in TestNetworkSpecifier
Preconditions is a hidden API utility. It can be easily replace by
inline checks.

Bug: 177046265
Test: m
Change-Id: I3f722075fb9c74e12e40348ba4faad2f0fa67178
Merged-In: I3f722075fb9c74e12e40348ba4faad2f0fa67178
2021-03-22 00:02:10 +00:00
Remi NGUYEN VAN
acd6de1364 Revert "Revert "Remove connectivity dependency on Preconditions""
Preconditions.checkNotNull is deprecated to be replaced by
Objects.requireNonNull, and other methods can easily be replaced by
inline checks.

Preconditions is an internal API class that should not be used by
unbundled jars.

Bug: 177046265
Change-Id: I3a67d266b32142c034520acbcdc30f7213db5e13
Merged-In: I3a67d266b32142c034520acbcdc30f7213db5e13
Test: m
2021-03-22 00:01:43 +00:00
Remi NGUYEN VAN
cf638d345b Merge "Add SystemMessages protos to Connectivity" 2021-03-21 23:58:00 +00:00
Jayachandran Chinnakkannu
fce4049a1d Merge "Swap parameters in QosCallback#registerQosCallback" 2021-03-21 21:02:36 +00:00
Roshan Pius
39ff19da2f resolve merge conflicts of d2c4f1d6c8 to stage-aosp-master
Merged-In: Ib9d7923104ac0a60f6af5a3a2d2b7f13bc0262e3
Change-Id: Ib9d7923104ac0a60f6af5a3a2d2b7f13bc0262e3
2021-03-21 19:20:35 +00:00
Lorenzo Colitti
c62368fd7a Fix privileged apps calling registerDefaultNetworkCallback.
When registerDefaultNetworkCallback is called by an app that has
NETWORK_SETTINGS, the UID of the app is forgotten and the request
that is filed has an empty UID set. This results in that request
matching networks that have UID ranges that do not include it,
e.g., VPNs.

Fix this by ensuring that the UID ranges are properly set.

Bug: 165835257
Test: updated specific tests for this bug
Change-Id: I90bf79573342c144d1cfbc2f61a3155fdd5b1fa7
2021-03-22 02:29:29 +09:00
Lorenzo Colitti
053b2a2737 Test a bug with NETWORK_SETTINGS+registerDefaultNetworkCallback.
Currently, if a process with NETWORK_SETTINGS registers a default
network callback, its uid will be ignored and replaced with an
empty list of UIDs. This means it will incorrectly match VPNs
with any UID range.

Add a test for this bug to make it easier to review the upcoming
change that fixes it.

Bug: 165835257
Test: test-only change
Change-Id: If58524b01fdd60045fb7236d17dedf31fb563f99
2021-03-22 02:29:29 +09:00
Chiachang Wang
9991401b9d [automerger skipped] Revert "Revert "Expose uids related APIs in NetworkRequest and N..." am: 8d81c8d76b -s ours
am skip reason: skip tag Change-Id I107c329d4d7130d488772166eae8b5e7aaa2ff04 with SHA-1 f379ceec8e is already in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1646848

Change-Id: I1773af223afb67d522cc05d3658608505340023e
2021-03-21 16:55:29 +00:00
Lorenzo Colitti
dd37a5d576 Merge changes from topic "backport-connectivityresources" am: a31a7b1bf4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645297

Change-Id: Id6e8f89870b70332212e9052168e6f7c2faa3ee3
2021-03-21 16:51:02 +00:00
Lorenzo Colitti
eb0dc8f775 Cherry-pick some test changes from ag/13210542. am: e7963a1d82
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645000

Change-Id: Iebfee24a963aac516bf44ef70128ffdaeec25a45
2021-03-21 16:48:06 +00:00
Remi NGUYEN VAN
00b56b8d0d Add connectivity protos to framework-connectivity am: 953819d7f0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1635040

Change-Id: Idebb84324407d0ce2f0066888b14fc22df736515
2021-03-21 16:45:11 +00:00
paulhu
143739703d Remove unused NetworkPolicyManagerInternal in CS am: c850635440
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1646969

Change-Id: I5a838b1017d1648e67576bfd7940ea9161b2c764
2021-03-21 16:43:40 +00:00
Remi NGUYEN VAN
e6fe8b4103 Move connectivity AIDLs to android.net am: 6ed4472b63
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1596272

Change-Id: If61c15ea55ec2081eab7fd2368e77f16ef51c769
2021-03-21 16:41:38 +00:00
Treehugger Robot
d2c4f1d6c8 Merge changes from topics "revert-1645768-revert-1626206-replaceUidRange-MSYTKFNGUE-HIUTVTIGIR", "ti_redaction"
* changes:
  TransportInfo: Add a generic redaction mechanism
  Revert "Revert "Expose uids related APIs in NetworkRequest and N..."
  Revert^2 "Replace the usage of UidRange"
2021-03-21 16:41:13 +00:00
Remi NGUYEN VAN
1f00de9e81 Migrate framework-connectivity internal resources am: 8e12782094
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1641905

Change-Id: I21a5632d566b2ef883c48f60b420fb76d04a3e05
2021-03-21 16:38:40 +00:00
Remi NGUYEN VAN
6f3429172b Add multipath preference, background status API am: 0f91b7a19a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1644388

Change-Id: I4c1a53223c4cce7759b2cc3efb74a6568abcde57
2021-03-21 16:37:02 +00:00
Lorenzo Colitti
a31a7b1bf4 Merge changes from topic "backport-connectivityresources"
* changes:
  Use module resources in NetworkNotificationManager.
  Cherry-pick some test changes from ag/13210542.
  Add connectivity protos to framework-connectivity
  Remove unused NetworkPolicyManagerInternal in CS
  Move connectivity AIDLs to android.net
  Migrate framework-connectivity internal resources
  Expose isUidNetworkingBlocked and isUidRestrictedOnMeteredNetworks
  Add multipath preference, background status API
2021-03-21 15:47:28 +00:00