Commit Graph

907 Commits

Author SHA1 Message Date
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
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
Abhijeet Kaur
43bbe8a2fc 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
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)

Change-Id: I200c592608261665e4c2416303f573522c6bc59a
2019-09-26 14:21:34 +00:00
Abhijeet Kaur
2f0ff57798 Merge "Handle legacy broadcasts from dumpstate logic in onFinished() callback" 2019-09-26 09:48:42 +00:00
Abhijeet Kaur
af9fbc3946 Handle legacy broadcasts from dumpstate logic in onFinished() callback
In legacy bugreport workflow dumpstate used to send BUGREPORT_STARTED,
BUGREPORT_FINISHED and REMOTE_BUGREPORT_FINISHED broadcasts.

BUGREPORT_FINISHED and REMOTE_BUGREPORT_FINISHED broadcasts contain
information about the bugreport file, this information is not with
dumpstate in the API WORKFLOW, and is passed to it by the API caller.

Hence these broadcasts need to be sent by the caller of the bugreport
API to share the bugreport file information in the onfinished() callback
function.

Send REMOTE_BUGREPORT_DISPATCH broadcast for DevicePolicyManager to
handle.

Add minimal information in these broadcasts. Not adding all fields that
dumpstate used to send, as most of those were used by Shell. Only
sending necessary fileds used by receivers of these broadcasts.

Handle clean up of old bugreports in onFinished() callback function

Bug: 137825297
Test: * Interactive/Full bugreports successfully created
      * Share notification appears as expected
      * Able to attach these to gmail
Test: * Trigger remote bugreport by hardcoding the value of remote
        bugreport when calling the API
      * Remote bugreport is created successfully
      * No share notification (same behavior as before)
      * Same logs in logcat as triggering remote bugreport using old flow:
          * adb shell setprop dumpstate.options bugreportremote
          * adb shell setprop ctl.start bugreport
Test: * TestDpc (go/testdpc):
          * Install TestDPC
          * Set it as Device Owner
      * Open TestDPC to trigger a remote bugreport ("Request bugreport")
      * Shows user consent for bugreport collection (indicating that the
        API workflow is triggered.
      * Once the collection is complete and you tap "Share" in the notification.
      * TestDPC shows another notification showing the received bugreport file
        path and hash.
      * Verify using adb shell to check if the bugreport file is present
        in the above specified file path
Change-Id: I07c0c64b74a723683601e53e3c68a374ca54f3cb
2019-09-24 16:42:29 +01:00
Jayant Chowdhary
4feeee8891 Allow com.android.shell to get RECORD_AUDIO permissions.
Camera CTS tests, while running with system cameras assume shell
identity for permission checking, recording tests need permissions to
record audio.

Bug: 138130599

Test: CTS camera RecordingTest with system camera.

Change-Id: I987eff88ebd06ff85024de1bfe0edb7e0fb0fa8e
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
2019-09-19 12:14:35 -07:00
Dan Sandler
630f991cf2 Merge "Bugreport progress notification should use the bug icon." am: cb783ea2ee am: 704b11756a am: 777b2325be
am: 362e959c7d

Change-Id: I161186cbfef27ace50349d60b1726ef3ba6d1932
2019-09-18 12:16:32 -07:00
Dan Sandler
bc20d4e79f Bugreport progress notification should use the bug icon.
(Don't worry, stat_sys_adb isn't going away, but it will
only be used by the ADB notification now.)

Bug: 138661761
Test: initiate bugreport from globalactions
Change-Id: I238659d50f70bfbc047133d89afb76f78ec841f9
2019-09-12 23:11:36 -04:00
Bill Yi
8e963adbcc Import translations. DO NOT MERGE
Change-Id: Ice06eea390ab74928a224e2e9d1b68862aeafba1
Auto-generated-cl: translation import
2019-09-10 04:26:21 -07:00
Miranda Kephart
70ff3fb971 Merge branch 'fetch_qt-qpr1-sysui-dev_5855545' into merge_qt-qpr1-sysui-dev_5855545
Test: manual; presubmit on source branch

Change-Id: Ibc2bb3a04ee5605660ff4f2cf762af499db237c8
2019-09-06 18:27:58 +00:00
TreeHugger Robot
aaab0a09f1 Merge "Import translations. DO NOT MERGE" 2019-08-24 10:20:31 +00:00
Bill Yi
53402799ef Import translations. DO NOT MERGE
Change-Id: I5df9c6c8aeb4027e7cef30775576db0b9c0f7359
Auto-generated-cl: translation import
2019-08-22 23:32:49 -07:00
TreeHugger Robot
c29c1018c4 Merge "Fix bugreport warning dialog" 2019-08-22 12:16:28 +00:00
Jayant Chowdhary
70809a1847 Merge "Add SYSTEM_CAMERA capability to camera2 and define @SystemApi SYSTEM_CAMERA permissions." 2019-08-21 19:53:16 +00:00
Abhijeet Kaur
f90de9746b Fix bugreport warning dialog
This bug was introduced when fixing dark theme for bugreport dialogs.

Bug: 135446537
Test: manually (both in light and dark theme)
Change-Id: Ib8c16d068c00632d009033c2eab7d2d6cb7e4eea
2019-08-21 17:10:55 +01:00
Jayant Chowdhary
393ad6e0ad Add SYSTEM_CAMERA capability to camera2 and define @SystemApi SYSTEM_CAMERA permissions.
In order to access system-only cameras client processes need
SYSTEM_CAMERA permissions in addition to CAMERA permissions. A
permission was preferred over other mechanisms such as having private
connections would need to hard-code the package name(s) of clients using
system only camera devices. A system | signature permission on the other hand,
would make this more flexible and would be better for security.

Bug: 133508924

Test: cts CameraManagerTest, CameraDeviceTest
Test: Give cts test SYSTEM_CAMERA permissions by using
      adoptShellPermissions and run some camera tests.

Change-Id: Ibcd6ccdb231dcca949ed4fb14712d033a5801d36
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
2019-08-20 15:24:28 -07:00
Abhijeet Kaur
725a25f7f5 Set up to migrate requestBugreport flavors to use bugreport API
Add initial set up code to migrate requestBugreport,
requestBugreportWithDescription, requestWifiBugreport and
requestTelephonyBugreport to use the new Bugreport API.

Prepare the intent (to trigger API workflow) but do not send. Not
sending the intent keeps the workflow same as before.

This set up helps to move away from directly setting system properties
(dumpstate.options.title and dumpstate.options.description).

Bug: 139415553
Test: build and flash. Taking a bugreport works as usual
Change-Id: I0b57643ff8f4eadb281e1d7788171ef751a01b79
2019-08-19 12:20:48 +01:00
Nandana Dutt
b745860a3e Merge "Remove obsolete methods from DumpstateListener implementations"
am: cbdb10f982

Change-Id: Ia746b0cdadd0c4d652c373763f7a12266b080e3b
2019-08-07 07:08:27 -07:00
Nandana Dutt
cbdb10f982 Merge "Remove obsolete methods from DumpstateListener implementations" 2019-08-07 13:45:36 +00:00
Nandana Dutt
47c5ecc50a Remove obsolete methods from DumpstateListener implementations
Note that with the new Bugreporting API, SystemServer is the only
expected DumpstateListener implementation. Once we fully migrate Shell
app, we can remove the implementation in BugreportService as well.

BUG: 128980174
Test: bugreport from power menu, observe progress bar

Change-Id: I40d654a70bd9ceb3a29f8a0113b85616100f4ee9
Merged-In: I40d654a70bd9ceb3a29f8a0113b85616100f4ee9
2019-08-06 17:43:11 +00:00
Nandana Dutt
ecc40227b6 Merge "Remove obsolete methods from DumpstateListener implementations" 2019-08-06 16:21:34 +00:00
jay
e77e28c519 Merge "Clean up duplicated uses-permission" am: 2bfe37de04 am: ed63903250 am: 807b7fde15 am: abd5dae2a8
am: 001e3fad8d

Change-Id: I4bc7812131cd83b2bd739775d205d54269b37208
2019-08-05 14:05:10 -07:00
jay
ed63903250 Merge "Clean up duplicated uses-permission"
am: 2bfe37de04

Change-Id: I283778ef4b61e9f0a7a6592f1be563da91e8c628
2019-08-05 13:10:39 -07:00
TreeHugger Robot
120820d66b Merge "Add logic to handle screenshot file creation failure" 2019-08-05 17:33:42 +00:00
Abhijeet Kaur
1b1d614e63 Add logic to handle screenshot file creation failure
Delete the bugreport file to free the space before returning.

Delete unnecessary if blocks as the File constructor would never return
null

Bug:123617758
Test: Force code to execute the if (screenshotFd == null) block.
      Bugreport file gets deleted successfully

Change-Id: Ib88278a8a56799ef562b8b06e5e530a8e31e85d5
2019-08-05 15:24:16 +01:00
Nandana Dutt
56659ae22f Remove obsolete methods from DumpstateListener implementations
Note that with the new Bugreporting API, SystemServer is the only
expected DumpstateListener implementation. Once we fully migrate Shell
app, we can remove the implementation in BugreportService as well.

BUG: 128980174
Test: bugreport from power menu, observe progress bar

Change-Id: I40d654a70bd9ceb3a29f8a0113b85616100f4ee9
2019-08-01 16:08:56 +01:00
TreeHugger Robot
9f3eb4a130 Merge "Leave error handling the same as old workflow using dumpstate" 2019-08-01 12:19:34 +00:00
Abhijeet Kaur
0d61c4f89d Leave error handling the same as old workflow using dumpstate
Removing the TODO as won't be working on improving error handling as
part of this bug. Created another bug (b/138576498) to work on better
error handling.

Bug: 123617758
Bug: 127431371
Test: builds (only removing comment)
Change-Id: I8a7fea416e9871909cfb3cc801232bff6056536e
2019-07-31 11:18:55 +01:00
Abhijeet Kaur
af0279c991 Merge "Make shell bugreport file names consistent with dumpstate" 2019-07-29 13:41:13 +00:00
Abhijeet Kaur
906b937b42 Make shell bugreport file names consistent with dumpstate
Since bugreport API workflow will be replacing old workflow of directly
starting dumpstate, we aim that the resulting file names be the same as
the users are used to the old file names (that dumpstate used to decide).

Bug:126862297
Test: * Build and flash to the device
      * Turn on Settings feature flag to use the bugreport API
      * Take interactive and full bugreports
      * Output file names same as before

Change-Id: I24d800e26a8cc4f739038ac0f27da13bd83f7f47
2019-07-29 10:54:32 +01:00
jay
67feca7041 Clean up duplicated uses-permission
android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS
It would be duplicated and we can remove it.

Bug:
Test: refactoring CL

Change-Id: I75bf3761be64d850781c29b734c2f7e60ef3b6a2
Signed-off-by: jay <jdragon.bae@gmail.com>
2019-07-26 09:09:03 +00:00
Abhijeet Kaur
ac834969a3 Set id for bugreports after dumpstate increments it.
dumpstate increments system property PROPERTY_LAST_ID when a bugreport
is triggered.

In the old workflow for bugreports, dumpstate used to get triggered
before Shell, and dumpstate would send the 'id' to Shell. Hence Shell
always assumed that it has a known value for 'id', that is why
'id' is declared as a final variable which could be assigned value in
the constructor.

In new workflow using API, the 'id' is incremented after dumpstate gets
triggered. Hence making the following changes:
* Changing 'id' variable to be not final
* Reading 'id' after dumpstate has incremented the system property

Bug: 123617758
Test:  	Build and flash to device.
	Turn on the feature flaggenerate bugreports
	Check the progress and Finish notifications.

Change-Id: I44762190391c128cba135bf0ef795a1ae872dbb7
2019-07-25 14:04:56 +01:00
TreeHugger Robot
deda6a1bd9 Merge "Progress notification for interactive bugreports" 2019-07-22 10:14:44 +00:00
Abhijeet Kaur
1a5030cc7d Add logic to create screenshot file
* Creating screenshot file for all types of bugreport
* The logic to populate the screenshot file is in dumpstate (few
bugreport types that do not need screenshots will leave the file
untouched/empty)
* Delete the empty screenshot file and set the file to null so that
empty file does not get shared
* This TODO was previously left as binder did not allow to send null
screenshotfd, which was recently fixed. While fixing and testing the
optional screenshot fd CL with these changes, left the value "null" by
default. Fixed now.

* Not adding any logic here on the basis of the type of bugreport as
all that is already in dumpstate

* Making the names of bugreport (.zip file) and bugreport screenshot
(.png file) consistent. In the old flow also both have the same names.

Bug: 123617758
Test: * Build and flash to the device
      * Turn on use bugreport API feature flag from Settings
      * Take interactive bugreport
      Expectation: On clicking the notification to "Share the bugreport"
      only 1 file (the bugreport zip file) gets shared. Also, there is
      no screenshot file in /bugreports/ in the device
      * Take full bugreport
      Expectation: On clicking the notification to "Share the bugreport"
      2 files (bugreport zip and screenshot png file) get shared. Also
      we can see the screenshot file in /bugreports/ in the device

Change-Id: I39cb6913033b6e3c61bd0c6655a76524c12d2428
2019-07-18 16:53:06 +01:00
Bill Yi
30b4642488 Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 64712476
Change-Id: I55ae03d482913f3d4fb8911853bcc882181ef7f9
2019-07-14 19:25:52 -07:00
Nate Myren
1a8d1110c0 Merge "Permission flag updates now notify listeners" 2019-07-10 16:03:07 +00:00
Bill Yi
abc48bceb2 Import translations. DO NOT MERGE
Change-Id: Ia76b70e9b62254d77734da1f3ecf400f0867fc46
Auto-generated-cl: translation import
2019-06-29 17:02:40 -07:00
Nate Myren
d3a6385686 Permission flag updates now notify listeners
Added a version of the onPermissionUpdated and
onInstallPermissionUpdated methods which will notify
OnPermissionChangedListeners, and added this to the
PermissionManagerService "updatePermissionFlags" and
"updatePermissionFlagsForAllApps" methods. Also adds
OnPermissionsChangedListener to @TestApi

Fixes: 135937566
Test: atest PermissionUpdateListenerTest
Change-Id: I906598c366234c3daaa202261678bca04837cb13
2019-06-28 16:56:26 +00:00
Bill Yi
ffbc661f87 Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 64712476
Change-Id: Id715eb584d4d944ac961df03e6f23498c06d4059
2019-06-19 15:12:07 -07:00
Abhijeet Kaur
97a8f0f5db Progress notification for interactive bugreports
Send instant progress notification for interactive bugreports (when
using bugreport API), starting notification when progress = 0

Bug: 123617758

Test: * Build and flash to the device
      * Turn on use bugreport API feature flag from Settings
      * Take interactive bugreport
      Expectation: Progress notification is shown instantly

Change-Id: Icd834c05324108430ee6cb9c3d8539f91059e563
2019-06-04 15:36:16 +01:00
Abhijeet Kaur
0a295724f2 Merge "Add dark theme for Shell app." into qt-dev am: 190e99cf3a am: 1cceacc469
am: 2c90394b5d

Change-Id: I8c913dfa6823f9c9cfee1a68a3f61000e5594b57
2019-05-29 07:27:37 -07:00
Abhijeet Kaur
1cceacc469 Merge "Add dark theme for Shell app." into qt-dev
am: 190e99cf3a

Change-Id: I5e0d09befb3d1d45176a8826b4710f001e6fdce3
2019-05-29 07:17:36 -07:00
Abhijeet Kaur
87c7abf06b Merge "Add dark theme for Shell app." into qt-dev
am: 190e99cf3a

Change-Id: Ie49ffacdf45b5bb30390d1f666ce4976431f935a
2019-05-29 07:17:34 -07:00
TreeHugger Robot
190e99cf3a Merge "Add dark theme for Shell app." into qt-dev 2019-05-29 14:03:55 +00:00
Nate Myren
1a4e0bc457 Merge "set RuntimePermissionPresentationInfo, getAppPermissions, and OnGetAppPermissions as Test Api, added Get Runtime Permissions to shell" into qt-dev am: 1ce9983162 am: 40bcb1d3cd
am: 364c09f390

Change-Id: I26127032cd6185632d33e779e33cb7976b9ee2c1
2019-05-28 09:59:45 -07:00
Abhijeet Kaur
2ae76e468b Merge "Migrate Shell app to use the new bugreport API." 2019-05-28 16:56:32 +00:00
Nate Myren
2c120874c9 Merge "set RuntimePermissionPresentationInfo, getAppPermissions, and OnGetAppPermissions as Test Api, added Get Runtime Permissions to shell" into qt-dev
am: 1ce9983162

Change-Id: I45e6e16628bb8c3926a3aef574d93ae9f35ea55b
2019-05-28 09:46:40 -07:00