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>
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
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
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
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
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
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>
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
* 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
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
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
Add new calls to bugreport API, all the while keeping the previous code
and logic untouched.
Added feature flag in Settings which if untouched, runs the old dumpstate workflow
by default. To test the new workflow turn on the feature flag from UI or
`adb shell setprop settings_call_bugreport_api true`.
Add permission TRIGGER_SHELL_BUGREPORT so that not all can send
broadcasts to trigger bugreports.
Create new receiver BugreportRequestedReceiver for the new broadcast intent that the shell app will
use.
Whitelist Shell app to use the bugreport API.
Bug: 123617758
Test: manually built and flash to device. Turn on the feature flag, generate bugreports and check
the onProgress and onFinish notifications.
Test: Turn off the feature flag test old workflow.
Change-Id: I1c7c258a48815a0386d7d4771301cd76f9cae3d0
Bugreport info dialog is used in the BugreportProgressService; services
are not themeable from the manifest file. Added themed context wrapper
in the service file.
Text view underlines are no longer black, and are white in color.
Bug: 128364209
Test: build and flash to device, manually verified the color of the dialog
Change-Id: Ia42c1c7c2b6f2e30d91a5522f1d6b3507b032cdb
Now that we have LocalCallingIdentity, we can start caching it in
very narrow cases. We must be careful to not cache too long, since
any changes to granted permissions for the UID mean we need to
re-evaluate any cached answers.
The best middle-ground for this in the Q release is to use an active
camera session as a proxy for when we should create a cache object
and then later invalidate it. (It's very unlikely that a user
changes permissions while actively using the camera, and this is
a strong signal that the caller is sensitive to performance.)
Many other sprinkled optimizations to avoid extra binder calls into
the OS, such as aggressively caching VolumeInfo related details.
Track IDs that are owned by each LocalCallingIdentity, to speed up
all future security checks.
Dispatch all change notifications asynchronously, and delay them by
several seconds while the camera is being actively used, to give
more important foreground work a fighting chance. Invalidate
thumbnails asynchronously.
Optimizations to ModernMediaScanner where it's safe to skip the
"reconcile" and "clean" steps when we're focused on a single file
that we successfully scanned.
Local tests show this CL improves performance of a test app that
takes 100 rapid shots by 45%. (All the collective optimizations
done so far this week add up to a 70% improvement.)
Bug: 130758409
Test: atest --test-mapping packages/providers/MediaProvider
Exempt-From-Owner-Approval: trivial manifest change
Change-Id: I38cc826af47d41219ef44eae6fbd293caa0c01d5