Commit Graph

242 Commits

Author SHA1 Message Date
Sung Min Lee
a90b1fcaca Add CAPTURE_AUDIO_OUTPUT permission required for GTS test
GtsDialerAudioTestCases require this privileged permission for testing in GTS.

Bug: 157243201
Test: run gts -m GtsDialerAudioTestCases
Change-Id: I32516e5dcf966b05cfb8ab4956a0cdb183298f2a
2020-06-02 21:24:59 -07:00
Wei Wang
96f7636149 Add LOCATION_HARDWARE permission to shell.
A few location System APIs require LOCATION_HARDWARE permssion. Adding
this permission to shell so CTS tests can adopt this permission.

Bug:154347471

Test: atest PrivilegedLocationPermissionTest
Change-Id: I4abe4dc044ec4a3ab62352cc0f4a1726bebac633
2020-05-27 17:53:31 -07:00
TreeHugger Robot
f49fa1a9ea Merge "Add support for TvInputManager.acquireTvInputHardware CTS" into rvc-dev 2020-05-27 04:39:45 +00:00
TreeHugger Robot
6351c72746 Merge "Revert "Add a null home activity to Shell.apk"" into rvc-dev 2020-05-18 17:28:46 +00:00
Amy Zhang
5f8498bcf1 Add support for TvInputManager.acquireTvInputHardware CTS
1. Add a test api in TvInputManager to add hardware device for testing
2. Add Shell permission for TV_INPUT_HARDWARE
3. Add TUNER_RESOURCE_ACCESS permission for TvInput Framework.

Test: atest android.media.tv.cts
Bug: 155114656
Change-Id: I227f13cbf14532d8732729412ae9c2518755ef02
2020-05-14 17:37:52 -07:00
Treehugger Robot
fbd4a6f80a Add day-night-mode permission to Shell.
Without the permission "adb shell cmd uimode night <mode>" doesn't work.
Adding the permission to the AndroidManifest file so the shell command
will work.

Bug: 155584597
Test: run `adb shell cmd uimode night <no|yes|auto>`
Change-Id: Ic444f3351cb130d24a2794284c6bf8709c80712c
(cherry picked from commit a85cc22044)
2020-05-12 15:13:26 +00:00
Hai Zhang
a4b344c576 Grant ACCESS_SHARED_LIBRARIES permission to Shell for testing.
Bug: 154348597
Test: presubmit
Change-Id: Ic721288e8f1e1a1f255eca95b2efb7b6e0c7c83b
2020-05-08 14:14:09 -07:00
Isaac Chen
539298c1b9 Revert "Add a null home activity to Shell.apk"
This reverts commit 6b1c4a9e09.

Bug: 149226068
Bug: 149307007
Bug: 149780604
Test: $ lunch aosp_crosshatch-userdebug; m
      # flash and boot on a crosshatch
      # Settings -> Apps & notifications -> Default apps -> Home apps
      # Only Quickstep home is there; no Shell home any more
      $ lunch csi_arm64-userdebug; m
      # flash the resulted system.img on a crosshatch and boot
      $ atest DeviceHealthTests # all passed
Change-Id: I927b7dae779da25589f2198e0480c0f2a788a7e4
2020-05-08 14:35:24 +08:00
Eugene Susla
64c88c077e Fix auto revoke installer whitelist APIs
Test: ensure APIs work
Bug: 153607914
Change-Id: Ia477d26438037fed0e39758200ded0e0fc1e96bd
2020-05-07 16:02:20 -07:00
Todd Kennedy
fb590035e1 Merge "Define permission for installer API v2" into rvc-dev 2020-03-26 21:50:17 +00:00
Todd Kennedy
66ed8dff37 Define permission for installer API v2
The package installer v2 APIs were marked as @SystemApi merely as
a convenience for development. These APIs may change in the next
version of Android and their usage must be strictly controlled.

Bug: 151716357
Test: Manual. Use old Shell and see that incremental installation fails with a SecurityException
Test: Manual. Request INSTALLER_V2 permission for shell and see that incremental installation succeeds
Change-Id: I9612dc145eadda20083bcc43e7a35ef3cd90aa40
2020-03-25 12:57:05 -07:00
shubang
d7a3204c4e Add tuner permissions to Shell
So we can test system APIs in cts.

Bug: 150952758
Test: atest android.media.tv.tuner.cts.TunerTest
Change-Id: Ife5a5f712cdf3d3c2e5dd747fa1d3bc8c165b85b
2020-03-23 19:41:35 -07:00
Roshan Pius
c551b3386a Shell: Allow usage of wifi usability score APIs
This permission is needed for wifi CTS tests.

Is the minimally scoped permission that needs to be added?
- Yes, this only allows the app to influnce wifi vs lte network
selection algorithm.

What options did you explore that did not need this permission?
- Without this permission, it would be impossible to test these API's:
WifiManager.setWifiConnectedNetworkScorer()
WifiManager.clearWifiConnectedNetworkScorer()
WifiManager.clearWifiConnectedNetworkScorer()
WifiManager.addOnWifiUsabilityStatsListener()

Bug: 150236894
Test: Device boots up.
Change-Id: Ic173e44ab818cdfecebde80715ddaec347019db6
2020-03-19 13:14:50 -07:00
Eric Laurent
e23ed86890 Add MODIFY_DEFAULT_AUDIO_EFFECTS permission to shell
Add MODIFY_DEFAULT_AUDIO_EFFECTS permission to shell which
is needed to run GTS tests on @systemApis for
audio effects control.

Bug: 148703417
Test: run gts -m GtsAudioTestCases -t com.google.android.audio.gts.DeviceEffectTest#testCreateDeviceEffect
Change-Id: Iba579001aeffd85743850727135a6f536579ea17
2020-03-18 12:07:57 -07:00
Ruslan Tkhakokhov
547978ef1a Grant MODIFY_SETTINGS_OVERRIDEABLE_BY_RESTORE permission to Shell
Bug: 151096665
Test: presubmit

This is needed for CTS tests to be able to call
Settings.System.putString(..., overrideableByRestore=true)

Change-Id: I7eb64df187bd59509067130c31c2e804f75d9830
2020-03-11 00:13:14 +00:00
David Su
7637ab6f52 Merge "Revert "Shell: Grant NETWORK_STACK permission for CTS"" into rvc-dev 2020-03-10 21:24:51 +00:00
Lorenzo Colitti
dcfaed6248 Revert "Shell: Grant NETWORK_STACK permission for CTS"
This reverts commit 8d14f5162a.

Bug: 150236894
Reason for revert: It is not appropriate from a security perspective for the shell to have this permission.

Change-Id: I5b933fe6850ebd5b5f230c16722357ead4ec4286
2020-03-09 08:30:06 +00:00
Tej Singh
0e4f868bb2 Merge "Make pull atom permission accessible to shell" into rvc-dev 2020-03-04 21:58:36 +00:00
Tej Singh
924910db90 Make pull atom permission accessible to shell
Make REGISTER_STATS_PULL_ATOM permission available to Shell to allow
testing it in gts.

Is the minimally scoped permission that needs to be added?
Yes, it is the only permission to register pulled atoms.

What options did you explore that did not need this permission?
I explored expanding the permission to be development in addition to
privileged, and giving the permission to gmscore. However, this solution
was recommended to me by the GTS team. If there are better ways to enable
testing the API in GTS, I am open to feedback.

Test: atest GtsStatsdHostTestCases
Bug: 150329323
Change-Id: I103d937842beaa2d918181b1a952d27179411dcc
2020-03-03 23:36:08 +00:00
David Su
8d14f5162a Shell: Grant NETWORK_STACK permission for CTS
Grant NETWORK_STACK permission to the shell so
that CTS can use the shell identity to call
APIs protected with this permission.

Bug: 150236894
Test: atest android.net.wifi.cts.WifiManagerTest#testGetCountryCode
Change-Id: I4f93e76bcda83c528f1f2c7bcf800965886ea8da
Merged-In: I4f93e76bcda83c528f1f2c7bcf800965886ea8da
(clean cherry pick from AOSP)

Change-Id: I1502b2d53d3d43cce36ba6563533cd3560ff8747
2020-03-03 15:24:46 -08:00
Roshan Pius
75dbcfff98 Shell: Allow retrieval of wifi network credentials
This permission is needed for some wifi CTS tests.

Is the minimally scoped permission that needs to be added?
- Yes, this only allows the retireval of the saved wifi network
credentials on the device.

What options did you explore that did not need this permission?
- Possibly creating a UI to ask for manual entry of network credentials.
But, that would not let us do automated CTS tests (will need to become
CTS verifier tests then).

Bug: 150236894
Test: atest android.net.wifi.cts.WifiNetworkSpecifierTest
Change-Id: I6881003510191f667950be1ab27a5399fe3914b4
2020-03-03 09:26:27 -08:00
Paul Murphy
1460b76a02 Add COMPANION_APPROVE_WIFI_CONNECTIONS to shell permissions
1. This is a minimally scoped permission (which allows the new WiFi API's
to silently connect to a wifi network).
2. I explored writing a GTS test instead of a CTS test, with the idea being that it would run inside the Android Auto user. Unfortunately the API under test requires two permissions, MANAGE_COMPANION_DEVICES and COMPANION_APPROVE_WIFI_CONNECTIONS. Android Auto will only have COMPANION_APPROVE_WIFI_CONNECTIONS, and if I elevate to Shell privileges the test will have MANAGE_COMPANION_DEVICES, but not COMPANION_APPROVE_WIFI_CONNECTIONS. Beyond this, I've been told that it's better for us to test this API in CTS than what it is under GTS.

The addition of the permission to androis.os.shell could theoretically allow it to connect to a WiFi network using the new WiFi APIs without the user being prompted. Android R will still allow the legacy WiFi API's which also allow wifi connections without users being prompted without this permission. Android Auto requires the new API's as they better handle cases of connecting to WiFi networks with no internet access. The old API's will not always result in fallback to LTE, whereas the new ones do that.

Test: Unit test in separate change.
Change-Id: Ifd8ae6b7e53307ea8973406fdefa468dfa679bda
Bug: b/147748710
2020-02-28 21:58:08 +00:00
Shafik Nassar
15163807bd Merge "Revert "Request MANAGE_EXTERNAL_STORAGE permission"" am: e21d0ea642 am: 4ec80cc67d am: 4ebbdb6b22
Change-Id: I09fcfa6eefff3c500abc743918d8c625bb92cf71
2020-02-17 11:31:39 +00:00
Shafik Nassar
e21d0ea642 Merge "Revert "Request MANAGE_EXTERNAL_STORAGE permission"" 2020-02-14 13:35:34 +00:00
Varun Shah
0cbb6b63ee Obfuscate visibility of notification-related events.
UsageStats will return obfuscated NOTIFICATION_SEEN or
NOTIFICATION_INTERRUPTION events to callers of #queryEvents
and #queryEventsForUser if they don't hold the MANAGE_NOTIFICATIONS
permission.

Additionaly, refactor the query API in UsageStats to take in flags as
defined in UsageEvents to make future obfuscation/visibility parameters
cleaner.

Also, add the MANAGE_NOTIFICATIONS permission to shell for CTS test.

Bug: 144724524
Test: atest android.app.usage.cts.UsageStatsTest
Test: atest com.android.server.people.data.UsageStatsQueryHelperTest
Test: atest android.content.pm.cts.shortcutmanager.ShortcutManagerUsageTest
Change-Id: I118de7e589ac8dd5924d3740c70903fa484b79b5
2020-02-13 12:01:13 -08:00
Yuliya Kamatkova
4d5b0be481 Merge "Restrict visibility of LOCUS_ID_SET events." 2020-02-13 01:05:09 +00:00
Yuliya Kamatkova
fea62a512b Restrict visibility of LOCUS_ID_SET events.
UsageStats will not return LOCUS_ID_SET events to callers
of #queryEvents and #queryEventsForUser if they don't have visibility.

Bug: 148821246
Test: manual, atest tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest
Change-Id: Ic904a97e66775ef63bc8b84e67e8f430b2a4121b
2020-02-12 11:20:22 -08:00
Shafik Nassar
7a49c869b8 Revert "Request MANAGE_EXTERNAL_STORAGE permission"
This reverts commit 349b2c11e9.

Reason for revert: This change was already made in aosp/1205113 and now Shell requests the permission twice.

Change-Id: Ice5522d7095f9b0dbc96c2ff31a976bfdd942c5a
2020-02-12 16:50:13 +00:00
Treehugger Robot
668daf0341 Merge "Give CONTROL_DEVICE_LIGHTS permission to the shell" 2020-02-11 21:55:09 +00:00
Robin Lee
9be54b5b67 Give CONTROL_DEVICE_LIGHTS permission to the shell
Bug: 144979010
Bug: 144978691
Test: atest LightsManagerTest
Change-Id: I2924460c76ce4545c9c3dd3875456b936fe3fc69
Merged-In: I2b4224e79e013bae27ee068b0a0898b5afa5489a
2020-02-11 17:46:40 +00:00
Chris Ye
473c84ff4c Access to Device Vibrator State
Add API to access vibrator state and vibrator state listener.

Bug: 135949568
Change-Id: I96636b432d581cea03a9fc9fecba4c08045f5006
2020-02-11 00:02:37 +00:00
Automerger Merge Worker
d99acdae3b Merge "Add a null home activity to Shell.apk" am: fd2ba540df am: 24f93a2b48 am: 26f49e7b75
Change-Id: I77be28465d8fe8439877859e3e630103efe69c4f
2020-02-07 09:03:13 +00:00
Treehugger Robot
fd2ba540df Merge "Add a null home activity to Shell.apk" 2020-02-07 07:59:39 +00:00
Isaac Chen
6b1c4a9e09 Add a null home activity to Shell.apk
In configurations where AOSP Settings.apk is not included, there might
not be any home activity. E.g. CSI doesn't have Settings.apk.

This CL adds a null home activity to Shell.apk, which is in CSI,
so the framework can be in a sane state. Without such null home
activity in CSI, package manager fails to install any APKs.

Bug: 148044842
Test: $ lunch csi_arm64-userdebug; m -j
      # Flash CSI to a Pixel (with AVB disabled) and reboot
      $ m DeviceHealthChecks
      $ adb install $OUT/testcases/DeviceHealthTests/arm64/DeviceHealthTests.apk
      Performing Streamed Install
      Success

Change-Id: I87999e30298bbe42af64f28e88fc6dc5975f1ca3
2020-02-07 12:50:39 +08:00
Automerger Merge Worker
29097108e3 Merge "Add permissions for using PlatformCompat methods" am: 7202e904c9 am: 69ca2fcfa0 am: 9e28d2118f
Change-Id: Id9b74f1f74f3e4efaaa3e1657a64b7f8d229cc01
2020-02-06 14:18:16 +00:00
Andrei-Valentin Onea
7202e904c9 Merge "Add permissions for using PlatformCompat methods" 2020-02-06 13:40:34 +00:00
Andrei Onea
26559bcb40 Add permissions for using PlatformCompat methods
- READ_COMPAT_CHANGE_CONFIG is required to read the current state of the
config
- LOG_COMPAT_CHANGE is required to log the status of a compat change for
a package and/or uid to statsd
- OVERRIDE_COMPAT_CHANGE_CONFIG is required to add overrides

The permissions must be signature|privileged, as there are already
examples of code which this would not be sufficient (e.g.
MediaProvider).

This is a re-landing of https://r.android.com/1209240, which was
reverted due to http://b/142942524. The actual fix was done in
http://ag/10234812.


Bug: 142650523
Test: atest PlatformCompatTest
Test: atest PlatformCompatPermissionsTest
Change-Id: Ie9429477c9a1725b5cb67756787bf742038e5d2b
2020-02-06 12:22:42 +00:00
Nikita Ioffe
a656dd889d Merge "Grant shell REBOOT permission" 2020-02-04 23:01:44 +00:00
Nikita Ioffe
bf19417b0d Grant shell REBOOT permission
Shell already can reboot a device (via `adb reboot` command). This
change allows shell to also trigger a reboot logic inside the
system_server.

Additionally, it allows to CTS test PowerManager.reboot API.

Test: adb shell svc reboot
Change-Id: I4545c4f3587fee2840a00648c569f75bb57501fc
Merged-In: I4545c4f3587fee2840a00648c569f75bb57501fc
2020-02-03 23:35:24 +00:00
Nikita Ioffe
40ac77aac5 Merge "Grant shell REBOOT permission" 2020-02-03 23:35:01 +00:00
Hai Zhang
e244583ef0 Add UPGRADE_RUNTIME_PERMISSIONS permission to support testing.
Bug: 136503238
Test: presubmit
Merged-In: I7e40296120e18f2dfbbf04b5ae9d148724afa920
Change-Id: I7e40296120e18f2dfbbf04b5ae9d148724afa920
2020-02-03 13:05:28 -08:00
Hai Zhang
934fbdbf05 Add UPGRADE_RUNTIME_PERMISSIONS permission to support testing.
Bug: 136503238
Test: presubmit
Change-Id: I7e40296120e18f2dfbbf04b5ae9d148724afa920
2020-02-03 13:04:43 -08:00
Nikita Ioffe
1ef721380a Grant shell REBOOT permission
Shell already can reboot a device (via `adb reboot` command). This
change allows shell to also trigger a reboot logic inside the
system_server.

Additionally, it allows to CTS test PowerManager.reboot API.

Test: adb shell svc reboot
Change-Id: I4545c4f3587fee2840a00648c569f75bb57501fc
2020-02-03 10:56:31 +00:00
Automerger Merge Worker
331dc63204 Merge "Add LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH into Shell permission" am: a3243e8e6e am: 535739cdd7 am: 16d8f3ccc6
Change-Id: I57eba979ba1146a349c2cd85f0e5d5129006e398
2020-01-31 16:57:19 +00:00
sqian
dfdee636e3 Add LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH into Shell permission
> Is the minimally scoped permission that needs to be added?
This is a minimal permission for always listening to signal strength.

> What options did you explore that did not need this permission?
CTS is required by API council; Telephony CTS is using shell to have
system permission. I don't see other options.

Integrate the callback of LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH

Test: CTS; https://paste.googleplex.com/5811446241820672
Bug: 147322848
Change-Id: Id5afd261a7f00c25e3af3558f30fb92aad42f060
2020-01-30 14:14:43 -08:00
Varun Shah
01f6f26b54 Restrict visibility of SHORTCUT_INVOCATION events.
UsageStats will not return SHORTCUT_INVOCATION events to callers
of #queryEvents and #queryEventsForUser if they don't have visibility,
as defined by ShortcutService#hasShortcutHostPermission.

Also, add ACCESS_SHORTCUT permission to shell for CTS test and add the
ShortcutManagerUsageTest to postsubmit.

Bug: 145549490
Test: atest android.app.usage.cts.UsageStatsTest
Test: atest android.content.pm.cts.shortcutmanager.ShortcutManagerUsageTest
Change-Id: I2a69f061c35c31035a5d0381ab2f42029ec4fffc
2020-01-29 11:28:22 -08:00
Steven Ng
733ac0d946 Grant READ_DREAM_STATE & WRITE_DREAM_STATE permissions to shell
This is required for ambient display tests

Bug: 147874708
Test: Run newly added ambient display tests.
Merged-In: I61c28e15c4e5c3d0ffee4137ecb86e33f7e8f64d
Change-Id: I26ab1cd48816ddb3aa8b30708726a3e1a3a20b9a
2020-01-29 09:54:19 +00:00
Automerger Merge Worker
d20055a414 Merge "Request MANAGE_EXTERNAL_STORAGE permission" am: 3dca32381d am: f5534b4e10 am: b2082cb20f
Change-Id: I26e6110df3d88d64c6ed7ad2b6b1c2be824292be
2020-01-28 15:29:59 +00:00
Zim
349b2c11e9 Request MANAGE_EXTERNAL_STORAGE permission
With the deprecation of WRITE_MEDIA_STORAGE in R. Apps should migrate
to requesting MANAGE_EXTERNAL_STORAGE permission

Test: m
Bug: 144914977
Change-Id: Ie42b5ceaf01111a1d3151f697ce173ddc3c7fd9b
2020-01-24 22:45:09 +00:00
Robin Lee
413dd36486 Give CONTROL_DEVICE_LIGHTS permission to the shell
Bug: 144979010
Bug: 144978691
Test: atest LightsManagerTest
Change-Id: I2b4224e79e013bae27ee068b0a0898b5afa5489a
2020-01-24 21:57:36 +01:00