Commit Graph

953 Commits

Author SHA1 Message Date
Nikita Ioffe
40ac77aac5 Merge "Grant shell REBOOT permission" 2020-02-03 23:35:01 +00: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
TreeHugger Robot
092993a72d Merge "Remove legacy-flow no-op variables: max, realMax and realProgress" 2020-01-27 01:34:57 +00:00
Abhijeet Kaur
d501142a64 Remove legacy-flow no-op variables: max, realMax and realProgress
Legacy onProgress aidl listener callback function used to take 2 params:
progress and max. So, the client had to calculate the percentage
progress. This legacy onProgress method is removed.

Now dumpstate sends the actual progress in percentage without requiring
the client to calculate it.

Bug: 123617758
Test: Takes interactive bugreport as expected. And shows progress
notification as expected.

Change-Id: Ic5a355cc886e51b964f73c227f5f657173e99420
2020-01-26 21:43:00 +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
Steven Ng
38e58dea36 Grant READ_DREAM_STATE & WRITE_DREAM_STATE permissions to shell
This is required for ambient display tests.

NOTE: This CL is manually cherry-picked from aosp/1215115 due to
merge conflict.

Bug: 147874708
Test: Run newly added ambient display tests.
Change-Id: I61c28e15c4e5c3d0ffee4137ecb86e33f7e8f64d
2020-01-23 14:22:09 +00:00
Hall Liu
6392e2548d Merge "Add system service for accessing SystemConfig" 2020-01-20 21:34:28 +00:00
shafik
285becce88 Merge "Make com.android.shell request MANAGE_EXTERNAL_STORAGE" am: 3095c56b3a am: 74c3cd9cca
am: fdca31f41d

Change-Id: I4a987e289e9cc362d8a5637f17a37d8ec74fee69
2020-01-10 12:12:25 -08:00
Treehugger Robot
3095c56b3a Merge "Make com.android.shell request MANAGE_EXTERNAL_STORAGE" 2020-01-10 19:39:53 +00:00
shafik
ae42afc937 Make com.android.shell request MANAGE_EXTERNAL_STORAGE
This helps in testing using adoptShellPermissionIdentity.
Also, as a nice side-effect, it solves the problem where Settings app
crashes if no packages are requesting the permission.

Bug: 146778323
Fixes: 147434040
Test: device boots
Change-Id: I0982f854ad8260cab247882d04aea9bdcdf5d586
2020-01-10 16:16:29 +00:00
Hall Liu
b38ad5f563 Add system service for accessing SystemConfig
Add SystemConfigService and associated AIDLs and permissions for
accessing SystemConfig. The service returns values obtained from a
static instance of com.android.server.SystemConfig.

Bug: 143112379
Test: atest SystemConfigTest
Change-Id: I1a863ae9f53db21d698376008e5b1da83309b141
2020-01-07 15:17:40 -08:00
Santos Cordon
c4fd8e6558 Add permissions check for brightness changes via shell.
Also
- Adjusts some code structure around DisplayManagerShellCommand.
- Remove clearIdentity() on other display shell commands.

Test: Run all shell options for display in adb root and unroot.
Test: Verify that 'adb shell cmd display set-brightness *' still works.
Test: atest DisplayTest
Bug: 144920149
Change-Id: I9c6f584537a89a99f38871e280796fe66feeb312
2020-01-02 13:34:48 +00:00
Bill Yi
cf93781ddd Import translations. DO NOT MERGE
Change-Id: I2efdada28fd6f83f25a46f4dcde4f1e93768b2d4
Auto-generated-cl: translation import
2019-12-24 09:20:12 -08:00
Mark Chien
30642b395c Merge "Add TETHER_PRIVILEGED permission to shell for CTS test." 2019-12-19 04:59:02 +00:00
Felka Chang
71e3efed54 Add query functionalities to query all of crates
Once the application called Context.getCrateDir(), the crates root
directory is also created. The application can mkdir directory under the
crates root. Each child directory in crates root is one crate.

Each crate information is descibed by CrateInfo. CrateInfo contains
the following information.
* Label:
    It is used to display text to the users.
    Default is the folder name.
* Expiration:
    When the system needs more space. The system will clean the files
    in the crates according to the expired or not.
    Default is 0.

Test: atest \
    CtsOsTestCases:android.os.storage.cts.CrateInfoTest \
    CtsOsTestCases:android.os.storage.cts.StorageCrateTest \
    CtsOsTestCases:android.os.storage.cts.StorageStatsManagerTest

Bug: 141660526

Change-Id: Icdc8123c481ef7c5b4fd68ffcfd334ffbfc9d655
2019-12-18 23:04:15 +08:00
Abhijeet Kaur
b7518de1b4 Add Light/Dark theme for bugreport warning dialog
Previously added "android:theme="@android:style/Theme.
DeviceDefault.DayNight" to the application tag in this manifest file to
enable dark theme for bugreport info.
BugreportWarningActivity is nested within this application tag, so
assumed all the child tags to have DayNight theme.

android:theme="@android:style/Theme.DeviceDefault.Dialog.Alert" shows
the dialog always as Dark mode.

android:theme="@android:style/Theme.DeviceDefault.Light.Dialog.Alert"
shows the dialog always as Light mode.

This bug is not easily notice-able as "Do not show this again" checkbox
is checked by default for this dialog. Unless one wipes data partition,
this dialog doesn't come up even after flashing new builds.

Bug: 141663298
Bug: 146400225
Test: Normal (light mode) Trigger interactive/full/wifi bugreport.
      Click on bugreport finished "Share" notification.
      Light mode warning dialog should appear. (with white background)
      Uncheck the "Do not show this again" checkbox to test with dark
      mode.
Test: Go to Settings. Turn on Dark theme.
      Trigger interactive/full/wifi bugreport.
      Click on bugreport finished "Share" notification.
      Dark mode warning dialog should appear. (with dark grey background)

Merged-In: I200c592608261665e4c2416303f573522c6bc59a
Change-Id: I200c592608261665e4c2416303f573522c6bc59a
(cherry picked from commit 43bbe8a2fc)
2019-12-18 14:09:44 +00:00
Abhijeet Kaur
6a8f0fb9a5 Fix bugreport warning dialog
This bug was introduced when fixing dark theme for bugreport dialogs.

Bug: 135446537
Bug: 146400225
Test: manually (both in light and dark theme)
Merged-In: Ib8c16d068c00632d009033c2eab7d2d6cb7e4eea
Change-Id: Ib8c16d068c00632d009033c2eab7d2d6cb7e4eea
(cherry picked from commit f90de9746b)
2019-12-18 14:09:17 +00:00
markchien
9fe658adc3 Add TETHER_PRIVILEGED permission to shell for CTS test.
Grant TETHER_PRIVILEGED permissions to the shell identity
for use within CTS tests.

Bug: 145490751
Test: atest CtsTetheringTest
Change-Id: Ifad265cdc5e0b1b1b2fa8f4f79eeb7dd18493624
Merged-In: Ifad265cdc5e0b1b1b2fa8f4f79eeb7dd18493624
2019-12-17 13:30:26 +00:00
markchien
a2ce459f65 Add TETHER_PRIVILEGED permission to shell for CTS test.
Grant TETHER_PRIVILEGED permissions to the shell identity
for use within CTS tests.

Bug: 145490751
Test: atest CtsTetheringTest
Change-Id: Ifad265cdc5e0b1b1b2fa8f4f79eeb7dd18493624
2019-12-17 21:24:23 +08:00
Jordan Liu
4c0e2a4957 Add CBR and shell to telephony permission
Bug: 135956699
Test: send test broadcast, atest CellBroadcastIntentsTest
Change-Id: I5e7b28bb8f347f61b781b017e72194a7cf0d7037
2019-12-04 15:00:02 -08:00
Tyler Gunn
bf7be6def1 Merge "Car mode InCallService changes." am: 1d4fcf1703 am: 920d3e0fbf
am: bed4e9789c

Change-Id: I10f1de2db0dfc6657c7aece1e31f35da5c07a37c
2019-12-04 14:46:55 -08:00
Tyler Gunn
1d4fcf1703 Merge "Car mode InCallService changes." 2019-12-04 16:50:47 +00:00
Tyler Gunn
f701f7a765 Car mode InCallService changes.
1. Grant ENTER_CAR_MODE and CONTROL_INCALL_EXPERIENCE permissions to the
shell identity for use within CTS tests.
2. Remove un-needed Telecom shell command.

Test: unit tests, telecom CTS tests, manual testing
Bug: 144345414
Change-Id: I54a2e723d6ef9552117e6cadf4ab7c449dd5e3cb
2019-11-26 13:43:53 -08:00
Tyler Gunn
5474568b87 Merge "Add prioritized enableCarMode API in UiModeManager"
am: 8e7a1f8528

Change-Id: I81d8b4a457c567e19c3c8e499cc1f08e1c8af3b3
2019-11-20 00:17:34 -08:00
Tyler Gunn
18325cf2d4 Merge "Add prioritized enableCarMode API in UiModeManager" 2019-11-19 23:16:33 +00:00
Tyler Gunn
f05f2c2cc2 Add prioritized enableCarMode API in UiModeManager
Per design doc (go/android-car-mode-design), added new system API to
enable car mode and specify a priority for the calling app.
Also modified UiModeManager to pass the package name of the caller to
UiModeManagerService.

Bug: 136109592
Test: Added new unit tests and CTS tests.
Test: Added Telecom test app functionality to verify.
Change-Id: I2848039c9ea18ba93e7694e04c4e5dc70759daa3
Merged-In: I2848039c9ea18ba93e7694e04c4e5dc70759daa3
2019-11-19 23:15:52 +00:00
Tyler Gunn
daef668a99 Add prioritized enableCarMode API in UiModeManager
Per design doc (go/android-car-mode-design), added new system API to
enable car mode and specify a priority for the calling app.
Also modified UiModeManager to pass the package name of the caller to
UiModeManagerService.

Bug: 136109592
Test: Added new unit tests and CTS tests.
Test: Added Telecom test app functionality to verify.
Change-Id: I2848039c9ea18ba93e7694e04c4e5dc70759daa3
2019-11-18 13:03:30 -08:00
Bill Yi
3433827176 Import translations. DO NOT MERGE
Change-Id: I3b093fa0570222dbb74a932fc54e14a08c20541d
Auto-generated-cl: translation import
2019-11-10 15:16:01 -08:00
TreeHugger Robot
abc015499a Merge "DO NOT MERGE - qt-qpr1-dev-plus-aosp-without-vendor@5915889 into stage-aosp-master" into stage-aosp-master 2019-10-31 18:38:40 +00:00
Kweku Adams
3ff32e0892 Merge "Move heap dump sharing to SHELL." am: c29b5cba29 am: 2cdf2d5ad7
am: 215d92f880

Change-Id: Ic092f2d5c0c0a1497c19e73417c68b8e8616cc63
2019-10-30 21:15:56 -07:00
Kweku Adams
215d92f880 Merge "Move heap dump sharing to SHELL." am: c29b5cba29
am: 2cdf2d5ad7

Change-Id: I17993de9a96242379589a4d45be2825fb85b3b5e
2019-10-30 21:09:11 -07:00
Kweku Adams
4d345d7af1 Move heap dump sharing to SHELL.
The system shouldn't be granting read URI permissions as itself. This
means that heap dumps aren't successfully shared. Moving the heap dump
sharing mechanism to SHELL, which already has the permission to dump
heaps so that dumps can be shared properly.

The ActivityManagerService changes are submitted separately.

Bug: 126885951
Bug: 135150619
Test: collect a heap dump and confirm it's successfully shared with an app
Test: do manual test on a secondary user & confirm it's not available to
other user

Change-Id: I6fad69280b5124c8ec2d3b4bef0f7dddb6a9422c
2019-10-29 15:17:42 -07:00
TreeHugger Robot
c53718c865 Merge "Remove unused broadcasts/functions/variables from Shell" 2019-10-22 13:13:55 +00:00
Abhijeet Kaur
72be2e113e Remove unused broadcasts/functions/variables from Shell
Bugreport is now triggered using API and not via broadcasts from
dumpstate. As migration to API flow is stable, we can remove methods and
broadcasts that were used in non-API bugreport flow. Now, callbacks are used
for communication between dumpsate and Shell instead of broadcasts.

* Remove BugreportReceiver.java as it used to handle BUGREPORT_STARTED and
  BUGREPORT_FINISHED intents which are not required by Shell anymore to
  track bugreports.
* Remove RemoteBugreportReceiver.java as it used to handle
  REMOTE_BUGREPORT_FINISHED intent which is not required by Shell
  anymore.
* Remove methods that were being used when processing these broadcasts.
* Remove pid as that is not used anymore.
* Since Shell owns the file now, don't need mTempName, mSavedName,
  onFocusListener and disable file name after the bugreport is finished.
  File name can be sanitized and updated even after bugreport finished.

Bug: 136066578
Test: Build and flash. Interactive/Full bugreports from Settings/Power button.
Test: Rename workflow for interactive bugreports works as expected.
Test: * Build and flash
      * Install TestDPC
      * Make it device owner
      * Take a remote bugreport. Works as expected

Change-Id: I5e0f829631cb63074c41c914236e78abe95ba162
2019-10-22 12:26:23 +01:00
Bill Yi
00f480b79a Import translations. DO NOT MERGE
Change-Id: I37dc3d47f895e13069055b8555c85e54bfe71280
Auto-generated-cl: translation import
2019-10-18 05:18:31 -07:00
Abhijeet Kaur
5735c6a247 Read screenshot file from screenshotFiles array
Regression from merge issue that was created when merging ag/9489200 and ag/9502526.

Previously, before saving the screenshot file in the array, it had to be
created each time it was required.

Bug: 123617758
Test: manual
Change-Id: I2dc2924aa20609d2445af00025580b2752935903
2019-10-10 16:29:54 +01:00
Abhijeet Kaur
451d9c9ace Add synchronized locks to bugreport callback methods
BugreportCallbackImpl class methods modify (read/write) the private
variable mInfo. Add synchronized locks for consistency.

Make other methods static to be thread-safe, and operate only on its
arguments.

Bug: 123617758
Test: Build and flash. Takes bugreport as expected
Change-Id: I237fd940f5ccd4833d053558cf1b014883d59791
2019-10-07 16:34:23 +01:00
Abhijeet Kaur
396a0acbdb Fix bugreport rename in API workflow
In the current implementation of API flow of bugreport, renaming bugreports
works fine but it changes the entire name. In legacy flow, the user is only
able to rename the suffix of the file. The prefix of the name
(bugreport-deviceName-buildID) remains unchanged. Also, wifi and
telephony bugreports have the type of the bugreport specified explicitly
in the name.

Fix Shell's rename implementation to follow legacy logic. Also stop setting
name property in the API flow since it's a functional no-op anyway, and we
want all communications to dumpstate be through the API when possible.

No need to call trackInfoWithId() for remote bugreports as Shell does not
process any notification related to it.

Bug: 123617758
Test: * Take interactive bugreport, rename and save. (work as expected)
Test: Corner case:
      * Take interactive bugreport, rename and save.
      * Click on the progress notification again and keep the edit box
        open.
      * Wait for bugreport to finish, filename edit box would be disabled
        and autofilled with last saved rename. You will still be able to
        edit title and summary. (works as expected)

Change-Id: I0016ef4fc1e80fb792712c45439e2b0d348f5249
2019-10-07 13:56:44 +01:00
Brad Ebinger
32dfda5c4a Merge "Integrate the active emergency session listener in TelephonyRegistry" am: 4a54c2fa2b
am: 64418f4c31

Change-Id: Ideeb0afb508068fbe6feebbd472e94a24d94192f
2019-09-30 16:22:04 -07:00
Brad Ebinger
64418f4c31 Merge "Integrate the active emergency session listener in TelephonyRegistry"
am: 4a54c2fa2b

Change-Id: I890a913c18332669dee8f21baf81db78a50a0fb0
2019-09-30 16:08:04 -07:00
Shuo Qian
b61230c51d Integrate the active emergency session listener in TelephonyRegistry
Add Telecom shell command: "adb shell telecom set-system-dialer"

Test: PhoneStateListener cts
Bug: 135204580
Merged-In: I5eaada6a671606642a849f0ff6fe964332d80d5f
Change-Id: I5eaada6a671606642a849f0ff6fe964332d80d5f
2019-09-30 20:43:42 +00:00
Shuo Qian
f31d7e8edf Merge "Integrate the active emergency session listener in TelephonyRegistry" 2019-09-28 02:18:54 +00:00
Shuo Qian
134334bb6e Integrate the active emergency session listener in TelephonyRegistry
Add Telecom shell command: "adb shell telecom set-system-dialer"

Test: PhoneStateListener cts
Bug: 135204580
Change-Id: I5eaada6a671606642a849f0ff6fe964332d80d5f
2019-09-27 14:22:51 -07:00