Commit Graph

938 Commits

Author SHA1 Message Date
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
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
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
Bill Yi
f4e73af0c3 Import translations. DO NOT MERGE
Change-Id: If07d6777ce034937bc52f3039b367aeff214c174
Auto-generated-cl: translation import
2019-09-25 15:29:18 -07: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