Commit graph android_packages_modules_Co.../framework/src/android/net/ConnectivityManager.java
Message SHA1
Allow unprivileged NetworkCallbacks to see other UIDs' networks.
Currently, unprivileged apps can call getAllNetworks() to see
all networks on the system, even networks that do not apply to
them. Allow them to do this via NetworkCallbacks as well.

This is the last piece of information that was only available
through getAllNetworks, so this CL deprecates that API.

Bug: 187921303
Test: new unit tests
Test: CTS test in other CL in topic
Change-Id: I30f1021927d3c8eae6525116c61ff4a4acecff6d

Lorenzo Colitti   commited 2021-05-18 12:24:07 +09:00
86714b1fd2
Add ConnectivityAnnotations class
This change is to address API review, add respective
@IntDef for network policy API.

Typedef cannot be exposed as SystemApi so add
ConnectivityAnnotations class and add an annotation library
so that it can be used in module and platform.

Bug: 183972925
Test: m, build doc target framework-doc-stubs_annotations.zip
      and check the APIs have an attribute IntDef annotation
Change-Id: Ie3ec40cf48818edd422a4550377774eae387d3b2

Aaron Huang   commited 2021-05-14 10:30:49 +08:00
6a7e6ad55c
Merge "Add doc to getNetworkCapabilities" am: 59d89299c9 am: 622e129d00 am: efca123280
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1690668

Change-Id: I0c41878350ffe4015fe9e6034651f50366503dfe

Junyu Lai   authored and   Automerger Merge Worker   commited 2021-05-03 04:06:34 +00:00
2e3d79675b
Merge "Add doc to getNetworkCapabilities"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-05-03 03:16:24 +00:00
59d89299c9
Add doc to getNetworkCapabilities
Test: doc-only change
Fixes: 158092418
Change-Id: Ic20fb55e1bdd4e836468794d1f86d3e9d0bc5965

Chalard Jean   commited 2021-04-30 11:24:00 +00:00
070bdd4b77
Merge "Rename getAllNetworkStateSnapshot which should be pluralized"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-04-29 04:40:51 +00:00
984e51670e
Merge "Address API review feedback"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-04-26 00:22:27 +00:00
5e2a729668
Update PrivateDnsMode from StringDef to IntDef
Update PrivateDnsMode from StringDef to IntDef because IntDef is
the normal way of representing multiple choices in public API.
Also update other related files.

Bug: 185311744
Test: 1. make update-api
      2. atest FrameworksNetTests CtsNetTestCases CtsNetTestCasesLatestSdk
      3. atest FrameworksServicesTests:DevicePolicyManagerTest
Change-Id: I23e7ec140066979726d769cabc5f7057bb2167e6

lucaslin   commited 2021-04-23 21:03:39 +08:00
57ee606244
Address API review feedback
Address API review feedback to:
 - Rename NetworkAgent#setTeardownDelayMs to
   NetworkAgent#setTeardownDelayMillis
 - Use getters instead of fields in VpnTransportInfo
 - Rename registerDefaultNetworkCallbackAsUid to
   registerDefaultNetworkCallbackForUid in ConnectiivityManager

Bug: 183972850
Bug: 185246410
Fix: 184735863
Test: make update-api
Test: atest FrameworksNetTests
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I5e8c4bed8bda40d507afa894c359b5e24ee5d868
Merged-In: I5e8c4bed8bda40d507afa894c359b5e24ee5d868

Chiachang Wang   commited 2021-04-23 02:46:05 +00:00
9075ae36be
Merge "Address API review feedback" into sc-dev
Chiachang Wang   authored and   Android (Google) Code Review   commited 2021-04-23 00:30:51 +00:00
6f7ac6860e
Rename getAllNetworkStateSnapshot which should be pluralized
Address API review feedback, ConnectivityManager#getAllNetworkStateSnapshot
should be pluralized so rename the method to getAllNetworkStateSnapshots

(cherry picked from ag/14221105)
Bug: 183972554
Test: make, FrameworksNetTests
      FrameworksServicesTests
Merged-In: Ic18d17d05984fa2466c962c7843c0ef7183ce77c
Change-Id: Ic18d17d05984fa2466c962c7843c0ef7183ce77c

Aaron Huang   commited 2021-04-22 17:45:22 +08:00
da103b3365
Merge "Add the related extra information in the javadoc" am: f78aabbf82 am: db0c8c32b1 am: 7663d1760d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1681465

Change-Id: I9eb3c2543787a91f211be5eb7b92b66fe696489f

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-04-21 09:19:13 +00:00
9eea7b3d09
Merge "Add the related extra information in the javadoc"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-04-21 08:22:43 +00:00
f78aabbf82
Add the related extra information in the javadoc
Bug: 185876442
Test: make docs
Change-Id: Ib0abc43e2009dbf5ee7b6c2a076424834d3d53f2

lucaslin   commited 2021-04-21 10:43:15 +08:00
8bee2fd622
Address API review feedback
Address API review feedback to:
 - Rename NetworkAgent#setTeardownDelayMs to
   NetworkAgent#setTeardownDelayMillis
 - Use getters instead of fields in VpnTransportInfo
 - Rename registerDefaultNetworkCallbackAsUid to
   registerDefaultNetworkCallbackForUid in ConnectiivityManager

Bug: 183972850
Bug: 185246410
Fix: 184735863
Test: make update-api
Test: atest FrameworksNetTests
Test: atest CtsNetTestCasesLatestSdk
Test: atest FrameworksMockingServicesTests
Change-Id: I5e8c4bed8bda40d507afa894c359b5e24ee5d868

Chiachang Wang   commited 2021-04-20 09:30:59 +00:00
c7d203dfcb
Rename getAllNetworkStateSnapshot which should be pluralized
Address API review feedback, ConnectivityManager#getAllNetworkStateSnapshot
should be pluralized so rename the method to getAllNetworkStateSnapshots

Bug: 183972554
Test: make, FrameworksNetTests
      FrameworksServicesTests
Change-Id: Ic18d17d05984fa2466c962c7843c0ef7183ce77c

Aaron Huang   commited 2021-04-17 14:08:49 +08:00
ab615e5c03
[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
[VCN20] Change requestBackgroundNetwork argument order
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215095
Ignore-AOSP-First: avoid build break caused by multipatch automerge
Change-Id: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb

junyulai   commited 2021-04-15 18:43:48 +08:00
ca657cbca4
Merge "Improve documentation on simulateDataStall" am: 3b4f0832bd am: b241ce07a9 am: 3c5cdf0dbc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1669505

Change-Id: I9484583b0249f4f67fdf6216f9ca72b900320699

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-04-09 02:36:41 +00:00
cb7360eecb
Merge "Improve documentation on simulateDataStall"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-04-09 00:21:34 +00:00
3b4f0832bd
Merge "Move ACTION_CLEAR_DNS_CACHE to ConnectivityManager" am: ed4117ff40 am: 2cac9e94ba am: 21dbcf362f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1667080

Change-Id: I5fd350d67065211b84dbea769d258daff9780276

Paul Hu   authored and   Automerger Merge Worker   commited 2021-04-08 07:48:14 +00:00
324810d572
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
Merge "Remove unnecessary public API getActiveNetworkForUid" into sc-dev
TreeHugger Robot   authored and   Android (Google) Code Review   commited 2021-04-08 02:26:15 +00:00
cfbcf574dc
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" am: 1515b6c96d am: 0eadb2848d am: 89fcdff5d6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1633279

Change-Id: I05777492db3ab9d7b4c6c69131f9404780e4e832

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-04-07 02:47:49 +00:00
ec73c43fa0
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
Remove unnecessary public API getActiveNetworkForUid
We have exposed the CS module API getActiveNetworkForUid
(Used in Jobscheduler) as a temporary solution for the mainline
Connectivity service module. This API usage has now been removed
in Jobscheduler(b/165835257), so we can permanently remove the
public getActiveNetworkForUid API.

Bug: 183465229
Test: atest FrameworksNetTests
Change-Id: I0f23272d2d8a5118f2e11ac325fdb9e8f9dbe0e3

lifr   commited 2021-04-06 17:39:09 +08:00
db7d676f20
Merge "Cleanup setGlobalProxy" am: 376274c277 am: 676eccd672 am: 8cce6d3336
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1640148

Change-Id: Ic9757060f398aaf871141dc5199bf49988637937

Chalard Jean   authored and   Automerger Merge Worker   commited 2021-04-06 07:55:54 +00:00
605bae6972
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
Merge changes If539cf5d,I9765f1c9,I6d3007a1 am: f2babbbd67 am: e18ea6cb80 am: 34792dd0c9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1652262

Change-Id: I94e5cf19a7b7dac8400cb7acf80b39a864099956

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-03-30 02:24:00 +00:00
27e1d0473e
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
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