Commit Graph

208 Commits

Author SHA1 Message Date
Paul Hu
ffd7c1f14f Merge "Replace InetAddress#parseNumericAddress" am: 67503fefc6 am: 23be8da17e am: 174ffe652c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1614980

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia6f19204d54688ea6af69d503c6dae441ff7afce
2021-03-15 08:26:28 +00:00
Remi NGUYEN VAN
d92103dfc0 Merge "Remove connectivity dependency on Preconditions" am: 83c34e272a am: b8c6c46986 am: 3ddc646220
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1628399

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia618516b1cd0096b9550dea38703bde3692915cf
2021-03-15 08:25:36 +00:00
Paul Hu
67503fefc6 Merge "Replace InetAddress#parseNumericAddress" 2021-03-15 07:03:46 +00:00
Remi NGUYEN VAN
83c34e272a Merge "Remove connectivity dependency on Preconditions" 2021-03-15 06:36:15 +00:00
Remi NGUYEN VAN
b9db8b9905 Merge "Remove VpnType usage in VpnTransportInfo" am: e7ea40527a am: b13973838a am: 231fb3a246
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1629273

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia2c66e0c97bc383237782f6116398b225c26e3ea
2021-03-15 03:30:53 +00:00
Remi NGUYEN VAN
e7ea40527a Merge "Remove VpnType usage in VpnTransportInfo" 2021-03-15 01:52:30 +00:00
Lucas Lin
2b2b0bf888 Merge "Have a new API to get private DNS mode" into sc-dev 2021-03-15 01:00:25 +00:00
paulhu
cbe7381c31 Replace InetAddress#parseNumericAddress
-Connectivity is becoming a mainline module in S but mainline
modules are not allowed to use non-formal APIs. Thus, replace
non-formal API InetAddress#parseNumericAddress to
InetAddresses#parseNumericAddress.
- Add deprecated method legacyParseIpAndMask() for IpPrefix and
LinkAddress. Because InetAddresses#parseNumericAddress has
a little different behavior in some case, but these two classes
should keep working as before. So these two classes will use
the new deprecated method.

Bug: 181756157
Test: FrameworksNetTests
Change-Id: I1c96b75f0b8d5e93304a39b4a8c8849964e5e810
2021-03-12 19:57:40 +08:00
Remi NGUYEN VAN
5c5f406981 Merge "Remove usage of hidden InetSocketAddress constructor" am: 7e8db8aed8 am: b392e8ffa6 am: c3a9529c58
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1625901

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia8b76d3c6e18c2c38d86c5c4bd5a75b6a02437a4
2021-03-12 10:45:30 +00:00
Treehugger Robot
f03eb19a41 Merge "Remove hidden @NetworkType in NetworkInfo" am: f829e86db8 am: 2e28bfa25b am: a9a58051fd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1628359

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4868ba91efd24c4544dc6ce044e1b76d50c1a611
2021-03-12 10:45:09 +00:00
Treehugger Robot
c73eb96736 Merge "Remove hidden INVALID_RESOURCE_ID in unused param" am: 31558edb8e am: 3fef231b42 am: 570a192f35
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1628299

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibfe6a57de8deb33fc4a63acdf0ea264d5e506883
2021-03-12 10:44:34 +00:00
Treehugger Robot
589d936fa8 Merge "Use ParcelDescriptor.fromSocket instead of getFileDescriptor" am: 0a30c831a4 am: 43b1fa710e am: 3327d66cc8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1625439

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I446cca57e6841c923ea89ce8f8eddfd1b8e60b79
2021-03-12 10:43:59 +00:00
Remi NGUYEN VAN
16f7830964 Remove VpnType usage in VpnTransportInfo
The VpnType annotation is a hidden symbol, and should be
kept hidden as annotations are disallowed by API guidelines.

Remove its usage in VpnTransportInfo as users of annotated constants
that build against API stubs are expected not to use the annotation.

Bug: 173331190
Test: m
Change-Id: I171fa57f6279defad081c3cd16265d58ec55e57d
2021-03-12 18:30:30 +09:00
Junyu Lai
1931a31772 Merge changes from topics "vcn04", "vcn12" am: d219f4807c am: 10af6fb500 am: ed8aca675d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1628400

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3db655c53a855fe418ba5c6fd8230622805966d5
2021-03-12 09:07:00 +00:00
Remi NGUYEN VAN
7e8db8aed8 Merge "Remove usage of hidden InetSocketAddress constructor" 2021-03-12 09:02:15 +00:00
Treehugger Robot
f829e86db8 Merge "Remove hidden @NetworkType in NetworkInfo" 2021-03-12 08:59:35 +00:00
Treehugger Robot
31558edb8e Merge "Remove hidden INVALID_RESOURCE_ID in unused param" 2021-03-12 08:57:55 +00:00
Treehugger Robot
0a30c831a4 Merge "Use ParcelDescriptor.fromSocket instead of getFileDescriptor" 2021-03-12 08:57:47 +00:00
lucaslin
50205afdd8 Have a new API to get private DNS mode
- Expose PRIVATE_DNS_MODE_OFF, PRIVATE_DNS_MODE_OPPORTUNISTIC and
PRIVATE_DNS_MODE_PROVIDER_HOSTNAME for external users.
- Since PRIVATE_DNS_DEFAULT_MODE_FALLBACK might be changed from
release to release, so it cannot be exposed as a system API.
Remove PRIVATE_DNS_DEFAULT_MODE_FALLBACK and have a new API -
getPrivateDnsMode() for users to get the private DNS mode instead.

Bug: 172183305
Test: atest FrameworksNetTests CtsNetTestCases
Test: atest com.android.cts.devicepolicy.DeviceOwnerTest#testPrivateDnsPolicy
Change-Id: I02a1e91b4eafb5f5df3eada1c07b99849a050c3c
2021-03-12 16:11:27 +08:00
Junyu Lai
d219f4807c Merge changes from topics "vcn04", "vcn12"
* changes:
  [VCN12] Expose setSubIds/getSubIds APIs
  [VCN04] Add Subscription Id set into NetworkCapabilities
2021-03-12 07:12:59 +00:00
Roshan Pius
99cac41819 Merge "ConnectivityManager: Provide API's to include location sensitive info" am: f72f1d9e28 am: 312bcb6871 am: 6519ca6217
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1595396

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icf60935623b62e29cb2ba52b4de554c7f0d78ef1
2021-03-12 07:12:03 +00:00
Treehugger Robot
ff5480575e Merge "Remove Slog usage in NetworkState" am: 437ee783c4 am: 15516e3f0b am: fc8d0f981f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1628360

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0345579ab38ffd06dc548d7c268f1e2dff2c7b9d
2021-03-12 06:13:59 +00:00
Remi NGUYEN VAN
6ce9aa2d49 Merge "Move ParseException to Connectivity" am: eae251b42a am: 160a29cad8 am: 6a30b70575
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1626205

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iba0c91e109d04be28dca01c1997e74c06f12f60f
2021-03-12 06:13:12 +00:00
Roshan Pius
f72f1d9e28 Merge "ConnectivityManager: Provide API's to include location sensitive info" 2021-03-12 05:56:29 +00:00
Treehugger Robot
437ee783c4 Merge "Remove Slog usage in NetworkState" 2021-03-12 05:12:26 +00:00
Lucas Lin
3f6f8215c3 Merge changes Ib80f814f,Ic605e489 am: 3bde652e41 am: 3912538c41 am: 9038eeece3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1626209

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I47862eeec4f74a0901b8b866dd6ffa906bd9e62f
2021-03-12 04:58:40 +00:00
Remi NGUYEN VAN
eae251b42a Merge "Move ParseException to Connectivity" 2021-03-12 04:27:55 +00:00
Lucas Lin
3bde652e41 Merge changes Ib80f814f,Ic605e489
* changes:
  Use new API - getIpSecNetIdRange() in IpSecService
  Add a new API to get the network ID range of IPSec tunnel interface
2021-03-12 03:30:32 +00:00
Roshan Pius
7992afdcc3 ConnectivityManager: Provide API's to include location sensitive info
Existing NetworkCallback users will get NetworkCapabilities with
location sensitive data removed (except for ownerUid which will be
added for existing apps for backwards compatibility). Apps
have to opt-in to receive location sensitive data.

Note: This was chosen because WifiInfo is the only TransportInfo tha
has location sensitive info & that was added only in Android 12. If we
choose to default to true, all existings apps retrieving
NetworkCapabilities for wifi networks will be blamed for location access
unnecessarily.

Changes:
i) Add a flag in NetworkCallback creation to retrieve
NetworkCapabilities with location sensitive info in their callback.
(More flags are being planned for NetworkCallback for throttling
callback frequency, etc)
ii) For NetworkCapabilities.getOwnerUid(), we will continue to send the
data for apps targeting older SDK (since this is an existing field and
the new flag defaults location sensitive data to off).

Bug: 156867433
Test: atest android.net
Test: atest com.android.server
Change-Id: If70b5ea6f5c8885f0c353c8df08a826d55fe7f7a
2021-03-11 18:27:18 -08:00
Treehugger Robot
5237f54a95 Merge changes Iac9487e8,Ifa411c7b am: 999506022f am: 007256389e am: 431f25a9da
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1622675

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If1b3f0447705f910467a52d2504ba1aaef850a80
2021-03-12 00:49:24 +00:00
Remi NGUYEN VAN
92e9f17915 Merge changes from topic "ethernet_specifier"
* changes:
  Fix common tests on Q and R
  Add Ethernet, TestNetworkSpecifier API
2021-03-11 23:51:49 +00:00
lucaslin
1a6095c4cf Add a new API to get the network ID range of IPSec tunnel interface
- Add a new API to get the network ID range of IPSec tunnel
interface.
- Use the new API in IpSecServiceTest to make sure the result is
the same. Follow-up commit will change the logic in
IpSecService#reserveNetId(), the modified test can ensure the
correctness of the new change.

Bug: 172183305
Test: atest FrameworksNetTests:IpSecServiceTest
Change-Id: Ic605e48941fc9d6482cdcd01a8adcdc9b6d586a6
2021-03-12 00:46:33 +08:00
junyulai
26d680973f [VCN12] Expose setSubIds/getSubIds APIs
Test: atest NetworkCapabilitiesTest
Bug: 175662146
Change-Id: Ia4b98bc6c5fcefee44233f3b7fbb6517a0e8870e
2021-03-11 23:03:19 +08:00
junyulai
f3ca0ef14c [VCN04] Add Subscription Id set into NetworkCapabilities
This is a generic way to request networks that has different
subId but belongs to the same carrier. For example, cellular
networks with different SIM card, or carrier Wifi that
provided by the operator.

Test: atest NetworkCapabilitiesTest#testSubIds
Test: m doc-comment-check-docs -j
Test: atest CtsNetTestCases
Bug: 175662146

Change-Id: Ifca766f5acc73c285948d6251ec31506d9bb0bcb
2021-03-11 23:03:05 +08:00
Remi NGUYEN VAN
7f11b46a43 Add Ethernet, TestNetworkSpecifier API
Rename StringNetworkSpecifier to EthernetNetworkSpecifier (its only
production user), and make it module-lib API.
The original StringNetworkSpecifier file is actually kept to satisfy
some invalid dependencies; it will be removed separately.

This allows specifying an Ethernet interface with a non-deprecated API:
until this change the only way to do so would be to use
NetworkRequest#setSpecifier(String), which is deprecated.

Similarly, add the TestNetworkSpecifier API for TestNetworkManager, to
replace previous usage of StringNetworkSpecifier. TestNetworkManager is
module API, so TestNetworkSpecifier should be module API too. This
allows tests to request the test interface specifically, without using
the deprecated NetworkRequest#setSpecifier(String).

Bug: 179329291
Test: m
Merged-In: Iee569f5c8bbdc4bc979610e1191308281f3d4620

Change-Id: Iee569f5c8bbdc4bc979610e1191308281f3d4620
2021-03-11 23:02:02 +08:00
junyulai
f4bc12fe28 [VCN11] Make requestBackgroundNetwork requires handler
Test: atest FrameworksNetTests android.net.cts.ConnectivityManagerTest
Bug: 175662146
Change-Id: Iac9487e8de8bfdd87fc7a0153b228ae2a7ba4e19
2021-03-11 21:05:27 +08:00
junyulai
6b0a6a22a3 [VCN10] Add new API to listen for highest score network
Test: atest ConnectivityServiceTest#testRegisterBestMatchingNetworkCallback
Bug: 175662146
Change-Id: Ifa411c7b53da789c74fff7e1a95f9c9ebf5bd05c
2021-03-11 21:04:06 +08:00
Remi NGUYEN VAN
16e9dd5b4f Remove Slog usage in NetworkState
Slog should not be used in unbundled jars as it is a hidden API; use the
standard Log utility instead.

Bug: 172050541
Test: m
Change-Id: I54b2b99b2aedbb5194e9ec24068d2f2ce46d67fc
2021-03-11 21:01:30 +09:00
Remi NGUYEN VAN
1c17c88002 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
Test: m
Change-Id: If14a75439ff332c927dc4114ae0eecb89f53c6c7
2021-03-11 20:49:13 +09:00
Remi NGUYEN VAN
4c63bb2e86 Remove hidden @NetworkType in NetworkInfo
The NetworkType annotation is a hidden telephony symbol, and should be
kept hidden as annotations are disallowed by API guidelines.

Remove its usage in NetworkInfo as users of annotated constants that
build against API stubs are expected not to use the annotation.

Bug: 182451544
Test: m
Change-Id: I6658c1faa147c527c989b87d67f1af166c488dde
2021-03-11 20:29:10 +09:00
Remi NGUYEN VAN
642d6abe9d Remove hidden INVALID_RESOURCE_ID in unused param
INVALID_RESOURCE_ID is a hidden API so its usage should be avoided.
The current usage is for an unused parameter, so just use a literal instead.

Bug: 182451544
Change-Id: I066d9c34f735434adee4ee72e8a7fe1ceb900c3c
Test: m
2021-03-11 10:57:01 +00:00
Remi NGUYEN VAN
04e1000ef5 Move ParseException to Connectivity
ParseException is a public API class used to support Connectivity APIs,
so it should be in the same API surface as connectivity.

Bug: 181512874
Test: m
Change-Id: Ie1213de0d0facc8f409f7b4c2553abb382e4afbf
2021-03-11 17:19:18 +09:00
Remi NGUYEN VAN
cb49506e77 Remove usage of hidden InetSocketAddress constructor
The constructor is a hidden API, and used in a code path that can
never happen.
Replace it with a thrown exception (which should never be thrown either).

Bug: 170598012
Change-Id: Ie2c671c1a75accb8e94b08de9901d14b72caaf7e
Test: m
2021-03-11 07:43:43 +00:00
Remi NGUYEN VAN
1eebf4f7bd Use ParcelDescriptor.fromSocket instead of getFileDescriptor
Socket.getFileDescriptor$ is a hidden API. Instead, replace it with
ParcelDescriptor.fromSocket, which was created to handle such use-cases.

Bug: 170598012
Change-Id: I9e218e4ec29d2b7fe5d2faeb1c2e1cafc63dc923
Test: m
2021-03-09 23:54:03 +00:00
Remi NGUYEN VAN
579c8c0126 Merge "Add Ethernet, TestNetworkSpecifier API" into sc-dev 2021-03-09 22:43:46 +00:00
Zoey Chen
f619c9967d Merge changes from topic "PSL_TelephonyCallback"
* changes:
  [Telephony] Use TelephonyCallback instead of PhoneStateListener part1
  [PhoneStateListener] Redesign PhoneStateListener: Use TelephonyCallback
2021-03-09 10:36:03 +00:00
Chalard Jean
50403bba41 Merge "Replace withCleanCallingIdentity with [clear|restore]CallingIdentity" am: aaef65de42 am: 3d4e6deeb3 am: 4ad3d649d8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1615182

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2ae6ed673a8c82a7e6326c35c17508d26f2e5236
2021-03-09 08:52:01 +00:00
Remi NGUYEN VAN
6697878c6b Add Ethernet, TestNetworkSpecifier API
Rename StringNetworkSpecifier to EthernetNetworkSpecifier (its only
production user), and make it module-lib API.
The original StringNetworkSpecifier file is actually kept to satisfy
some invalid dependencies; it will be removed separately.

This allows specifying an Ethernet interface with a non-deprecated API:
until this change the only way to do so would be to use
NetworkRequest#setSpecifier(String), which is deprecated.

Similarly, add the TestNetworkSpecifier API for TestNetworkManager, to
replace previous usage of StringNetworkSpecifier. TestNetworkManager is
module API, so TestNetworkSpecifier should be module API too. This
allows tests to request the test interface specifically, without using
the deprecated NetworkRequest#setSpecifier(String).

Bug: 179329291
Test: m
Change-Id: Iee569f5c8bbdc4bc979610e1191308281f3d4620
2021-03-09 07:46:48 +00:00
Chalard Jean
aaef65de42 Merge "Replace withCleanCallingIdentity with [clear|restore]CallingIdentity" 2021-03-09 07:41:13 +00:00
Lucas Lin
cdddf9d0b2 Merge "Use ArraySet#add() instead of ArraySet#append()" am: 627c6a5258 am: ee5644f6b5 am: d4185bab7a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1615181

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic1cbcbb6f9dc83e664593b8e095a0f9b80697b83
2021-03-09 06:34:56 +00:00