Commit Graph

222 Commits

Author SHA1 Message Date
Chalard Jean
1cda30b0a2 Merge "[NS01] Add NetworkScore" am: 98de10a7a1 am: 18294fcbb3 am: a73e64726f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556099

Change-Id: I953a773f8914152578a98d71b43d0a2e30a51aba
2021-03-17 16:04:22 +00:00
Remi NGUYEN VAN
5a66dd85b2 Merge "Add ParseException constructors to API" am: ef7b38b334 am: 2299e83d12 am: 40078d1567
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1635044

Change-Id: I4e4b1f4a70fcfaa43fa9b612e7fbd151093fd8fe
2021-03-17 16:03:23 +00:00
Lucas Lin
576f7c849f Merge "Change the parameter type from ContentResolver to Context" into sc-dev 2021-03-17 03:27:28 +00:00
lucaslin
acd3ded007 Change the parameter type from ContentResolver to Context
Context is more useful than ContentResolver, it can provide more
information if we want to change the behavior in the future.

Bug: 172183305
Test: atest FrameworksNetTests
Change-Id: I5702c7d74b862a76558b94f1abe2c6df9eb7f097
2021-03-16 17:25:28 +08:00
Chalard Jean
98de10a7a1 Merge "[NS01] Add NetworkScore" 2021-03-16 06:36:07 +00:00
Remi NGUYEN VAN
ef7b38b334 Merge "Add ParseException constructors to API" 2021-03-16 06:25:16 +00:00
Aaron Huang
3519718a56 Merge changes from topic "pacproxy-service" am: 267bebc6a9 am: de062690cc am: 2b89f2ae7f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553959

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If6d34753e8bf9201e16121b8f3c6c83aa6358986
2021-03-15 12:56:09 +00:00
Aaron Huang
267bebc6a9 Merge changes from topic "pacproxy-service"
* changes:
  Make PacProxyService be a system service
  Revert^2 "Refactor setCurrentProxyScriptUrl to a void method"
2021-03-15 11:49:45 +00:00
Chalard Jean
dd75352682 [NS01] Add NetworkScore
As attested by numerous TODOs in the code, a new way of
representing network quality and policy is needed instead
of an int.

An int representing the quality of the network requires
all parties using it to know how all other parties are
using it, and implementation details about the decision
algorithm. For all intents and purposes, the selection
is left to individual network factories who try to
achieve a desired result while piecing together all
possible states of the system.

As the number of such cases and desires increases, this
becomes both intractable and unmaintainable. Indeed, at
this time in the codebase nobody can really predict exactly
how a given change in score will affect selection across
the board, and it is essentially impossible to figure out
the behavior of network selection by inspecting the code
because the moving parts are scattered throughout the
entire codebase.

Having an object encapsulating policy and quality values
will let us centralize the selection and make it again
possible to maintain without knowledge of all behaviors
of all network factories. It will also provide better
guarantees of respecting policy, and allow bugfixes that
were not possible before because they'd touch too many
parts of the code.

Test: FrameworksNetTests FrameworksWifiTests NetworkStackTests
Change-Id: I3185a6412b9b659798faf0c6882699e9c63cc115
2021-03-15 09:49:47 +00:00
Remi NGUYEN VAN
5b5607e0cd Merge "Revert "Remove connectivity dependency on Preconditions"" am: c407499db5 am: 46adcba662 am: d38a017b28
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1635220

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I04b48a4afef8d62d1368f5c7f7d907cb5e12c82e
2021-03-15 08:26:55 +00:00
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
Remi NGUYEN VAN
c407499db5 Merge "Revert "Remove connectivity dependency on Preconditions"" 2021-03-15 07:30:20 +00:00
Remi NGUYEN VAN
00c531f4e0 Revert "Remove connectivity dependency on Preconditions"
This reverts commit 1c17c88002.

Reason for revert: Build broken: b/182721112

Change-Id: Ibc84ec6d7900fdcf0bc14cd7036f9c08287711db
2021-03-15 07:27:44 +00:00
Paul Hu
67503fefc6 Merge "Replace InetAddress#parseNumericAddress" 2021-03-15 07:03:46 +00:00
Aaron Huang
b2ad4a95ba Make PacProxyService be a system service
PacProxyInstaller class is running a thread all the time and is
listening to intent ACTION_PAC_REFRESH so it would be better to
make it be a system service with a manager class PacProxyManager
which is obtained with getSystemService(PacProxyManager.class).
Besides, rename PacProxyInstaller to PacProxyService will
be easier to know it's the service for PacProxyManager.

ConnectivityService is going to be a mainline module and it
needs constructor of PacProxyService to be SystemApi.
However, in current design, it needs to pass a handler and
an int arguments to the constructor which would be difficult
to maintain if just expose the constructor directly.

So, define a listener for the event that the current PAC
proxy has been installed so that the handler and the int
arguments can be removed from the constructor.

Bug: 177035719
Test: FrameworksNetTests
Change-Id: I2abff75ec59a17628ef006aad348c53fadbed076
2021-03-15 14:40:58 +08: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
Remi NGUYEN VAN
91efc0fa86 Add ParseException constructors to API
ParseException constructors are used by both platform and mainline
module code, so they can't be package-private.
Removing dependencies on either side is not possible as the class
itself is part of the public API, and supports APIs on both sides.

Having the constructors part of the API makes the class usable by both
sides.

Fixes: 182705505
Test: CtsNetTestCases for APIs using the exception
Change-Id: Ia396ab2fa3afaed3cf474c8e60f72fc7f3f4fded
2021-03-15 10:26:02 +09: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