Commit Graph

1080 Commits

Author SHA1 Message Date
Abhijeet Kaur
6688e62e93 Refactor bugreport files creation and getfd methods
Handle Exceptions around file creation/open fd more gracefully inside
BugreportInfo class. This is communicated to the caller of BugreportInfo
by returning null for getFd() methods.

Test: builds

Change-Id: Ie241dce0810645e04b2492dc8b1bcbc3e9f8f664
2020-02-14 09:34:31 +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
Automerger Merge Worker
285f6781c1 Merge "Give CONTROL_DEVICE_LIGHTS permission to the shell" am: 668daf0341
Change-Id: I8f0d55f7a310e6dff8cf552e5ddf929eb8d0c2b7
2020-02-11 22:14:58 +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
Abhijeet Kaur
7f99ea08eb Merge "Remove duplicate directory variables with the same value" 2020-02-07 18:33:31 +00:00
Abhijeet Kaur
2c53c192d7 Remove duplicate directory variables with the same value
Bugreport files and screenshot files are saved in the same directory.
Use common variable for consistency and to avoid duplicacy.

Move bugreport file and default screenshot file creation to the
constructor as for each bugreportInfo object a bugreportFile must exist.

Bug:123617758
Test: Takes interactive/full bugreports as expected
Change-Id: I338e852c543e63b403536cd852518b6601ea32f0
2020-02-07 14:38:23 +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
Automerger Merge Worker
24f93a2b48 Merge "Add a null home activity to Shell.apk" am: fd2ba540df
Change-Id: I6f789c032dfd105ff81944ff3d6965673485fcac
2020-02-07 08:21:01 +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
Automerger Merge Worker
69ca2fcfa0 Merge "Add permissions for using PlatformCompat methods" am: 7202e904c9
Change-Id: Iffdf7ffc1265fce941eb4cd519031da4575ac53a
2020-02-06 13:51:30 +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
Automerger Merge Worker
1e43248938 Merge "Grant shell REBOOT permission" am: a656dd889d
Change-Id: I103de65e0ac50151556c69efafaa63911a821acb
2020-02-04 23:14:07 +00:00
Nikita Ioffe
a656dd889d Merge "Grant shell REBOOT permission" 2020-02-04 23:01:44 +00:00
Automerger Merge Worker
d6e6068ded Merge "Add UPGRADE_RUNTIME_PERMISSIONS permission to support testing." am: 602faa961a
Change-Id: Ic76f1ffd8ec2b954e9a2ebb6c326662a8d3ace0d
2020-02-04 00:02:14 +00:00
Treehugger Robot
602faa961a Merge "Add UPGRADE_RUNTIME_PERMISSIONS permission to support testing." 2020-02-03 23:50:29 +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
Treehugger Robot
8ca170d09a Merge "Import translations. DO NOT MERGE" 2020-02-01 20:33:25 +00:00
Bill Yi
25dbc49cfc Import translations. DO NOT MERGE
Change-Id: Id295f834c169dfc9fda8d12fe93efbd95ffa6d4b
Auto-generated-cl: translation import
2020-01-31 18:42:05 -08: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