Commit graph android_packages_modules_Co.../framework/src/android/net/ConnectivityManager.java
Message SHA1
Merge "Revert "Remove connectivity dependency on Preconditions"" am: 310ef3e954 am: 871f91a517 am: b5437344c6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1635220

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I04b48a4afef8d62d1368f5c7f7d907cb5e12c82e

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-03-15 08:26:55 +00:00
6f8207999e
Merge "Remove connectivity dependency on Preconditions" am: 00e1d9ee70 am: 18925df41b am: 4879735886
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1628399

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia618516b1cd0096b9550dea38703bde3692915cf

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-03-15 08:25:36 +00:00
90efff4cf0
Merge "Revert "Remove connectivity dependency on Preconditions""
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-15 07:30:20 +00:00
310ef3e954
Revert "Remove connectivity dependency on Preconditions"
This reverts commit fa5eacc89f.

Reason for revert: Build broken: b/182721112

Change-Id: Ibc84ec6d7900fdcf0bc14cd7036f9c08287711db

Remi NGUYEN VAN   commited 2021-03-15 07:27:44 +00:00
3f0e7dd4e7
Merge "Remove connectivity dependency on Preconditions"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-15 06:36:15 +00:00
00e1d9ee70
Merge "Have a new API to get private DNS mode" into sc-dev
Lucas Lin   authored and   Android (Google) Code Review   commited 2021-03-15 01:00:25 +00:00
28f6ce21af
Merge "Remove hidden INVALID_RESOURCE_ID in unused param" am: de66768a6c am: 21c40a1905 am: 2e5256b1a2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1628299

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibfe6a57de8deb33fc4a63acdf0ea264d5e506883

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-03-12 10:44:34 +00:00
335d43f06e
Merge "Remove hidden INVALID_RESOURCE_ID in unused param"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-03-12 08:57:55 +00:00
de66768a6c
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

lucaslin   commited 2021-03-12 16:11:27 +08:00
180f44f0f2
Merge "ConnectivityManager: Provide API's to include location sensitive info" am: a03f3bbf0e am: e0e069d4cf am: 0659f32f4d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1595396

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icf60935623b62e29cb2ba52b4de554c7f0d78ef1

Roshan Pius   authored and   Automerger Merge Worker   commited 2021-03-12 07:12:03 +00:00
926fb37c83
Merge "ConnectivityManager: Provide API's to include location sensitive info"
Roshan Pius   authored and   Gerrit Code Review   commited 2021-03-12 05:56:29 +00:00
a03f3bbf0e
Merge changes Ib80f814f,Ic605e489 am: 3ef74f3cab am: ca62593ba7 am: 7b190776ba
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1626209

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I47862eeec4f74a0901b8b866dd6ffa906bd9e62f

Lucas Lin   authored and   Automerger Merge Worker   commited 2021-03-12 04:58:40 +00:00
fecca448ba
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

Lucas Lin   authored and   Gerrit Code Review   commited 2021-03-12 03:30:32 +00:00
3ef74f3cab
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

Roshan Pius   commited 2021-03-11 18:27:18 -08:00
e08bc1803c
Merge changes Iac9487e8,Ifa411c7b am: 999506022f am: de1cef76d7 am: bec7ce5cf4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1622675

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If1b3f0447705f910467a52d2504ba1aaef850a80

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-03-12 00:49:24 +00:00
77f80a6743
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

lucaslin   commited 2021-03-12 00:46:33 +08:00
5cdbcfb7fa
[VCN11] Make requestBackgroundNetwork requires handler
Test: atest FrameworksNetTests android.net.cts.ConnectivityManagerTest
Bug: 175662146
Change-Id: Iac9487e8de8bfdd87fc7a0153b228ae2a7ba4e19

junyulai   commited 2021-03-11 21:05:27 +08:00
dbb7046923
[VCN10] Add new API to listen for highest score network
Test: atest ConnectivityServiceTest#testRegisterBestMatchingNetworkCallback
Bug: 175662146
Change-Id: Ifa411c7b53da789c74fff7e1a95f9c9ebf5bd05c

junyulai   commited 2021-03-11 21:04:06 +08:00
5a5c99b84e
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

Remi NGUYEN VAN   commited 2021-03-11 20:49:13 +09:00
fa5eacc89f
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

Remi NGUYEN VAN   commited 2021-03-11 10:57:01 +00:00
a29be5c0f7
Merge "Replace withCleanCallingIdentity with [clear|restore]CallingIdentity" am: 0f08d2fcb7 am: d5cdace044 am: 614d5de20d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1615182

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2ae6ed673a8c82a7e6326c35c17508d26f2e5236

Chalard Jean   authored and   Automerger Merge Worker   commited 2021-03-09 08:52:01 +00:00
aca49c8844
Merge "Replace withCleanCallingIdentity with [clear|restore]CallingIdentity"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-03-09 07:41:13 +00:00
0f08d2fcb7
Merge "[FUI22] Support getAllNetworkStateSnapshot" am: 4c73e05c1d am: 773a813dc2 am: ee3fc01443
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1614779

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I52f8339bd1cda35a3f26f28fd3c0165f6f6ff91e

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-03-05 07:10:46 +00:00
d175285e54
[FUI22] Support getAllNetworkStateSnapshot
Currently, ConnectivityService has getAllNetworkState but it is
not ideal to expose as system API since the plan is to get rid
of NetworkState. Thus, create a new one that returns
NetworkStateSnapshot to fulfill the needs.

Note the original getAllNetworkState cannot be deleted now since
it has @UnsupportedAppUsage annotation.

Test: atest FrameworksNetTests
Bug: 174123988
Change-Id: Icddd434552b0e9ecbc8299e7242ec88cf3145aca

junyulai   commited 2021-03-04 18:41:09 +08:00
b12113700c
Replace withCleanCallingIdentity with [clear|restore]CallingIdentity
To prevent using @hide method - withCleanCallingIdentity() from
mainline module, use clearCallingIdentity() &
restoreCallingIdentity() instead.

Bug: 172183305
Test: FrameworksNetTests, CtsNetTestCasesLatestSdk
Change-Id: I8221bb8717ba6809c5087ea2808cd4ccef948cfd

lucaslin   commited 2021-03-04 09:38:21 +08:00
eaff72d544
Merge "Implement Settings#checkAndNoteChangeNetworkStateOperation on CS" into sc-dev
Paul Hu   authored and   Android (Google) Code Review   commited 2021-03-02 13:03:13 +00:00
324ccfa064
Merge "Revert "Revert "Delete VPN methods in ConnectivityManager.""" am: 10de86f5e5 am: bdbd425a3b am: ec81e831f6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1597635

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iff8ce4686f52a73c4a5a2d66218c9a6e3e883a3b

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-02-23 22:56:21 +00:00
33ae237686
Implement Settings#checkAndNoteChangeNetworkStateOperation on CS
Connectivity is becoming a mainline module in S and
ConnectivityManager#enforceChangePermission is using
Settings#checkAndNoteChangeNetworkStateOperation for performing a
strict and comprehensive check of whether a calling package is
allowed to change the state of network. However, Mainline modules
are not allowed to use non-formal APIs, fortunately CS is the
only caller of this ConnectivityManager#enforceChangePermission.
Thus, implement the Settings API on ConnectivityService and remove
the ConnectivityManager#enforceChangePermission and
Settings#checkAndNoteChangeNetworkStateOperation.

Bug: 178565313
Test: atest FrameworksNetTests
Change-Id: I6f03398c1735b89470ad5bdbe3a036929daeb53c
Merged-In: I6f03398c1735b89470ad5bdbe3a036929daeb53c

paulhu   authored and   Paul Hu   commited 2021-02-23 08:35:38 +00:00
bb0277e7e6
Implement Settings#checkAndNoteChangeNetworkStateOperation on CS
Connectivity is becoming a mainline module in S and
ConnectivityManager#enforceChangePermission is using
Settings#checkAndNoteChangeNetworkStateOperation for performing a
strict and comprehensive check of whether a calling package is
allowed to change the state of network. However, Mainline modules
are not allowed to use non-formal APIs, fortunately CS is the
only caller of this ConnectivityManager#enforceChangePermission.
Thus, implement the Settings API on ConnectivityService and remove
the ConnectivityManager#enforceChangePermission and
Settings#checkAndNoteChangeNetworkStateOperation.

Bug: 178565313
Test: atest FrameworksNetTests
Change-Id: I6f03398c1735b89470ad5bdbe3a036929daeb53c

paulhu   authored and   Paul Hu   commited 2021-02-23 08:33:01 +00:00
3ba84e60f9
Merge "Revert "Revert "Delete VPN methods in ConnectivityManager."""
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-02-22 06:12:48 +00:00
10de86f5e5
Revert "Revert "Delete VPN methods in ConnectivityManager.""
1. Stop using ConnectivityManager for VPNs in VpnDialogs.
2. Delete updateLockdownVpn, since all callers have been migrated
   to calling VpnManager directly.
3. Delete the call to VpnManager in factoryReset, since the only
   caller (ResetNetworkConfirm) has been updated to call into
   VpnManager directly.
4. Delete getVpnManager, since it is now unused.

This reverts commit da6bc5ace2.

Reason for revert: should be safe to submit now that aosp/1596096 is merged

Bug: 173331190
Test: treehugger
Change-Id: Ife3607c024006ce4fe46c981e9742170becb6331

Lorenzo Colitti   commited 2021-02-22 05:07:22 +00:00
a7f938e4aa
Merge changes I0a75c440,Ief9e8925,Ie03e8276,If0ac9a64,I716bd771 am: 49822c02b5 am: 28e9fc26a8 am: 2540861d4f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1573943

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I52c41154ae3364774e63376fbdd5a9f42727b65f

Chiachang Wang   authored and   Automerger Merge Worker   commited 2021-02-20 05:04:03 +00:00
23dab7f2c6
Merge changes I0a75c440,Ief9e8925,Ie03e8276,If0ac9a64,I716bd771
* changes:
  [IT06]Move INetworkActivityListener into connectivity module
  [IT05] Remove the unused network activity logic out from NMS
  [IT4.7] Add network activity info into dumpsys for debugging
  [IT4.6] Unbundle NMS out from ConnectivityManager
  [IT4.5] Update radio power from CS directly

Chiachang Wang   authored and   Gerrit Code Review   commited 2021-02-20 02:02:46 +00:00
49822c02b5
Merge "Revert "Delete VPN methods in ConnectivityManager."" am: fc15416480 am: 46f3a23d28 am: aa2b03ecea
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1596592

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9d80ea1c572a3eec58a67b0d7c4faa79b30c206a

Nataniel Borges   authored and   Automerger Merge Worker   commited 2021-02-19 17:02:32 +00:00
4cd9ca834b
Merge "Delete VPN methods in ConnectivityManager." am: e846d48968 am: 3f6ac55db0 am: adf1883cee
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1594171

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iadf429549b60f96c471a29fb91f12ff340c94cb0

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-02-19 17:01:44 +00:00
aee0472522
Revert "Delete VPN methods in ConnectivityManager."
This reverts commit e849277786.

Bug: 180710918
Reason for revert: Broken build 

Change-Id: I6e6318b4c01ccab27ca3e9f16bb2194aa1d9ffd2

Nataniel Borges   commited 2021-02-19 15:25:33 +00:00
da6bc5ace2
Delete VPN methods in ConnectivityManager.
1. Stop using ConnectivityManager for VPNs in VpnDialogs.
2. Delete updateLockdownVpn, since all callers have been migrated
   to calling VpnManager directly.
3. Delete the call to VpnManager in factoryReset, since the only
   caller (ResetNetworkConfirm) has been updated to call into
   VpnManager directly.
4. Delete getVpnManager, since it is now unused.

Test: m
Bug: 173331190
Change-Id: I5d071281c0e36f6523fea10671a9abf994c66d66

Lorenzo Colitti   commited 2021-02-19 17:34:30 +09:00
e849277786
Merge "Use formal API for ActivityThread to set proxy"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-02-19 05:42:06 +00:00
fb0f9e3275
Use formal API for ActivityThread to set proxy
Add setHttpProxyConfiguration to the public API, and use
ConnectivityManager APIs from ActivityThread (instead of hidden APIs) to
get/set the proxy for an app process.

The default proxy is now initialized with getDefaultProxy instead of
getProxyForNetwork(null); this should not make a difference, as nothing
should have called bindProcessToNetwork at that point yet.

Bug: 174436414
Test: m; device boots
Merged-In: Ifb516194ecde1567cea4b6806946091cdcf2f015

Change-Id: I06b797eeae54609aecdc0afe1df4e6c602a17a69

Remi NGUYEN VAN   commited 2021-02-19 13:53:56 +09:00
345c2dfcf0
[IT06]Move INetworkActivityListener into connectivity module
INetworkActivityListener is hidden and the only usage is inside
the connectivity module. Thus, move this into module scope.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I0a75c440c1daa773217bbd362b212fda4d07ec64

Chiachang Wang   commited 2021-02-18 12:03:21 +08:00
cea06a618b
[IT4.6] Unbundle NMS out from ConnectivityManager
ConnectivityService is no longer to update idle timer to NMS but
send to INetd directly after this change. Replace the API
implementation in ConnectivityManager to refer into
ConnectivityService instead of NetworkManagementService to remove
the dependency between CM and NMS for ConnectivityService mainline.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: If0ac9a6427dba5a732a15b5d7ca1351b71b07b7b

lucaslin   authored and   Chiachang Wang   commited 2021-02-18 11:48:06 +08:00
709eb84612
Merge "Do not depend on Tethering stubs in CM consts" am: 3a865fa8ac am: 37240dce7d am: a37f12cea9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1589693

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie49e4f4e37439aab3ab1bd5e649c1d84cbc3ce8c

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-02-17 08:53:40 +00:00
4a8fa465bc
Do not depend on Tethering stubs in CM consts
Tethering API stubs depend on connectivity stubs for classes like
MacAddress or LinkAddress, so connectivity stubs cannot depend on
Tethering stubs or there would be a circular dependency.

This means ConnectivityManager API surface cannot reference Tethering
API constants. Instead, use the literal in ConnectivityManager.

This means that both ConnectivityManager and TetheringManager specify
the constant value. An alternative considered was to have
TetheringManager depend on the ConnectivityManager constants, but
considering that ConnectivityManager only has some of the constants,
this would be more confusing. Breaking the constants by mistake is
unlikely as their values are part of the API surface, so will always be
in sync.

Bug: 171540887
Test: m
Change-Id: I16b6e1912fffc5ff8b3b392901d2357ffd213c72

Remi NGUYEN VAN   commited 2021-02-17 12:04:10 +09:00
71ced8e088
Rename getVpnLockdownWhitelist to -Allowlist
Test: m
Change-Id: Id02a37624655c4ff88744c9c57af9f2a17953667
Merged-In: Id02a37624655c4ff88744c9c57af9f2a17953667

Lorenzo Colitti   commited 2021-02-15 12:04:13 +00:00
b6bd8a54a1
Rename getVpnLockdownWhitelist to -Allowlist
Test: m
Bug: 173331190
Change-Id: Id02a37624655c4ff88744c9c57af9f2a17953667

Lorenzo Colitti   commited 2021-02-15 16:10:14 +09:00
ba26988b1c
Merge changes Ia68f482a,I4911e214,Ied379654,I66d18512,Ie8e1bd63 am: d18e61a6d1 am: a7a858e42a am: ed9730e6f9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1581293

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I698b6b082b121c004b2c8b05ef423da1bd8b871b

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-02-15 01:32:50 +00:00
3bf6f17d7b
Merge changes Ia68f482a,I4911e214,Ied379654,I66d18512,Ie8e1bd63
* changes:
  Check registering system default callback needs NETWORK_SETTINGS.
  Move VPN code from ConnectivityService to VpnManagerService.
  Add a skeleton VpnManagerService, and start it on boot.
  Convert LockdownVpnTracker to NetworkCallbacks.
  Minor fixes to VpnTransportInfo.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-02-15 00:00:47 +00:00
d18e61a6d1
Merge changes from topics "pans", "pans-permission" am: 601d16a336 am: 700e969359 am: 6c16aeadfb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1561317

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I20fdb2f06b473f9f92e62138e72bd30d4384a267

James Mattis   authored and   Automerger Merge Worker   commited 2021-02-14 09:51:16 +00:00
1be5c805d6
Marking setOemNetworkPreference as @SystemApi
Marking setOemNetworkPreference in ConnectivityManager as @SystemApi.

Bug: 176496438
Bug: 176494815
Test: atest FrameworksNetTests
atest FrameworksNetIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: I4681c88dc3a83f71c387b29610c33594e57cb43f

James Mattis   commited 2021-02-11 20:38:21 -08:00
6e2d702d37
Adding permission for OEM managed preferences
Adding CONTROL_OEM_PAID_NETWORK_PREFERENCE as a signature level
permission to allow an application to control OEM managed network
preferences.

Bug: 176496438
Bug: 176494815
Test: atest FrameworksNetTests
atest NetworkStackTests
atest FrameworksNetIntegrationTests
atest NetworkStackIntegrationTests
atest CtsNetTestCasesLatestSdk
Change-Id: Iee13e89f3931c7079c2d88cb57b249b1b1cf93ad

Change-Id: Id29cafe1eaf5dff8a0605cb2579204d9c77b7e70

James Mattis   commited 2021-02-11 20:38:21 -08:00
a46c144617