Commit Graph

6188 Commits

Author SHA1 Message Date
Kweku Adams
9496d1170a Merge "Check network blocked reasons for job satisfaction." into sc-dev 2021-04-06 15:04:01 +00:00
Les Lee
b156dbcb90 Merge "Fix Wi-Fi SSID null handling" am: cadd76044e am: 114e0a0dd8 am: 8874e81cf7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1624059

Change-Id: Iefb2bd39b51072cda3d4239e031ab00bd2e6f5c4
2021-04-06 06:10:38 +00:00
Les Lee
cadd76044e Merge "Fix Wi-Fi SSID null handling" 2021-04-06 03:52:52 +00:00
Paul Hu
32de19f353 Merge "Remove unused method checkUidNetworkingBlocked" am: 7cd588e210 am: 88c64a0345 am: d67767b7f9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1657766

Change-Id: I069970241689bde2b615ac0fef523f155d1226f4
2021-04-06 03:21:12 +00:00
Paul Hu
7cd588e210 Merge "Remove unused method checkUidNetworkingBlocked" 2021-04-06 01:49:57 +00:00
Kweku Adams
5f2d4f348c Check network blocked reasons for job satisfaction.
Use the provided blocked connectivity reasons to determine whether a
job's network constraint is satisfied or not.

Bug: 171305774
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/job
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/job
Test: atest CtsHostsideNetworkTests:HostsideRestrictBackgroundNetworkTests
Test: atest CtsJobSchedulerTestCases
Change-Id: I21b936b9b2f89e40073f8d1d7acb9032722006f1
2021-04-05 14:51:10 -07:00
Cody Kesting
2aca029981 Merge "Clarify docs for status codes in VcnStatusCallback." am: 36a84ebbaf am: 2ea2b734e5 am: f73591b47f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1660643

Change-Id: Ib276041e5f3c5e0401bf466939384bfaa8801119
2021-04-02 03:43:50 +00:00
Cody Kesting
36a84ebbaf Merge "Clarify docs for status codes in VcnStatusCallback." 2021-04-02 01:24:25 +00:00
Cody Kesting
803668c0a3 Merge changes from topic "gateway-connection-id" am: 03f00e5a52 am: 2fa4b7b757 am: 1230749c35
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1659162

Change-Id: Ic60a32e6cefab3807102f1ee2d6565a15e053a15
2021-04-01 20:20:59 +00:00
Cody Kesting
03f00e5a52 Merge changes from topic "gateway-connection-id"
* changes:
  Expose API for identifying GatewayConnections.
  Update identification for onGatewayConnectionError().
2021-04-01 18:27:28 +00:00
Cody Kesting
24aa7bc5cb Clarify docs for status codes in VcnStatusCallback.
This CL clarifies the documentation for status codes used in
VcnStatusCallback #onStatusChanged() and #onGatewayConnectionError, per
API Council feedback.

Bug: 182345902
Test: atest FrameworksVcnTests CtsVcnTestCases
Change-Id: I86770a19f3d9f9a42aa3713489943fbe78561773
2021-03-31 14:23:55 -07:00
Cody Kesting
5926d20e03 Expose API for identifying GatewayConnections.
This CL exposes the updated APIs for identifying GatewayConnections via
a user-configured String set in VcnGatewayConnectionConfig.Builder, as
requested by the API Council.

Bug: 182345902
Bug: 180522464
Test: atest FrameworksVcnTests
Change-Id: I10afd074906bc0f3831157dcee1da813b4cfce78
2021-03-31 14:23:29 -07:00
Cody Kesting
52265aab76 Update identification for onGatewayConnectionError().
This CL updates the identification method for
VcnStatusCallback#onGatewayConnectionErrror. Previously,
GatewayConnections were identified by an int[] specifying the
GatewayConnection's exposed NetworkCapabilities. Following API Council
feedback, this is updated to identify GatewayConnections by a
caller-provided String set in the VcnGatewayConnectionConfig.Builder.

Bug: 182345902
Bug: 180522464
Test: atest FrameworksVcnTests
Change-Id: I933c2330edb9bfc1b6bb62276debac02460e24f8
2021-03-31 14:22:54 -07:00
paulhu
6d5643f87e Remove unused method checkUidNetworkingBlocked
aosp/1612823 removed the usage from CS, no one is using
checkUidNetworkingBlocked() now. Thus, remove it from
NetworkPolicyManager, AIDL and NetworkPolicyManagerService.

Bug: 180084343
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases
Test: atest CtsHostsideNetworkTests
Test: atest FrameworksCoreTests:NetworkPolicyManagerTest
Test: atest FrameworksServicesTests:NetworkPolicyManagerServiceTest
Change-Id: I632efa4b775a0238bb912690d48e766597e5e623
2021-03-31 15:48:10 +08:00
Sudheer Shanka
a55c43879e Merge "Revert NPMS threshold to BFGS." into sc-dev 2021-03-30 17:51:51 +00:00
lesl
15d809b9f4 Fix Wi-Fi SSID null handling
When Wi-Fi SSID is null in NetworkCapabilities,
get Wi-Fi SSID from connection info (WifiInfo) which is non-null design.

Bug: 176396812
Test: FrameworksNetTests NetworkPolicyManagerServiceTest
Change-Id: I59c7d8f7e176d0c6bb100721269f3f6165f0ca21
2021-03-30 23:57:56 +08:00
Junyu Lai
3757df2e7d Merge "[SP31] Expose onSetWarningAndLimit System API" 2021-03-30 08:00:45 +00:00
Sudheer Shanka
05f75c2553 Merge "Remove NetworkPolicyManager.isUidBlocked() API." am: 9cff99d059 am: 433c866186 am: 4b3348f115
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1652550

Change-Id: Ic5c9fb2603a010976bc93e5059e5548ee782005e
2021-03-29 17:45:42 +00:00
Sudheer Shanka
d3ba15beeb Remove NetworkPolicyManager.isUidBlocked() API.
It isn't used by ConnectivityService any more and even if
it needs such utility method in the future, we could create
one which is part of connectivity module and doesn't need
to be exposed as part of NetworkPolicyManager API surface.

Bug: 183696103
Test: atest ./tests/net/java/com/android/server/ConnectivityServiceTest.java
Change-Id: Ie3c681f88e4b2b9bb92d2224c5ea96b074f155d5
2021-03-29 12:39:12 +00:00
Junyu Lai
ac196a1e07 Merge "[SP28] Add API for set data warning" 2021-03-29 11:06:05 +00:00
Sudheer Shanka
d31f86401e Revert NPMS threshold to BFGS.
Earlier, we changed the threshold to IMP_FG to allow
HPJs to bypass power saving network restrictions but
later we made a change to instead use network capability
for HPJs, so reverting the threshold to BGFS.

Bug: 177641226
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I6c1916ca9e8ff9555bbacda678ce53f8373c8960
2021-03-26 13:02:07 -07:00
Lorenzo Colitti
58ee26218c Merge changes from topic "blocked-reasons-callback-tests" am: 2108a92452 am: 6456359a0e am: 8afa9811c7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1652214

Change-Id: I4d69b1ce096d83c311620950650460024ae348c0
2021-03-26 05:27:47 +00:00
Lorenzo Colitti
5ab70251e8 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
2021-03-26 02:37:19 +09:00
junyulai
59b0a621e7 [SP31] Expose onSetWarningAndLimit System API
Test: atest NetworkPolicyManagerServiceTest NetworkStatsServiceTest
Bug: 149467454
CTS-Coverage-Bug: 183598414
Merged-In: I6f5e22e3a7b80a38cae9f3c5d7296a1dff34facf
Change-Id: I6f5e22e3a7b80a38cae9f3c5d7296a1dff34facf
  (cherry-picked from ag/13981689)
2021-03-25 09:32:43 +08:00
Junyu Lai
4a8feb1558 Merge changes I6f5e22e3,I6c486303 into sc-dev
* changes:
  [SP31] Expose onSetWarningAndLimit System API
  [SP29] Send interface warning bytes to NetworkStatsProvider
2021-03-24 19:25:53 +00:00
Sudheer Shanka
d533fa78b1 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
2021-03-25 01:33:26 +09:00
TreeHugger Robot
956dd2834f Merge "Move BLOCKED_REASON_* constants from NPMS into ConnectivityManager." into sc-dev 2021-03-24 16:02:56 +00:00
junyulai
fc73e7ba4b [SP28] Add API for set data warning
To have better control and race-free of set data warning
to tether offload hardware, an interface of set warning and
limit at the same time in the NetworkStatsProvider is needed.

This is a no-op change which expose such interface with minimum
changes in service side to get build pass. The implementation
would be included in follow-up patches.

Test: atest NetworkStatsServiceTest
Test: atest NetworkPolicyManagerServiceTest
Test: atest GtsNetworkStackHostTestCases
Test: m doc-comment-check-docs
Bug: 149467454
Bug: 170699770
Bug: 170179169
Merged-In: I6ee661497f7dedb871c85786d1950cab951d8aa2
Change-Id: I6ee661497f7dedb871c85786d1950cab951d8aa2
  (cherry-picked from ag/13959436)
2021-03-24 22:48:26 +08:00
junyulai
80fb26a90d [SP31] Expose onSetWarningAndLimit System API
Test: atest NetworkPolicyManagerServiceTest NetworkStatsServiceTest
Bug: 149467454
CTS-Coverage-Bug: 183598414
Ignore-AOSP-First: avoid long automerger delay
Change-Id: I6f5e22e3a7b80a38cae9f3c5d7296a1dff34facf
2021-03-24 22:03:03 +08:00
Junyu Lai
b99a0bc491 Merge "[SP28] Add API for set data warning" into sc-dev 2021-03-24 10:22:08 +00:00
Benedict Wong
c475dcfc45 Merge "Check carrier privilege permissions with package name" am: f1a81b04b1 am: cc103b3c7a am: 55ed7ee12b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649652

Change-Id: I236f500d5428f8d370b41d94c386ac20823742a8
2021-03-24 03:00:52 +00:00
Benedict Wong
d68c1f6cb2 Check carrier privilege permissions with package name
This change ensures that carrier privileges for the right packages are
always checked.

Bug: 183465199
Test: atest FrameworksVcnTests
Change-Id: If46c660e54870529868a7b4b1e271c9009b81d45
2021-03-23 17:42:12 -07:00
Sudheer Shanka
2e20a1a29e 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
Cody Kesting
44f9647832 Merge changes from topic "vcn-status-changed" am: 46c10cbc4d am: c74b9c7ac9 am: c33747c5f0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1633026

Change-Id: I237022fee3667824736e222dad64d8528fe0b699
2021-03-23 19:34:37 +00:00
Cody Kesting
46c10cbc4d Merge changes from topic "vcn-status-changed"
* changes:
  Rename VcnStatusCallback#onVcnStatusChanged.
  Reevaluate VcnGatewayConnections on receiving new configs.
2021-03-23 17:10:51 +00:00
junyulai
ac1da4d565 [SP28] Add API for set data warning
To have better control and race-free of set data warning
to tether offload hardware, an interface of set warning and
limit at the same time in the NetworkStatsProvider is needed.

This is a no-op change which expose such interface with minimum
changes in service side to get build pass. The implementation
would be included in follow-up patches.

Test: atest NetworkStatsServiceTest
Test: atest NetworkPolicyManagerServiceTest
Test: atest GtsNetworkStackHostTestCases
Test: m doc-comment-check-docs
Bug: 149467454
Bug: 170699770
Bug: 170179169
Ignore-AOSP-First: avoid long automerger delay
Change-Id: I6ee661497f7dedb871c85786d1950cab951d8aa2
2021-03-23 23:43:10 +08:00
Cody Kesting
c57281504e Rename VcnStatusCallback#onVcnStatusChanged.
Per API Council feedback, VcnStatusCallback#onVcnStatusChanged is
renamed to VcnStatusCallback#onStatusChanged.

Bug: 182345902
Test: atest FrameworksVcnTests CtsVcnTestCases
Change-Id: Ie0277c5f053e1802aa98240618a9d9e8aa6d9d09
2021-03-22 11:59:27 -07:00
Sudheer Shanka
f072281f63 Fix the case where blocked reasons for dataSaver are not considered.
Fixes: 183267528
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideNetworkCallbackTests.java
Merged-In: I3c90c3849261df4c289c398f22661f91f7cf4994
Change-Id: Iba3ff804a74fb482847dd999c2854405b21affd2
2021-03-22 17:36:21 +00:00
Sudheer Shanka
49ffed5759 Fix the case where blocked reasons for dataSaver are not considered.
Fixes: 183267528
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideNetworkCallbackTests.java
Change-Id: I3c90c3849261df4c289c398f22661f91f7cf4994
2021-03-22 00:52:07 -07:00
Lorenzo Colitti
f969377a96 Expose isUidNetworkingBlocked and isUidRestrictedOnMeteredNetworks
These methods are used by ConnectivityService for synchronous
calls such as getActiveNetworkInfo, isActiveNetworkMetered, etc.

These calls must call into NPMS and acquire the NPMS lock because
they are synchronous. They cannot use the stale copy of the
policy rules maintained by ConnectivityService, because if they
did, races like the following could occur:

1. App gets broadcast/callback/....
2. App calls isActiveNetworkMetered or other synchronous method.
3. ConnectivityService's copy of the rules is out of date, so the
   call returns stale information that the UID is still blocked.
4. The app thinks it has no networking, and does not call the
   synchronous method again until some other event occurs,
   potentially much later.

Bug: 176289731
Test: passes existing tests in ConnectivityServiceTest
Change-Id: I4ad0ca60431fe3702be85332530b6e93728d55e7
Merged-In: I4ad0ca60431fe3702be85332530b6e93728d55e7
2021-03-20 22:23:23 +09:00
Remi NGUYEN VAN
00b8d2cf37 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
Treehugger Robot
66794f915f Merge "Reland "Add an API to listen for changes in network blocked status of an uid."" 2021-03-19 10:12:15 +00:00
Remi NGUYEN VAN
2f355196c5 Merge "Move network selection utils to Connectivity" am: c9f553c7ed am: 295bcd9be7 am: 73d3166547
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645291

Change-Id: I0b984a01e1688b8484f3500945d0e429e1b3ca00
2021-03-19 02:52:41 +00:00
Remi NGUYEN VAN
295bcd9be7 Merge "Move network selection utils to Connectivity" am: c9f553c7ed
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645291

Change-Id: I452591707a97b501f189fa9f61e90da842fa3734
2021-03-19 00:35:03 +00:00
Remi NGUYEN VAN
c9f553c7ed Merge "Move network selection utils to Connectivity" 2021-03-18 23:57:34 +00:00
Sudheer Shanka
da90e7a2bb Reland "Add an API to listen for changes in network blocked status of an uid."
This reverts commit 8623f2b3ca.

Reason for revert: The issue causing the build breakage has been fixed

Change-Id: I03fa406551b51aaa4d4d9255cf1a53f9b4bcc1bd
Merged-In: Ib9949b8619c6b148f73630b314c4113d76c31ec1
2021-03-18 19:11:55 +00:00
Benedict Wong
6456c828a2 Merge "Hide required underlying caps APIs" am: d4b7104f7b am: ead4d8c3b4 am: cf2a7d9324
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1634485

Change-Id: I4744802196afc856eb81ac830c51c2af923e0727
2021-03-18 18:32:58 +00:00
Lorenzo Colitti
9eb2c374a2 Merge "Add a VpnManager.TYPE_VPN_OEM." am: 9794a9444e am: 630a52226f am: 6de50c8008
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1644265

Change-Id: I512785d414fcfd4819cdf26ff3c3403c049db475
2021-03-18 18:25:54 +00:00
Benedict Wong
ead4d8c3b4 Merge "Hide required underlying caps APIs" am: d4b7104f7b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1634485

Change-Id: I46abe41479e04688a45e72de5ce4d77882057ef1
2021-03-18 17:15:50 +00:00
Benedict Wong
d4b7104f7b Merge "Hide required underlying caps APIs" 2021-03-18 17:05:37 +00:00