Commit Graph

1787 Commits

Author SHA1 Message Date
Pavel Grafov
f00136e4ac Merge "Add app exemptions APIs for managing platform restriction exemptions" 2022-11-17 17:48:39 +00:00
Eghosa Ewansiha-Vlachavas
634989cd5f Add app exemptions APIs for managing platform restriction exemptions
Add DPM.setApplicationExemptions API along with exemption constants.
Add DPM.getApplicationExemptions API
Add corresponding methods in DPMS along with map of DPM exemptions
constants to app-ops.
Add permission to AndroidManifest to expose to CTS tests.

Bug: 246330879
Test: atest ApplicationExemptionsTest
Change-Id: I1271db694af4091ead951d0167edac55ace92f47
2022-11-16 11:11:35 +00:00
Bill Yi
e8829ce760 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: Iacb4abf339ee2798288a2c8d19420a1d719cd5c9
2022-11-15 23:38:09 -08:00
Jing Ji
4826749a10 Implement the foreground service type enforcement
Currently it's warning only.

To test with it:
adb shell am compat enable FGS_TYPE_PERMISSION_CHANGE_ID \
    com.my.package.name
adb shell am compat enable FGS_TYPE_DATA_SYNC_DISABLED_CHANGE_ID \
    com.my.package.name

Bug: 246792057
Bug: 254662046
Test: atest CtsAppFgsTestCases
Change-Id: I87a112dc9f254e5ea3231bddaf7f542a19cb7604
2022-11-15 05:18:27 -08:00
Michael Groover
7d819d45cd Add unaudited exported flag to exposed runtime receivers
Android T allows apps to declare a runtime receiver as not exported
by invoking registerReceiver with a new RECEIVER_NOT_EXPORTED flag;
receivers registered with this flag will only receive broadcasts from
the platform and the app itself. However to ensure developers can
properly protect their receivers, all apps targeting U or later
registering a receiver for non-system broadcasts must specify either
the exported or not exported flag when invoking #registerReceiver;
if one of these flags is not provided, the platform will throw a
SecurityException. This commit updates all the exposed receivers
with a new RECEIVER_EXPORTED_UNAUDITED flag to maintain the existing
behavior of exporting the receiver while also flagging the receiver
for audit before the U release.

Bug: 234659204
Test: Build
Change-Id: Iaead564629e58a747e481494ead501d30bc23079
2022-10-31 13:36:26 -05:00
Aishwarya Mallampati
5568769a3b Merge "Add setUserHandle and getUserHandle apis." 2022-10-23 14:56:45 +00:00
Jing Ji
38cde61727 Merge "ActivityManager#killBackgroundProcesses can kill caller's own app only" 2022-10-22 19:35:18 +00:00
Amos Bianchi
62e8cf3a70 Add Device Lock service to system server.
Bug: b/241442337
Bug: b/228907574
Test: service successfully starts
Test: atest DeviceLockUnitTests
Test: cts-tradefed run cts -m CtsDeviceLockTestCases

Change-Id: I928d697c4040168955090712547c973a9e7ff61c
2022-10-20 22:50:42 -07:00
Aishwarya Mallampati
4f83895959 Add setUserHandle and getUserHandle apis.
Bug: 247166170
Test: Basic testing, unittests
Change-Id: I4b9ab5f56a3ddac25ab8c335a84d86b5ba0fe932
2022-10-20 22:55:44 +00:00
Jing Ji
e8979d4c43 ActivityManager#killBackgroundProcesses can kill caller's own app only
unless it has the privileged permission KILL_ALL_BACKGROUND_PROCESSES.

Bug: 239423414
Test: atest CtsAppTestCases:ActivityManagerTest
Change-Id: I35d20539ffac055a6d61260445620f45584bd9c5
2022-10-17 17:20:06 -07:00
Jay Sullivan
c81b5c685e Merge "Enforce ADJUST_RUNTIME_PERMISSIONS_POLICY" 2022-10-17 20:25:33 +00:00
Kean Mariotti
9b2784ac64 Merge "Add bugreport pre-dump functionality" 2022-10-14 06:54:01 +00:00
Jay Thomas Sullivan
fd6643e366 Enforce ADJUST_RUNTIME_PERMISSIONS_POLICY
In updatePermissionFlags, we're calling clearCallingIdentity. And,
just after doing so, we're calling
enforceCallingOrSelfPermission(ADJUST_RUNTIME_PERMISSIONS_POLICY).
But, these two things don't really make sense together, because the
former nullifies the latter.

We could either:

1. Remove clearCallingIdentity but keep enforceCallingOrSelfPermission,
   or
2. Remove both

For security, this CL goes with the first option. But, doing so means
updatePermissionFlags now enforces ADJUST_RUNTIME_PERMISSIONS_POLICY.
And this breaks some CTS tests. To address this, we have to add
ADJUST_RUNTIME_PERMISSIONS_POLICY to the shell identity.

Bug: 190694761
Test: atest ActivityPermissionRationaleTest
Change-Id: I7031aebf69d9ec919334573b99eb6b7cb8be31d0
2022-10-13 14:12:46 -07:00
Grace Cheng
f724f5c0fe Merge "Adds LOCATION_BYPASS permission to Shell" 2022-10-13 20:08:53 +00:00
Kean Mariotti
615fb23f29 Add bugreport pre-dump functionality
Allow apps to trigger the dump of certain critical data, e.g. data stored in short
ring buffers that might get lost by the time a bugreport is requested.

Then, a bugreport request can specify whether the pre-dumped data should be used.

Fixes: 205138504
Test: atest com.android.os.bugreports.tests.BugreportManagerTest
Change-Id: I55c7b53e235ebf2baa694e6fdc4e4a321a459c8b
2022-10-12 11:49:44 +00:00
Grace Cheng
4d15a49e7c Adds LOCATION_BYPASS permission to Shell
Test: none

Change-Id: I4106647789b15793d04f81283954b06f6377cd54
2022-10-11 23:28:19 +00:00
Hyein Yu
4a61900115 Merge "Add FULL_ACCESS_CELL_BROADCAST_HISTORY permission to shell for CellBroadcast MTS test." am: 70d864fbf1 am: a7e087d1c8 am: 602d511bac
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2228942

Change-Id: If50745a2b18aef596ec55a8d14dcf506941eb5dd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-07 03:40:47 +00:00
Hyein Yu
602d511bac Merge "Add FULL_ACCESS_CELL_BROADCAST_HISTORY permission to shell for CellBroadcast MTS test." am: 70d864fbf1 am: a7e087d1c8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2228942

Change-Id: I9ba3595d7fd44d238ddaad8ba183cbeaa866b85c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-07 03:09:13 +00:00
Hyein Yu
a7e087d1c8 Merge "Add FULL_ACCESS_CELL_BROADCAST_HISTORY permission to shell for CellBroadcast MTS test." am: 70d864fbf1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2228942

Change-Id: Ic262b21c608f0e47d5700268036aaa761d39b33c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-07 02:40:34 +00:00
TreeHugger Robot
677d18848e Merge "Add updateLockTaskPackages API to ActivityTaskManager" 2022-09-29 20:39:30 +00:00
Chavi Weingarten
7f7ebbe448 Merge "Replace screenshots using internal displayToken with new API" 2022-09-29 19:00:19 +00:00
Hyein Yu
7f0ea0a6ad Add FULL_ACCESS_CELL_BROADCAST_HISTORY permission to shell for CellBroadcast MTS test.
Grant FULL_ACCESS_CELL_BROADCAST_HISTORY permissions to the shell identity for use within CellBroadcast MTS tests.

Bug: 236217191
Bug: 227422973
Test: atest com.android.cellbroadcastreceiver.compliancetests.CellBroadcastConfigTest
Change-Id: Ief5a4c168968b4dc8c9cf7cc071618d41c23d220
2022-09-26 06:18:26 +00:00
Bill Yi
d81ac8c425 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: Ibdc9afa97d1e151240b30d2df2ff35592d206c7c
2022-09-23 12:30:03 -07:00
Bill Yi
f823d7fb14 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I199273e18013ca96f618e08b7be7cdc3e0d28945
2022-09-23 03:51:21 -07:00
Chavi Weingarten
5ae620bd98 Replace screenshots using internal displayToken with new API
In order to remove SurfaceControl.getInternalDisplayToken, we need to
replace all usages of it. The primary use is for screen capturing since
you could call directly into SF via ScreenCapture.captureDisplay if you
had a display token. However, this isn't scalable with multi-display
since you need to be explicity which display to capture.

The change provides a new API into WMS to capture a display using the
displayId. This is still a privilege call so only processes with
READ_FRAME_BUFFER can use it. In most cases, the replacement for now is
to use DEFAULT_DISPLAY, but they can be modified later to send the
desired display.

Test: power + volume down
Test: assistant screencapture
Test: SurfaceViewTests
Bug: 242714168

Change-Id: I9b406b699d48ae34c6ffd91c34941f1580f38d28
2022-09-22 17:53:01 +00:00
TreeHugger Robot
3226bed7fd Merge "Introduce SystemAPI MediaProjectionGlobal" 2022-09-16 16:19:23 +00:00
Chavi Weingarten
612711c345 Introduce SystemAPI MediaProjectionGlobal
This API can be used from calls outside applications to create a virtual
display for mirroring. The permission checks in system server are still
in place so the caller must have CAPTURE_VIDEO_OUTPUT permission. This
class is intented to be used by systems that to stream device content,
but not from an application. In most cases, this will be called from
Shell or a system application.

Test: MediaProjectGlobalTest
Bug: 237664947
Change-Id: I43f79c83db7c82c0b682ef174fb1a5ab83795489
2022-09-16 13:13:04 +00:00
Chavi Weingarten
2b7f2aee30 Migrate screen capture code to ScreenCapture file
Test: ScreenshotTests
Bug: 242714168
Change-Id: I8061f1717cc4e293ee07672d6d415c2c36010ccd
2022-09-14 15:35:46 +00:00
Yanli Wan
e95e91730e Add updateLockTaskPackages API to ActivityTaskManager
The API will be available in CTS so that we can use it directly instead
of calling it from other system components.

Bug: 240602359
Test: Build & call the API from CTS
Change-Id: I8aa6ee85adb62cda67479c7213d2bc022acd0eec
2022-09-08 17:50:11 +00:00
Bill Yi
1fc656cd29 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I0e54a02266cb2fc303890fe1bf0f95d59344e084
2022-09-03 18:41:00 -07:00
Bill Yi
1501777d45 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I4c93630a560f9410c90c3aefe1ad7fa8e385e3b1
2022-09-02 21:16:31 -07:00
Bill Yi
3f34f3fdea Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I1a05b3a6bf254f8a9d808f708d0bf90fbe5007cc
2022-09-02 19:42:53 -07:00
Bill Yi
0dfc0faa35 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I63f98c9af1c05e4f4e7e208a8d679dbb29b521f1
2022-08-25 03:29:02 -07:00
Bill Yi
165338ca71 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I40fb7826128a9388ea4986808d12a4eec66f2c83
2022-07-14 04:28:15 -07:00
Yohei Yukawa
b869c78380 Protect isInputMethodPickerShown() with TEST_INPUT_METHOD permission
IInputMethodManager#isInputMethodPickerShownForTest() was introduced
in Android P (API 28) to verify IME picker visibility in CTS [1].

To make it clear that that IPC method must be available only for
special testing purpose, this CL introduces an @hide permission

   android.permission.TEST_INPUT_METHOD

and requires it in

   InputMethodManagerService#isInputMethodPickerShownForTest().

This CL grants that permission to the shell process hence CTS tests
can still access to the corresponding test API by using
UiAutomation#adoptShellPermissionIdentity().

 [1]: I4e21625c32a0ca1abc740229efb3c7fcd97141cc
      eb5706183f

Bug: 237317525
Test: atest CtsInputMethodTestCases
Test: Manually verified as follows.
 1. adb logcat -b events | grep 237317525
 2. atest CtsInputMethodTestCases:InputMethodManagerTest#testIsInputMethodPickerShownProtection
Ignore-AOSP-First: For a security fix
Change-Id: Ie79a3e9d41ce22605ae083594d639c37d08b7def
2022-07-12 19:03:26 -07:00
Bill Yi
7d54c9f55a Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I920e86694921ffb24b63145ffa547a79a6c5fbde
2022-07-03 13:00:47 -07:00
Jimmy Chen
318410fe93 Merge "p2p: add CONFIGURE_WIFI_DISPLAY permssion for P2P test" am: 1bf4072c78 am: a29505af31 am: a6b28ca5eb am: f1223c1738 am: 5a6c0e7802
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2115076

Change-Id: Icd950eb147b5b0828dbed889cdf3b4f91a0df85d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-16 02:08:54 +00:00
Jimmy Chen
a6b28ca5eb Merge "p2p: add CONFIGURE_WIFI_DISPLAY permssion for P2P test" am: 1bf4072c78 am: a29505af31
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2115076

Change-Id: Id14c36a6cdfc6b01e97846c38238f14fc231cfe0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-16 01:44:21 +00:00
Jimmy Chen
a29505af31 Merge "p2p: add CONFIGURE_WIFI_DISPLAY permssion for P2P test" am: 1bf4072c78
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2115076

Change-Id: Ifc3ffd42afdfdd3c887251484490661a5100b02e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-16 01:18:58 +00:00
Jimmy Chen
1bf4072c78 Merge "p2p: add CONFIGURE_WIFI_DISPLAY permssion for P2P test" 2022-06-16 00:26:38 +00:00
Jimmy Chen
f46b780f16 p2p: add CONFIGURE_WIFI_DISPLAY permssion for P2P test
Bug: 230699791
Test: atest android.net.wifi.cts.ConcurrencyTest#testP2pSetWfdInfo
Change-Id: Ic25dc6d7b18bad38863acfd32d839155da28141b
2022-06-08 15:38:18 +08:00
Bill Yi
f93db9d41f Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I3acfd507af097c2b0924114681b9acd924bdcdcd
2022-06-05 20:14:42 -07:00
Bill Yi
7d7855e502 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I90089bdc5aa6a00be7e69cf324aca3e6f435e954
2022-06-05 18:54:09 -07:00
Neil Fuller
1aa92e3754 Merge "Add a Y2038 check into the time_detector" am: 808b9f1b73
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1994850

Change-Id: I791a25c36760a8828eea27e11c5dfc5bdd9e8d0b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-10 20:56:13 +00:00
Neil Fuller
808b9f1b73 Merge "Add a Y2038 check into the time_detector" 2022-05-10 11:44:09 +00:00
Neil Fuller
2ff5ec1aad Add a Y2038 check into the time_detector
Add a Y2038 check into the time_detector and add infrastructure to allow
command-line testing to confirm it works.

This is before removing a Y2038 check from NITZ parsing code in the
telephony process. After this change, Androdi will consistently block
>= Y2038 suggestions, not just time signals that come in via telephony.

The initial checks attempt to limit the restriction to devices with
32-bit ABIs, since the main issue we're aware of is that time_t is a
32-bit signed int under bionic, hence there could be issues with that
type in 32-bit processes on 32-bit / mixed 32/64-bit devices.

Bug: 204193177
Test: adb shell cmd time_detector suggest_network_time --reference_time 2480587 --unix_epoch_time 1646473966056
Test: Run with 32-bit + 64-bit only builds, inspect adb shell dumpsys time_detector
Merged-In: Ib9d6472f5ca7a62d59b3224f1845846f99a0b52d
Change-Id: Ib9d6472f5ca7a62d59b3224f1845846f99a0b52d
2022-05-10 10:01:58 +00:00
The Android Open Source Project
7d5bd6e8ec Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I3985c46e6747989fe41b64ea5f10c4b4281b51d3
2022-05-08 18:59:01 +00:00
Neil Fuller
68d98c0673 Merge "Add a Y2038 check into the time_detector" into tm-dev-plus-aosp am: 4b8d4c830c am: c37cbfd6c4 am: 9ee897724d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18142264

Change-Id: I5e816029c9978d1a313ddba9a2904d8ac9dc79ba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-07 01:26:53 +00:00
Neil Fuller
4b8d4c830c Merge "Add a Y2038 check into the time_detector" into tm-dev-plus-aosp 2022-05-06 16:53:29 +00:00
Treehugger Robot
95671fc41a Merge "Add USE_CUSTOM_VIRTUAL_MACHINE permission to Shell" am: 87e124332d am: ea4f257004 am: e0ceb9de72 am: 9fa6409399 am: d28e148bd9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2081684

Change-Id: I2c3d0fe1279cf740ab6e85afeed1df1325472d9c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-05 03:31:58 +00:00