Commit Graph

1015 Commits

Author SHA1 Message Date
Abhijeet Kaur
8abcebf3e2 Merge "Delete empty bugreport files onError" into rvc-dev am: 873f59dc0e
Change-Id: Icaa20adf0a4d583ae3d09b41a2034df1760f98cf
2020-04-07 09:34:12 +00:00
Abhijeet Kaur
873f59dc0e Merge "Delete empty bugreport files onError" into rvc-dev 2020-04-07 09:22:26 +00:00
Abhijeet Kaur
1a5687df2c Delete empty bugreport files onError
Bug: 152839953
Test: Take another bugreport, while one is in progress.
Without this change: bugreport files for the second bugreport can be
seen in /bugreports
With this change: no file for the second bugreport can be seen. This
is the expected behavior.

Change-Id: I45c1f66f3a52ba9a31413cf9748bc5504eaa65d0
2020-04-06 12:35:19 +01:00
Bill Yi
9c0d11cbb2 Import translations. DO NOT MERGE
Auto-generated-cl: translation import
Change-Id: I8eef41a13445c1463d2cd7789b8c375deedb1d97
2020-04-04 21:08:18 -07:00
TreeHugger Robot
abfb1b0eda Merge "Follow best practices for Atomic variables" into rvc-dev 2020-04-03 11:43:33 +00:00
Abhijeet Kaur
98deae1551 Follow best practices for Atomic variables
* Make Atomic variables final so it can never be re-assigned to a null
object and hence avoid NPE.
* Set the value of the variables instead of re-assigning the object.

Test: Manual
Bug: 152479372
Change-Id: I58279d589d6247c53155755223fd8863f1049257
2020-04-02 16:52:54 +00:00
Abhijeet Kaur
8449e85f3c Track bugreports immediately after triggering a bugreport
Remove an old hack that was put in place as bugreport ID was updated
a bit later in the bugreport generation phase.
This change removes the race condition around triggering bugreports
almost instantly.

Bug: 152292912
Test: Trigger consecutive bugreports from ActivityManager WAI. (Fails
without this change)

Change-Id: Ib08bc2c7d8ae765894998e5bfa0d9b6f3efa088b
2020-04-02 15:02:29 +01:00
TreeHugger Robot
8f08b1cd40 Merge "Delete bugreport file on bugreport cancel" into rvc-dev 2020-03-31 18:38:51 +00:00
Abhijeet Kaur
982b104755 Delete bugreport file on bugreport cancel
Note: bugreport Cancel is not the same as bugreport onError. Files are not
deleted onError, as it still has some information before the bugreport
crashed/stopped. Bugreport Cancel is triggered by the user, hence clean
up all the files.

Bug: 146994281
Test: Cancel interactive bugreport from UI, deletes the current
bugreport files

Change-Id: I2606e491cbaa20eaa60980e98af56a194bae2280
2020-03-30 17:25:04 +01:00
TreeHugger Robot
937e786319 Merge "Initialize progress and lastProgress AtomicIntegers" into rvc-dev 2020-03-27 12:03:54 +00:00
Todd Kennedy
fb590035e1 Merge "Define permission for installer API v2" into rvc-dev 2020-03-26 21:50:17 +00:00
Abhijeet Kaur
5f49375c4e Initialize progress and lastProgress AtomicIntegers
This is essential for bugreports that do not send progress updates.

Bug: 152343458
Test: Take and share full bugreport
Change-Id: Id634afd82a92c02d1cf96ffd719fff8670fb8709
2020-03-26 11:12:11 +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
Abhijeet Kaur
0b304c36f6 Show predefined title and description in finished notification
shareTitle and shareDescription is passed by the caller of the
bugreport. Show these in the finished bugreport notification.

Pre-set shareTitle takes precedence over user modified title.

shareDescription and description are not related/dependant on each other
in any way.

Bug: 150333444
Test: Manual (by passing EXTRA_TITLE and EXTRA_DESCRIPTION from
ActivityManagerService when trigerring a bugreport)

Change-Id: I2bfd080aeee677cdc8d0af339d7ad4a29451c3e0
2020-03-25 15:55:27 +00: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
Abhijeet Kaur
78ef10aa72 Merge "Clean up code in BugreportProgressService" into rvc-dev 2020-03-23 14:18:44 +00: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
Abhijeet Kaur
e1be940b84 Clean up code in BugreportProgressService
* Make fields (progress, lastUpdate and finished) atomic to make them
thread safe and also reduce getters/setters.
* Make lastProgress a private field in BugreportInfo.
* Move deleteScreenshots to BugreportInfo class.
* Make fields with lock protected getters/setters as private.
* Make fields that should not be changed as final.

Bug: 147033613
Test: manual
Merged-In: I8f0fb4865c1b7c5d62bebca3e250eee59b4e71f4
Change-Id: I8f0fb4865c1b7c5d62bebca3e250eee59b4e71f4
(cherry picked from commit fe7d1ab0cb)
2020-03-18 15:16:52 +00: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
5dbabb62a6 Merge "Add COMPANION_APPROVE_WIFI_CONNECTIONS to shell permissions" into rvc-dev 2020-02-29 23:42:23 +00: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
Paul Chang
46ab985f41 Clean up code of starting bug report
- Let screenshot fd be null if Shell doesn't want to take default screenshot when bug report is triggered.

BUG:149525300
Test: Flash and test interactive/full bugreports generated using Shell, and Shell flow does not break during tests
Change-Id: I50908af63d74ed66156354ec0b5a237f7131061a
Merged-In: I50908af63d74ed66156354ec0b5a237f7131061a
2020-02-28 17:14:11 +00:00
Abhijeet Kaur
5cbf58e33c Merge "Add synchronization locks to shared objects" 2020-02-17 13:02:01 +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
Abhijeet Kaur
8425e266d1 Add synchronization locks to shared objects
Make methods that read/write mBugreportInfos lock protected and add
"Locked" suffix to the method name. BugreportInfo objects are read/write
in different functions, to keep the code clean, add lock protected
getter/setter methods.

Bug: 142217059
Test: Takes interactive/full bugreports as expected
Change-Id: Iaadd6c9dce5009e40dd015e3b62bcd6e36966e00
2020-02-14 17:07:25 +00:00
Abhijeet Kaur
944bafb7a7 Merge "Refactor bugreport files creation and getfd methods" 2020-02-14 16:25:37 +00:00
Shafik Nassar
4ec80cc67d Merge "Revert "Request MANAGE_EXTERNAL_STORAGE permission"" am: e21d0ea642
Change-Id: I044ef75eace6125620c1781e1eec1d80b247a66b
2020-02-14 13:51:21 +00:00
Shafik Nassar
e21d0ea642 Merge "Revert "Request MANAGE_EXTERNAL_STORAGE permission"" 2020-02-14 13:35:34 +00:00
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