Commit graph android_packages_modules_Co.../framework/src/android/net/ConnectivityManager.java
Message SHA1
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

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-03-26 05:27:47 +00:00
92aa222f02
Merge changes from topic "ns05" into sc-dev
* changes:
  [NS06] Implement the don't-reap mechanism
  [NS05] Feed network offer callbacks

Chalard Jean   authored and   Android (Google) Code Review   commited 2021-03-26 05:07:39 +00:00
1a0debaab0
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

Lorenzo Colitti   commited 2021-03-26 02:37:19 +09:00
8ad5812ebc
Add PRIVATE_DNS_MODE setting setter
Bug: 182538166
Test: atest FrameworksNetTests
Merged-In: If234426f041606c4881de1eca31b6f5bdb3c6bfe
Change-Id: Iaa9e6cc92f1805ab341c308fc60e947ec4c674f0

paulhu   authored and   Lorenzo Colitti   commited 2021-03-26 02:37:16 +09:00
6865eb6dda
Merge "Add PRIVATE_DNS_MODE setting setter" into sc-dev
Paul Hu   authored and   Android (Google) Code Review   commited 2021-03-25 13:59:18 +00:00
fe704c3d7e
[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

Chalard Jean   commited 2021-03-25 22:13:10 +09:00
428b913abd
Add PRIVATE_DNS_MODE setting setter
Bug: 182538166
Test: atest FrameworksNetTests
Change-Id: If234426f041606c4881de1eca31b6f5bdb3c6bfe

paulhu   authored and   Paul Hu   commited 2021-03-25 13:11:54 +00:00
d559441862
Merge "Expose some APIs from ConnectivityManager"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-03-25 11:29:08 +00:00
8e4ae68ddd
Merge "[NS04.8] Address comments from NS04 and NS04.5" into sc-dev
Chalard Jean   authored and   Android (Google) Code Review   commited 2021-03-25 09:34:05 +00:00
59e0788b7d
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)

lucaslin   authored and   Lucas Lin   commited 2021-03-25 08:07:53 +00:00
29278eef92
[NS04.8] Address comments from NS04 and NS04.5
Bug: 167544279
Test: ConnectivityServiceTest
Change-Id: Ia930b3d3e723075cb47e267d589c576ee2d4490f

Chalard Jean   commited 2021-03-25 13:35:56 +09:00
61e231fa4b
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

Sudheer Shanka   authored and   Lorenzo Colitti   commited 2021-03-25 01:33:26 +09:00
f1520bb8dc
Merge "Move BLOCKED_REASON_* constants from NPMS into ConnectivityManager." into sc-dev
TreeHugger Robot   authored and   Android (Google) Code Review   commited 2021-03-24 16:02:56 +00:00
eb04adf4bc
Merge changes I975a9439,Idec1fe8e into sc-dev
* changes:
  [NS04.5] Have NetworkOffer embark a provider ID
  [NS04] Introduce Network Offers and their callbacks

Chalard Jean   authored and   Android (Google) Code Review   commited 2021-03-24 06:45:50 +00:00
4f591c3910
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

Sudheer Shanka   commited 2021-03-23 15:26:29 -07:00
1d0d9b4627
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

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-03-23 14:01:19 +00:00
f7cf543a86
[NS04.5] Have NetworkOffer embark a provider ID
...instead of a Messenger.
This will be useful later to compare whether a given offer is
offered by the same provider satisfying a request.

Bug: 167544279
Test: ConnectivityServiceTest
Change-Id: I975a9439021c7fa511c50ac982819b6dd146291e

Chalard Jean   commited 2021-03-23 21:41:11 +09:00
148dcce559
[NS04] Introduce Network Offers and their callbacks
This patch introduces the concept of a network offer that
providers send to Connectivity to register for relevant
requests. This lets them see only requests that they can
hope to satisfy considering their capabilities and score
filters.

This is meant to replace the filtering mechanism currently
implemented by NetworkFactory. The reason for replacing
this mechanism is that the old mechanism does caps and
score filtering on the factory side, which requires these
two filters to be contextless and available system-wide,
including in separate processes from the system server.
These constraints severely limit and complexify in
particular what the score comparisons may look like. In
the past the score comparison was only integer-based,
making the code duplication not much of a problem, but as
this scheme is becoming unsustainable by spreading the
complexity of the selection across the entire stack, a
centralized mechanism is now necessary.

This patch only introduces the new objects and has CS
keep track of them, but does not actually use them yet.
Followup patches will implement the logic of calling
the offer callbacks.

Test: FrameworksNetTests NetworkStackTests FrameworksWifiTests
Bug: 167544279
Change-Id: Idec1fe8eb4ac6f562bf098e3dd470f11024d04f2

Chalard Jean   commited 2021-03-23 21:41:11 +09:00
d1b498b16d
[JS01]Remove hidden API usage of Connectivity Sevice
The Connectivity service will become the mainline module.
Therefore, remove the caller of using Connectivity's
hidden API outside the module and expose the required
connectivity API used in Jobscheduler.

Bug: 183456204
CTS-Coverage-Bug: 170598012
Test: atest JobStoreTest
Change-Id: Ie6bc81ff382fb242b98f35d28a96defc207c7987

lifr   commited 2021-03-23 13:58:48 +08:00
308bcccd2b
Merge changes I638ed5cd,I29f15571,I21a22ed1
* changes:
  Expose registerDefaultNetworkCallbackAsUid.
  Support calling registerDefaultNetworkCallback for another UID.
  Store the effective UID in NetworkRequestInfo.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-03-23 01:27:58 +00:00
750e8ca69e
Merge "Swap parameters in QosCallback#registerQosCallback" am: dcc2fb2a19 am: 507df2663e am: 2e744846a0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1628901

Change-Id: Ice84bb2e6d855ed88e7e432cf49739e69c9e01de

Jayachandran Chinnakkannu   authored and   Automerger Merge Worker   commited 2021-03-22 12:30:40 +00:00
687d2a3118
Expose registerDefaultNetworkCallbackAsUid.
Bug: 165835257
Test: atest FrameworksNetTests
Change-Id: I638ed5cd5273d456919630aba1e22f099df1b36c

Lorenzo Colitti   commited 2021-03-22 19:50:27 +09:00
b90bdbdbf4
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

Lorenzo Colitti   commited 2021-03-22 17:52:20 +09:00
5f26b19afd
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

lucaslin   commited 2021-03-22 11:51:27 +08:00
97fb10a3a6
Merge "Revert "Revert "Remove connectivity dependency on Preconditions"""
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-22 01:40:28 +00:00
ed231fdfeb
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

Remi NGUYEN VAN   commited 2021-03-22 00:01:43 +00:00
28028e5066
Merge "Swap parameters in QosCallback#registerQosCallback"
Jayachandran Chinnakkannu   authored and   Gerrit Code Review   commited 2021-03-21 21:02:36 +00:00
dcc2fb2a19
Move connectivity AIDLs to android.net
java_sdk_libraries and apexes need to contain bootclasspath classes
under predefined packages. Tethering currently uses android.net, so make
sure all the connectivity bootclasspath classes are under android.net.

This avoids maintaining two packages for the tethering APEX, where
com.android.connectivity.aidl is only used by internal AIDL files.

Bug: 182984842
Test: m
Change-Id: I611f1941698c574e37aea912ee76dadc8b32e41a
Merged-In: I611f1941698c574e37aea912ee76dadc8b32e41a

Remi NGUYEN VAN   authored and   Lorenzo Colitti   commited 2021-03-20 22:51:35 +09:00
43dea2835e
Add multipath preference, background status API
Add APIs for getMultipathPreference and getRestrictBackgroundStatus.
Both are used by Connectivity to back the external
ConnectivityManager.getRestrictBackgroundStatus, and
ConnectivityManager.getMultipathPreference APIs.

Test: atest CtsNetTestCases
      atest ConnectivityServiceTests
      atest NetworkPolicyManagerServiceTest
Bug: 176289731
Change-Id: I8a03162b2f6691086bb64e75ffd354cdfca7f86a
Merged-In: I8a03162b2f6691086bb64e75ffd354cdfca7f86a

Remi NGUYEN VAN   authored and   Lorenzo Colitti   commited 2021-03-20 22:23:16 +09:00
e62e7ff645
Merge "Add startCaptivePortalApp to system API" am: 1756295fc5 am: c5472a3cf7 am: 8020cb4517
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1639899

Change-Id: Ia3be29892f62b82d23a165bc8334a083c674aefb

Chiachang Wang   authored and   Automerger Merge Worker   commited 2021-03-19 13:09:03 +00:00
abe928e7eb
Merge "Add startCaptivePortalApp to system API"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-03-19 11:30:20 +00:00
1756295fc5
Merge "Move connectivity AIDLs to android.net" into sc-dev
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2021-03-19 10:51:22 +00:00
db597e7819
Merge "Expose constants of ConnectivityManager" into sc-dev
Chiachang Wang   authored and   Android (Google) Code Review   commited 2021-03-19 10:40:49 +00:00
473b69519b
Move connectivity AIDLs to android.net
java_sdk_libraries and apexes need to contain bootclasspath classes
under predefined packages. Tethering currently uses android.net, so make
sure all the connectivity bootclasspath classes are under android.net.

This avoids maintaining two packages for the tethering APEX, where
com.android.connectivity.aidl is only used by internal AIDL files.

Bug: 182984842
Test: m
Change-Id: I611f1941698c574e37aea912ee76dadc8b32e41a

Remi NGUYEN VAN   commited 2021-03-19 07:44:21 +00:00
60ad218d72
Merge "Revert "Revert "Remove connectivity dependency on Preconditions""" into sc-dev
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2021-03-19 04:49:06 +00:00
6b40be797e
Merge "Add InetAddressCompat" am: 871321f41b am: 2c311c8b74 am: 0afced9423
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645289

Change-Id: I90dba64e96080cbd29f538de6dcb514dea4b6cbd

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-03-19 02:52:58 +00:00
7e0ffd0ec4
Expose constants of ConnectivityManager
The callers cannot call the hidden APIs after ConnectivityManager
became a part of mainline module, so expose them for callers.
Also change the value of ACTION_PROMPT_PARTIAL_CONNECTIVITY,
ACTION_PROMPT_LOST_VALIDATION and ACTION_PROMPT_UNVALIDATED because
of API lint errors.

Bug: 172183305
Test: Check private DNS settings is normal, and test NO_INTERNET
      notification can be shown normally.
Change-Id: I715c766ad8e5eb54f4dc67239c1dbca7239506fc

lucaslin   authored and   Chiachang Wang   commited 2021-03-19 10:51:36 +08:00
cf6d450eb8
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
Test: m

Remi NGUYEN VAN   commited 2021-03-19 00:35:27 +00:00
1818dbb99a
Merge "Add InetAddressCompat"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-18 23:58:16 +00:00
871321f41b
Merge "Expose systemReady for SystemServer" am: 56564e061c am: d77b8f6384 am: a71f7d4697
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1640142

Change-Id: I95488b39a32ed9086839eab6c457ed6f75472df1

Lucas Lin   authored and   Automerger Merge Worker   commited 2021-03-18 18:27:08 +00:00
7d528eeee3
Merge "Expose APIs for Settings" am: e584943ca1 am: 65ec6feca0 am: 9ecd16980c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1644202

Change-Id: I13a56aa7dcc19efef3dc268fabfa52069360eb18

Chiachang Wang   authored and   Automerger Merge Worker   commited 2021-03-18 18:26:16 +00:00
c93ae1c2a9
Merge "Move constants to MODULE_LIB" am: 8c288603d1 am: 9759496ca0 am: 42e932bc2e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1640141

Change-Id: I514f5a3d1a4b1498f58170ac652ede394ddf6aeb

Chalard Jean   authored and   Automerger Merge Worker   commited 2021-03-18 18:24:57 +00:00
3303b63519
Add InetAddressCompat
Although the InetAddress symbols used by Connectivity are stable core
platform API, and should be usable, the core_current stubs are not yet
part of the module_current API.
Until that is fixed, add an InetAddressCompat utility that calls the
three static methods by reflection.

Test: atest FrameworksNetTests CtsNetTestCases
Bug: 183097033
Change-Id: I797009aeff1d39ae2dc06ef69d2e235689b43c89

Remi NGUYEN VAN   commited 2021-03-18 23:54:04 +09:00
342ddddd9d
resolve merge conflicts of c85aeee86ec35f9e942e02e7d13450dce47b1325 to sc-dev
Bug: 182538166
Test: atest FrameworksNetTests
Change-Id: Idd5d75e0e9a7ad4f840b88da55d28fbaa2275dd0

Paul Hu   commited 2021-03-18 14:50:05 +00:00
4e8bb42a55
Add startCaptivePortalApp to system API
The API is already used by settings and should be usable by setup
wizards. It is the only way for a caller outside of the system_server to
trigger the captive portal application.

The API is already CTS tested in android.net.cts.CaptivePortalTest.

Fixes: 182871577
Test: atest CtsNetTestCases:android.net.cts.CaptivePortalTest
Change-Id: Ie8d9a546b54524ba837715baa94a07d1f993d8d3

Remi NGUYEN VAN   authored and   Chiachang Wang   commited 2021-03-18 22:41:00 +08:00
8238a7665a
Merge "Expose systemReady for SystemServer"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-03-18 13:40:54 +00:00
56564e061c
Merge "Expose APIs for Settings"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-03-18 13:27:47 +00:00
e584943ca1
Merge "Move constants to MODULE_LIB"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-03-18 12:29:38 +00:00
8c288603d1
Merge "Add more connectivity module settings"
Paul Hu   authored and   Gerrit Code Review   commited 2021-03-18 12:22:55 +00:00
b998511728
Add multipath preference, background status API
Add APIs for getMultipathPreference and getRestrictBackgroundStatus.
Both are used by Connectivity to back the external
ConnectivityManager.getRestrictBackgroundStatus, and
ConnectivityManager.getMultipathPreference APIs.

Test: atest CtsNetTestCases
      atest ConnectivityServiceTests
      atest NetworkPolicyManagerServiceTest
Bug: 176289731
Change-Id: I8a03162b2f6691086bb64e75ffd354cdfca7f86a

Remi NGUYEN VAN   commited 2021-03-18 06:08:00 +00:00
1fdeb50d9a