Commit Graph

122 Commits

Author SHA1 Message Date
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
Jayachandran Chinnakkannu
687d2a3118 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
2021-03-22 12:30:40 +00:00
lucaslin
97fb10a3a6 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
2021-03-22 11:51:27 +08:00
Jayachandran Chinnakkannu
dcc2fb2a19 Merge "Swap parameters in QosCallback#registerQosCallback" 2021-03-21 21:02:36 +00:00
Remi NGUYEN VAN
43dea2835e 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
2021-03-20 22:51:35 +09:00
Remi NGUYEN VAN
e62e7ff645 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
2021-03-20 22:23:16 +09:00
Chiachang Wang
abe928e7eb 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
2021-03-19 13:09:03 +00:00
Chiachang Wang
1756295fc5 Merge "Add startCaptivePortalApp to system API" 2021-03-19 11:30:20 +00:00
Remi NGUYEN VAN
db597e7819 Merge "Move connectivity AIDLs to android.net" into sc-dev 2021-03-19 10:51:22 +00:00
Chiachang Wang
473b69519b Merge "Expose constants of ConnectivityManager" into sc-dev 2021-03-19 10:40:49 +00:00
Remi NGUYEN VAN
60ad218d72 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
2021-03-19 07:44:21 +00:00
Remi NGUYEN VAN
6b40be797e Merge "Revert "Revert "Remove connectivity dependency on Preconditions""" into sc-dev 2021-03-19 04:49:06 +00:00
Remi NGUYEN VAN
7e0ffd0ec4 Merge "Add InetAddressCompat" am: 871321f41b am: 2c311c8b74 am: 0afced9423
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645289

Change-Id: I90dba64e96080cbd29f538de6dcb514dea4b6cbd
2021-03-19 02:52:58 +00:00
lucaslin
cf6d450eb8 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
2021-03-19 10:51:36 +08:00
Remi NGUYEN VAN
1818dbb99a 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
2021-03-19 00:35:27 +00:00
Remi NGUYEN VAN
871321f41b Merge "Add InetAddressCompat" 2021-03-18 23:58:16 +00:00
Lucas Lin
7d528eeee3 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
2021-03-18 18:27:08 +00:00
Chiachang Wang
c93ae1c2a9 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
2021-03-18 18:26:16 +00:00
Chalard Jean
3303b63519 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
2021-03-18 18:24:57 +00:00
Remi NGUYEN VAN
342ddddd9d 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
2021-03-18 23:54:04 +09:00
Paul Hu
4e8bb42a55 resolve merge conflicts of c85aeee86ec35f9e942e02e7d13450dce47b1325 to sc-dev
Bug: 182538166
Test: atest FrameworksNetTests
Change-Id: Idd5d75e0e9a7ad4f840b88da55d28fbaa2275dd0
2021-03-18 14:50:05 +00:00
Remi NGUYEN VAN
8238a7665a 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
2021-03-18 22:41:00 +08:00
Lucas Lin
56564e061c Merge "Expose systemReady for SystemServer" 2021-03-18 13:40:54 +00:00
Chiachang Wang
e584943ca1 Merge "Expose APIs for Settings" 2021-03-18 13:27:47 +00:00
Chalard Jean
8c288603d1 Merge "Move constants to MODULE_LIB" 2021-03-18 12:29:38 +00:00
Paul Hu
b998511728 Merge "Add more connectivity module settings" 2021-03-18 12:22:55 +00:00
Remi NGUYEN VAN
1fdeb50d9a 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
2021-03-18 06:08:00 +00:00
paulhu
c9925e096b Add more connectivity module settings
Add more connectivity module settings and update all references
to ConnectivitySettingsManager.

Bug: 182538166
Test: atest FrameworksNetTests
Change-Id: Ie96fbd0996ed3acb37099b6270bf3d4c2e558e9a
2021-03-18 11:58:29 +08:00
Chiachang Wang
f9294e7cd1 Expose APIs for Settings
ConnectivityManager will be a part of incoming connectivity
mainline. Settings will no longer to access the hidden methods.
For those methods that accept the interaction from users, they
should be exposed as formal interface to allow the
functionality. Expose them to API surface.

Bug: 172183305
Test: make update-api
Change-Id: Id4533b94291766bb060af0091b5ccb81a00630fd
2021-03-18 11:18:56 +08:00
Remi NGUYEN VAN
c13ff4aff6 Merge "Remove Protocol.BASE_* usage in Connectivity" am: 5a819fb84d am: 41fe4bfcd4 am: b9a3b1b03b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1629266

Change-Id: I0bb7aec183efdeed894447a3b5abc446b9ca46c8
2021-03-17 22:20:59 +00:00
Lucas Lin
3fca5b232f Merge "Modify the comment of getPrivateDnsMode" am: 625db39870 am: bdc4e22fe4 am: afcec9cbfe
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1640143

Change-Id: I60147e1c828e5d82556e58b67b8f138f63228e8f
2021-03-17 22:19:20 +00:00
Chalard Jean
0f15b90f34 Merge changes I335e82e2,I84ba363d,I8f18083b,I854a952d,I00e23441 am: 24a9b5cad6 am: 1f51df82b1 am: 35b284e0ff
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1622621

Change-Id: I5fa8e7b8bf35a5464868fdca4d115b3f9132c65f
2021-03-17 22:13:06 +00:00
Junyu Lai
88ee4f1d03 Merge "[VCN14] Expose registerBestMatchingNetworkCallback" am: 29908cf3c4 am: 96e1290b7a am: 71bc2b560d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1635047

Change-Id: Ic0cb87f3ac4e9df7b0b6e2d0344c43e66499900e
2021-03-17 22:08:56 +00:00
Junyu Lai
b4d8384170 Merge "[VCN13] Implement tracking best matching network" am: f98037abb3 am: 67a2b3eb30 am: 14865c4e07
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1633519

Change-Id: Ie252014cd9047c27fad3e451b80047493935dc3d
2021-03-17 16:08:50 +00:00
Lucas Lin
76c10401b5 Merge "Add comments to describe the value of converting hex to decimal" am: 3453ec5024 am: 3fa2c3e87a am: 172cce09da
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1635221

Change-Id: I0f978fd5fa0283a40db2897478483d680d44e9e9
2021-03-17 16:05:47 +00:00
Chalard Jean
7f2fddf60e Merge "[NS01] Add NetworkScore" am: 2a9450c234 am: c8aa29e41e am: 2d07595731
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
5a819fb84d Merge "Remove Protocol.BASE_* usage in Connectivity" 2021-03-17 14:53:26 +00:00
Remi NGUYEN VAN
1b9f03a190 Remove Protocol.BASE_* usage in Connectivity
ConnectivityManager and NetworkAgent do not share their handler with any
other component, so there is no reason to use addresses that do not
overlap. Protocol.BASE_* was written to allow for interaction "between
different StateMachine implementations without a conflict", but the
classes do not use StateMachine, and they do not have such interactions.

Bug: 177046265
Test: atest FrameworksNetTests
Change-Id: I18c341d4a2c01cb9559d682a9ad1ff259e6b5855
2021-03-17 20:56:50 +09:00
lucaslin
debfe6062a Modify the comment of getPrivateDnsMode
Bug: 172183305
Test: m
Change-Id: I2f1b44cf2a362b42f052ea5d34a5cec03d46e661
2021-03-17 14:53:35 +08:00
Lucas Lin
253a041a13 Merge "Change the parameter type from ContentResolver to Context" 2021-03-17 06:35:21 +00:00
lucaslin
10774b7ebc Expose systemReady for SystemServer
SystemServer cannot call the hidden API of ConnectivityManager
after it becomes a part of mainline module. So expose the hidden
API for SystemServer.

Bug: 182963354
Test: m services
Change-Id: I9c1dc8eb1401dbdc069d5c9fc3992f4c7939b70e
2021-03-17 14:16:55 +08:00
Chalard Jean
bef6b09cd9 Move constants to MODULE_LIB
These constants are used by a MODULE_LIBRARIES API, they should
have the same visibility.

Test: ConnectivityServiceTest
Change-Id: I14cb189d949fe552f463cae3002801fd8cf8230c
2021-03-17 14:59:24 +09:00
Chalard Jean
24a9b5cad6 Merge changes I335e82e2,I84ba363d,I8f18083b,I854a952d,I00e23441
* changes:
  Remove per-user preference when the user is removed
  Expose the enterprise per-profile networking API.
  Implement setNetworkPreferenceForUser.
  Public API for per-profile network preference.
  Add tests for setNetworkPreferenceForUser
2021-03-17 05:48:18 +00:00
junyulai
bd1230675e [VCN14] Expose registerBestMatchingNetworkCallback
Test: m -j doc-comment-check-docs
Bug: 175662146
Change-Id: Ie67dd2f4f8d973de37bc64a03908d7cbb7c2b7ad
2021-03-16 21:30:56 +08:00
junyulai
7664f62d37 [VCN13] Implement tracking best matching network
This is done by:
  1. In requestNetwork, provide a basic permission check.
  2. rematchNetworksAndRequests: no change, since non listen
     requests will be automatically processed to track
     best satisfying network.
  3. applyNetworkReassignment: no change, since non-request
     will not be sent to factories.

Test: atest ConnectivityServiceTest#testRegisterBestMatchingNetworkCallback_noIssueToFactory
Test: atest ConnectivityServiceTest#testRegisterBestMatchingNetworkCallback_trackBestNetwork
Bug: 175662146
Change-Id: I8cf4ab334df6812d84cdda160e9b72b6f54062af
2021-03-16 21:30:55 +08:00
Chalard Jean
0a4aefcec2 Expose the enterprise per-profile networking API.
Also unify the listener for Oem settings, which have
never been released as public API (it is slated to be
released in S).

Test: FrameworksNetTests
Change-Id: I84ba363dd0ec03871c37b1c3a31e5557d9aa12e7
2021-03-16 12:14:00 +00:00
Chalard Jean
ad565e26d9 Public API for per-profile network preference.
This patch defines the API, but does not make it public
yet as there is no implementation yet.

Test: none so far
Change-Id: I854a952dfe35cc80847eb62f522b1667b8e9b8a0
2021-03-16 12:13:27 +00:00
lucaslin
e2cd02d9ab 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
Merged-In: I5702c7d74b862a76558b94f1abe2c6df9eb7f097
2021-03-16 09:26:57 +00:00
lucaslin
2a4c17c3b3 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
Lucas Lin
3453ec5024 Merge "Add comments to describe the value of converting hex to decimal" 2021-03-16 08:31:10 +00:00