Commit Graph

116 Commits

Author SHA1 Message Date
Martijn Coenen
b329228214 Make StorageVolume#getOwner a system API.
Since the MediaProvider mainline module will now manage volumes of
multiple users, it needs to know which user a volume belongs to. This
was implemented by an already existing API, so make that a @SystemApi.

Bug: 182396009
Test: N/A

Change-Id: I9ca24e500adfd51fbd52e863f549365dd9aaf39d
2021-03-23 14:16:12 +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
Remi NGUYEN VAN
690e8880ae Merge changes I4ad0ca60,I8a03162b into sc-dev
* changes:
  Expose isUidNetworkingBlocked and isUidRestrictedOnMeteredNetworks
  Add multipath preference, background status API
2021-03-18 14:07:12 +00:00
TreeHugger Robot
043d71394c Merge "Add TEST_NETWORK_SERVICE to module API" into sc-dev 2021-03-18 10:33:54 +00:00
Lorenzo Colitti
0c1a37b7ad 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
2021-03-18 07:47:27 +00:00
Remi NGUYEN VAN
87eb49b62f 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
Lorenzo Colitti
4763300fab Add a VpnManager.TYPE_VPN_OEM.
This needed for OEMs that have VPN types not supported by AOSP.

Bug: 171872481
Test: new test coverage in VpnTransportInfoTest
Change-Id: Ic7529bef7f12d2c74a3be5b1a4a2d54fb0d0bfac
2021-03-18 05:54:53 +00:00
Sudheer Shanka
98dd271306 Add an API to listen for changes in network blocked status of an uid.
Given that ConnectivityService is moving to a mainline module, we need
a @SystemApi for it to listen for changes in blocked status of an uid.
So, we decided to create a new API for this which can provide
ConnectivityService with more info about why an uid is blocked (which
will be useful for adding a new similar onBlockedStatusChanged callback
in CM.NetworkCallback) and also captures data saver restriction without
having out to track it separately.

Currently, NPMS does some redundant computations because we are
calculating both uid rules and blocked reasons separately. In a
follow-up change, we will compute uid rules using blocked reasons
and later possibly remove that onUidRulesChanged callback.

Bug: 176289731
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Test: atest ./tests/net/java/com/android/server/ConnectivityServiceTest.java
Test: atest ./services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
Change-Id: Ib9949b8619c6b148f73630b314c4113d76c31ec1
2021-03-18 05:48:44 +00:00
Remi NGUYEN VAN
d31b35212c Add TEST_NETWORK_SERVICE to module API
TestNetworkManager is being unbundled; the TEST_NETWORK_SERVICE constant
is necessary for the module to register the manager with
registerContextAwareService.

Bug: 171540887
Test: m
Change-Id: I0690251ddfcdaa8a34830e110b75869a370de389
2021-03-18 00:27:51 +00:00
Jeff Sharkey
8c2ee9bc3e Merge "Expose VPN_UID" am: 58f7a60187 am: 8710bc1755 am: a7913a0656
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1625699

Change-Id: I4899b2fe5733d24797d33a48069f15a9d4686bb5
2021-03-17 22:26:17 +00:00
lucaslin
e4ea3d4c84 Expose VPN_UID
ConnectivityService will be a part of mainline module, so it
cannot access hidden API. Expose VPN_UID for ConnectivityService
to access.

Bug: 170598012
Test: m
Change-Id: I9f74fb97ba27e5feacf1820cf75e28ad73516d7d
2021-03-17 19:04:01 +08:00
Corina Grigoras
9f2095305b Merge "Expose create uri as user as system api." into sc-dev 2021-03-15 17:27:34 +00:00
Aaron Huang
e29f0a55d8 Merge changes from topic "pacproxy-service" am: 16f50075b1 am: 688ae36dcb am: ce43593e5e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553959

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If6d34753e8bf9201e16121b8f3c6c83aa6358986
2021-03-15 12:56:09 +00:00
Aaron Huang
16f50075b1 Merge changes from topic "pacproxy-service"
* changes:
  Make PacProxyService be a system service
  Revert^2 "Refactor setCurrentProxyScriptUrl to a void method"
2021-03-15 11:49:45 +00:00
Aaron Huang
5d31a15d84 Make PacProxyService be a system service
PacProxyInstaller class is running a thread all the time and is
listening to intent ACTION_PAC_REFRESH so it would be better to
make it be a system service with a manager class PacProxyManager
which is obtained with getSystemService(PacProxyManager.class).
Besides, rename PacProxyInstaller to PacProxyService will
be easier to know it's the service for PacProxyManager.

ConnectivityService is going to be a mainline module and it
needs constructor of PacProxyService to be SystemApi.
However, in current design, it needs to pass a handler and
an int arguments to the constructor which would be difficult
to maintain if just expose the constructor directly.

So, define a listener for the event that the current PAC
proxy has been installed so that the handler and the int
arguments can be removed from the constructor.

Bug: 177035719
Test: FrameworksNetTests
Change-Id: I2abff75ec59a17628ef006aad348c53fadbed076
2021-03-15 14:40:58 +08:00
Corina
3fcaa5218c Expose create uri as user as system api.
Bug: 179659160
Test: atest ContentProviderTest
Change-Id: I86edc2d4fa0911366a91170819140b274f5d6480
2021-03-12 16:43:35 +00:00
Paul Hu
240fdc5d97 Merge "Expose Intent#ACTION_CLEAR_DNS_CACHE" 2021-03-12 07:47:10 +00:00
paulhu
97c860113a Expose Intent#ACTION_CLEAR_DNS_CACHE
DnsManager will broadcast ACTION_CLEAR_DNS_CACHE intent to clear
dns cache when network have changed. But DnsManager is in the
Connectivity mainline module which can not use non-formal API.
Thus, expose Intent#ACTION_CLEAR_DNS_CACHE as module lib API for
mainline module.

Bug: 182370679
Test: m update-api
Merged-In: I30b1b146dcae82926be7bdb8b343635a01eabefe

Change-Id: I30b1b146dcae82926be7bdb8b343635a01eabefe
2021-03-12 05:21:08 +00:00
Paul Hu
e1ca2891e5 Merge "Expose Intent#ACTION_CLEAR_DNS_CACHE" into sc-dev 2021-03-12 03:29:34 +00:00
Remi NGUYEN VAN
c5479a0886 Add Ethernet, TestNetworkSpecifier API
Rename StringNetworkSpecifier to EthernetNetworkSpecifier (its only
production user), and make it module-lib API.
The original StringNetworkSpecifier file is actually kept to satisfy
some invalid dependencies; it will be removed separately.

This allows specifying an Ethernet interface with a non-deprecated API:
until this change the only way to do so would be to use
NetworkRequest#setSpecifier(String), which is deprecated.

Similarly, add the TestNetworkSpecifier API for TestNetworkManager, to
replace previous usage of StringNetworkSpecifier. TestNetworkManager is
module API, so TestNetworkSpecifier should be module API too. This
allows tests to request the test interface specifically, without using
the deprecated NetworkRequest#setSpecifier(String).

Bug: 179329291
Test: m
Merged-In: Iee569f5c8bbdc4bc979610e1191308281f3d4620

Change-Id: Iee569f5c8bbdc4bc979610e1191308281f3d4620
2021-03-11 23:02:02 +08:00
paulhu
06caf5d5b6 Expose Intent#ACTION_CLEAR_DNS_CACHE
DnsManager will broadcast ACTION_CLEAR_DNS_CACHE intent to clear
dns cache when network have changed. But DnsManager is in the
Connectivity mainline module which can not use non-formal API.
Thus, expose Intent#ACTION_CLEAR_DNS_CACHE as module lib API for
mainline module.

Bug: 182370679
Test: m update-api
Change-Id: I30b1b146dcae82926be7bdb8b343635a01eabefe
2021-03-11 13:51:47 +08:00
Lucas Lin
c4d7b9bc36 Merge "Expose TYPE_VPN_* constants" am: d2b8d781f8 am: 1fd78110a4 am: 9c617a1829
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1625559

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic2cab78f0920e5805c27b14bef10417d6e018e94
2021-03-11 03:07:13 +00:00
lucaslin
62b2252831 Expose TYPE_VPN_* constants
Expose TYPE_VPN_* constants so that connectivity mainline module
can access them.

Bug: 172183305
Test: atest FrameworksNetTests
Change-Id: Ic8d46a392f3deda5983c52b43585707fa2c98f57
2021-03-10 16:57:57 +08:00
Remi NGUYEN VAN
020348499e Merge "Add Ethernet, TestNetworkSpecifier API" into sc-dev 2021-03-09 22:43:46 +00:00
Paul Hu
687da317ad Merge "New API for comparing two intents of PendingIntent object." 2021-03-09 10:55:00 +00:00
Remi NGUYEN VAN
6d98157012 Add Ethernet, TestNetworkSpecifier API
Rename StringNetworkSpecifier to EthernetNetworkSpecifier (its only
production user), and make it module-lib API.
The original StringNetworkSpecifier file is actually kept to satisfy
some invalid dependencies; it will be removed separately.

This allows specifying an Ethernet interface with a non-deprecated API:
until this change the only way to do so would be to use
NetworkRequest#setSpecifier(String), which is deprecated.

Similarly, add the TestNetworkSpecifier API for TestNetworkManager, to
replace previous usage of StringNetworkSpecifier. TestNetworkManager is
module API, so TestNetworkSpecifier should be module API too. This
allows tests to request the test interface specifically, without using
the deprecated NetworkRequest#setSpecifier(String).

Bug: 179329291
Test: m
Change-Id: Iee569f5c8bbdc4bc979610e1191308281f3d4620
2021-03-09 07:46:48 +00:00
Aaron Huang
3ae5bdab6e Add a new API in BatteryStatsManager for connectivity service
Connectivity service(CS) is going to be a mainline module and
currently it uses IBatteryStats to communicate with battery
stats service directly. CS cannot use this way after becomes
a mainline module so add new system APIs to communicate with
battery stats service through BatteryStatsManger.

The new API reportNetworkInterfaceForTransports requires
system-only permission NETWORK_STACK or MAINLINE_NETWORK_STACK
so that given the only caller was in ConnectivityService.

This change only add new surface, the usage in CS will be
updated in follow-up CL.

Bug: 171686421
Test: builds, boot, mobile and wifi work.
Change-Id: Ifbd4a9784ed7664751e69d530f8204e292fa6b39
Merged-In: Ifbd4a9784ed7664751e69d530f8204e292fa6b39
2021-03-09 06:24:50 +00:00
Remi NGUYEN VAN
8fffc13f67 Merge changes I1d1f0d2d,Ifbd4a978 into sc-dev
* changes:
  Communicate with BatteryStatsService through BatteryStatsManager
  Add a new API in BatteryStatsManager for connectivity service
2021-03-09 05:49:43 +00:00
paulhu
514881581d New API for comparing two intents of PendingIntent object.
Bug: 174237997
Test: atest PendingIntentTest
Merged-In: Ic5eb20f94ff6fd6953315a5f848effa25b813da7

Change-Id: Ic5eb20f94ff6fd6953315a5f848effa25b813da7
2021-03-09 02:49:43 +00:00
Aaron Huang
558b3177d7 Add a new API in BatteryStatsManager for connectivity service
Connectivity service(CS) is going to be a mainline module and
currently it uses IBatteryStats to communicate with battery
stats service directly. CS cannot use this way after becomes
a mainline module so add new system APIs to communicate with
battery stats service through BatteryStatsManger.

The new API reportNetworkInterfaceForTransports requires
system-only permission NETWORK_STACK or MAINLINE_NETWORK_STACK
so that given the only caller was in ConnectivityService.

This change only add new surface, the usage in CS will be
updated in follow-up CL.

Bug: 171686421
Test: builds, boot, mobile and wifi work.
Change-Id: Ifbd4a9784ed7664751e69d530f8204e292fa6b39
2021-03-08 14:59:13 +08:00
paulhu
e48076b31f New API for comparing two intents of PendingIntent object.
Bug: 174237997
Test: atest PendingIntentTest
Change-Id: Ic5eb20f94ff6fd6953315a5f848effa25b813da7
2021-03-08 11:37:18 +09:00
TreeHugger Robot
8b72f15aad Merge "Remove dispatchMediaKeyEvent API" into sc-dev 2021-03-07 13:23:56 +00:00
Jin Seok Park
378f7fa946 Merge "Revise PendingIntent.queryIntentComponents API" into sc-dev 2021-03-05 05:16:02 +00:00
Zimuzo Ezeozue
3d28144bbd Merge "Accept UUID instead of String in notifyAppIo APIs" into sc-dev 2021-03-03 16:15:58 +00:00
Jin Seok Park
8a228cf12a Revise PendingIntent.queryIntentComponents API
1. Make return type NonNull
2. Use ParceledListSlice for binder call from PendingIntent to
ActivityManagerService

Bug: 180617184
Test: atest CtsAppTestCases:android.app.cts.PendingIntentTest
      #testGetIntentComponentAndType
Change-Id: Ifc4d111da07b9e1c665c07568cbed994927b0ff2
2021-03-04 01:12:37 +09:00
Jin Seok Park
f852ca7afa Remove dispatchMediaKeyEvent API
Remove dispatchMediaKeyEvent(KeyEvent) since it can be substituted
by calling dispatchMediaKeyEvent(KeyEvent, boolean) API with boolean
value as false.

Bug: 179116384
Test: build
Change-Id: I3692c712a780e8978bb8e3b2d19cfc242357e864
2021-03-03 23:40:53 +09:00
Zim
055878b433 Accept UUID instead of String in notifyAppIo APIs
UUID is more strongly typed and encouraged from an API
perspective.

Also added null checks

Test: m
Bug: 170486601
CTS-Coverage-Bug: 181222557
Change-Id: I25565711ca51e8459a89142ac5ac1b767a6326f9
2021-03-03 12:46:46 +00:00
junyulai
33b44da527 [FUI18] Expose notifyNetworkStatus as system API
Test: m -j doc-comment-check-docs
Bug: 174123988
Merged-In: I11d4c9ab24de87fb2ad120e3787b78b73133e874
Change-Id: I11d4c9ab24de87fb2ad120e3787b78b73133e874
  (cherry-picked from ag/13749978)
2021-03-03 20:01:46 +08:00
junyulai
b4308db579 [FUI18] Expose notifyNetworkStatus as system API
Test: m -j doc-comment-check-docs
Bug: 174123988
Change-Id: I11d4c9ab24de87fb2ad120e3787b78b73133e874
2021-03-03 15:34:42 +08:00
Treehugger Robot
4ed07ba929 Merge "[FUI09] Expose NetworkStateSnapshot as system API" am: 4dd42cdd5f am: 8203ac16dc am: 343ddc51b9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536708

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I41be29daeba58378ab374c346684a3d205f0d7c9
2021-03-02 21:10:48 +00:00
Remi NGUYEN VAN
033c0bad05 Merge "Move Proxy, PacProxySelector out of Connectivity" am: ae171d864d am: b6c5e099b5 am: a7005ec455
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1598157

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib253a7ccf3beb8e9e5d0988db3d0662074dedda7
2021-03-02 20:37:24 +00:00
Treehugger Robot
4dd42cdd5f Merge "[FUI09] Expose NetworkStateSnapshot as system API" 2021-03-02 16:08:03 +00:00
junyulai
604fd08ca8 [FUI09] Expose NetworkStateSnapshot as system API
This is needed by NetworkStatsService and
NetworkPolicyManagerService to utilize the snapshots of
information of networks that grabbed from ConnectivityService.

Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I7e974ef7b23ba9ba6ee775eed9899b0c0e2eca55
2021-03-02 23:09:16 +08:00
Zim
c534503ac0 Add API to notify the system_server when app is blocked on I/O
The MediaProvider is also the ExternalStorageService and manages all
app I/O on external storage. While handling an apps request, the MP
might block on some long running computations e.g transcoding

Test: Manual
Bug: 170486601
CTS-Coverage-Bug: 181222557

Change-Id: I36b59eb84d8de6b73ed22e82df1093e946e53eab
2021-03-01 10:36:16 +00:00
Remi NGUYEN VAN
9200ec1579 Move Proxy, PacProxySelector out of Connectivity
PacProxySelector is tied to IProxyService, which does not have a formal
API.
Proxy is the interface with ConnectivityService, and all its methods are
public or module API.

Bug: 171540887
Test: m
Change-Id: I8ceba961a81661c3e11d8179955b594d3cab6ff7
2021-03-01 18:35:26 +09:00
Remi NGUYEN VAN
c15d99e6ff Split out the connectivity API surface
Split out connectivity APIs to connectivity module directories. This
prepares future move of the connectivity code into a mainline module,
but still keeps it implemented by framework-minus-apex for now: the API
stubs are moved to framework-connectivity.stubs, but the implementation
on device remains in the same place.

This allows moving the connectivity code in/out of APEX with minimal
changes.

BYPASS_INCLUSIVE_LANGUAGE_REASON=Moving files, can't modify released API

Bug: 171540887
Test: device boots, connectivity working

Merged-In: I21c42f032efa6c10e36c749df3183ce9679303a7
(cherry-pick from internal branch with API files conflicts)

Change-Id: I21c42f032efa6c10e36c749df3183ce9679303a7
2021-02-26 19:23:25 +09:00
Remi NGUYEN VAN
9f223cb0b4 Split out the connectivity API surface
Split out connectivity APIs to connectivity module directories. This
prepares future move of the connectivity code into a mainline module,
but still keeps it implemented by framework-minus-apex for now: the API
stubs are moved to framework-connectivity.stubs, but the implementation
on device remains in the same place.

This allows moving the connectivity code in/out of APEX with minimal
changes.

BYPASS_INCLUSIVE_LANGUAGE_REASON=Moving files, can't modify released API

Bug: 171540887
Test: device boots, connectivity working

Change-Id: I21c42f032efa6c10e36c749df3183ce9679303a7
2021-02-25 11:01:24 +09:00
Paul Hu
5b21c57c2a Merge "Expose NetworkWatchlistManager#getWatchlistConfigHash" am: 7d72edb937 am: 0727d8d08c am: 2e26868923
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1569981

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia8913c209a8c3f6387e99a32184580a562870735
2021-02-23 22:55:34 +00:00
Jin Seok Park
95e716b904 Merge "Change using Handler to using Executor" into sc-dev 2021-02-23 07:55:49 +00:00
paulhu
5119787a27 Expose NetworkWatchlistManager#getWatchlistConfigHash
Connectivity is becoming a mainline module in S and
ConnectivityService is used this API for getting watch list
configurations. However, Mainline modules are not allowed to use
non-formal APIs. Thus, make this API as module-lib api to support
the usage.

Bug: 172183305
Test: make update-api
Change-Id: I21ce5f158850892926b92cf6347c61a57ac95b72
2021-02-19 15:30:02 +08:00