Commit graph android_packages_modules_Co.../framework/src/android/net/ConnectivityManager.java
Message SHA1
[VCN20] Change requestBackgroundNetwork argument order
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215095
Merged-In: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
Change-Id: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
  (cherry-picked from ag/14198667)

junyulai   commited 2021-04-16 00:16:21 +08:00
8c8ac36d9a
Merge "Improve documentation on simulateDataStall"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-04-09 00:21:34 +00:00
3b4f0832bd
Improve documentation on simulateDataStall
Explain that:
 - The method does not cause an actual data stall.
 - The detectionMethod parameter refers to
   ConnectivityDiagnosticsManager.DataStallReport constants (which
   already use an IntDef).
 - timestampMillis is relative to SystemClock.elapsedRealtime.

Fixes: 183972768
Test: m
Change-Id: I2eeb79e0e8ec6e8fd3b8fe1dcb1abbf2e6338983

Remi NGUYEN VAN   commited 2021-04-08 16:30:25 +09:00
564f7f8df3
Move ACTION_CLEAR_DNS_CACHE to ConnectivityManager
- As API review feedback, move ACTION_CLEAR_DNS_CACHE form Intent
  to ConnectivityManager.

- Rename to "android.net.action.CLEAR_DNS_CACHE" because of lint
  suggestion.
frameworks/base/packages/Connectivity/framework/src/android/net/
ConnectivityManager.java:449: error: Inconsistent action value;
expected `android.net.action.CLEAR_DNS_CACHE`, was
`android.intent.action.CLEAR_DNS_CACHE` [ActionValue]

Bug: 183937999
Test: atest FrameworksNetTests
Test: atest ActivityTaskManagerServiceTests
Test: atest android.permission2.cts.PermissionPolicyTest
Test: atest CtsNetTestCases
Change-Id: Iae8aa0ba10dfc7581f0cfaab82643edbee789e2f

paulhu   commited 2021-04-07 19:40:47 +08:00
b49c8425b2
Merge "Expose constants of ConnectivityManager"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-04-07 10:11:06 +00:00
cb20318619
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
Merged-In: I715c766ad8e5eb54f4dc67239c1dbca7239506fc

lucaslin   authored and   Chiachang Wang   commited 2021-04-07 09:13:46 +00:00
d89b2980df
Merge "ConnectivityManager: Address review comments from aosp/1595396"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-04-07 00:36:27 +00:00
1515b6c96d
ConnectivityManager: Address review comments from aosp/1595396
Bug: 156867433
Test: atest android.net
Test: atest com.android.server
Change-Id: I7f5d043732ae22edd14bf581b7dc676c9236b545

Roshan Pius   commited 2021-04-06 16:42:51 +00:00
189d009e37
Cleanup setGlobalProxy
This is a small cleanup of a function called by DevicePolicyManager
coming from a conflicting change. This no longer makes a concrete
difference but is still a good change.

Test: m services.devicepolicy
Bug: 172183305
Change-Id: I7ee907314ddb253eb4e97d177f0ea0ab3b58cf03

Chalard Jean   commited 2021-04-02 20:37:21 +09:00
e1ce6ae5d0
Merge "[JS01]Remove hidden API usage of Connectivity Sevice"
Frank Li   authored and   Gerrit Code Review   commited 2021-03-30 07:22:40 +00:00
487698b2b7
[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
Merged-In: Ie6bc81ff382fb242b98f35d28a96defc207c7987
           (cherry-picked from ag/13946348)

lifr   commited 2021-03-30 11:41:50 +08:00
b4dab37e28
Address comments on onBlockedStatusChanged(Network, int) CL.
Test: m
Bug: 165835257
Change-Id: I6d3007a1eac54ee6650b350aee56ed398a2c950d

Lorenzo Colitti   commited 2021-03-29 20:12:09 +09:00
a1bd6f6d51
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 "Expose some APIs from ConnectivityManager"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-03-25 11:29:08 +00:00
8e4ae68ddd
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
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 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
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
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"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-03-19 11:30:20 +00:00
1756295fc5
Merge "Add InetAddressCompat"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-18 23:58:16 +00:00
871321f41b
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
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 more connectivity module settings
Add more connectivity module settings and update all references
to ConnectivitySettingsManager.

Bug: 182538166
Test: atest FrameworksNetTests
Change-Id: Ie96fbd0996ed3acb37099b6270bf3d4c2e558e9a

paulhu   commited 2021-03-18 11:58:29 +08:00
c9925e096b
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

Chiachang Wang   commited 2021-03-18 11:18:56 +08:00
f9294e7cd1
Merge "Remove Protocol.BASE_* usage in Connectivity"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-17 14:53:26 +00:00
5a819fb84d
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

Remi NGUYEN VAN   commited 2021-03-17 20:56:50 +09:00
1b9f03a190
Modify the comment of getPrivateDnsMode
Bug: 172183305
Test: m
Change-Id: I2f1b44cf2a362b42f052ea5d34a5cec03d46e661

lucaslin   commited 2021-03-17 14:53:35 +08:00
debfe6062a
Merge "Change the parameter type from ContentResolver to Context"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-03-17 06:35:21 +00:00
253a041a13
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

lucaslin   commited 2021-03-17 14:16:55 +08:00
10774b7ebc
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

Chalard Jean   commited 2021-03-17 14:59:24 +09:00
bef6b09cd9
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

Chalard Jean   authored and   Gerrit Code Review   commited 2021-03-17 05:48:18 +00:00
24a9b5cad6
[VCN14] Expose registerBestMatchingNetworkCallback
Test: m -j doc-comment-check-docs
Bug: 175662146
Change-Id: Ie67dd2f4f8d973de37bc64a03908d7cbb7c2b7ad

junyulai   commited 2021-03-16 21:30:56 +08:00
bd1230675e
[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

junyulai   commited 2021-03-16 21:30:55 +08:00
7664f62d37
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

Chalard Jean   commited 2021-03-16 12:14:00 +00:00
0a4aefcec2
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

Chalard Jean   commited 2021-03-16 12:13:27 +00:00
ad565e26d9
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

lucaslin   authored and   Lucas Lin   commited 2021-03-16 09:26:57 +00:00
e2cd02d9ab
Merge "Add comments to describe the value of converting hex to decimal"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-03-16 08:31:10 +00:00
3453ec5024
Merge "Have a new API to get private DNS mode"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-03-16 07:39:35 +00:00
b79ae17835
Add comments to describe the value of converting hex to decimal
Bug: 172183305
Test: N/A
Change-Id: Id274295d6c8c97d3014214f875168ff968f79bb6

lucaslin   authored and   Lucas Lin   commited 2021-03-15 09:55:39 +00:00
c296fccca1