summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'android-13.0.0_r76' of ↵Julian Veit2023-09-261-47/+66
|\ | | | | | | | | | | | | | | https://android.googlesource.com/platform/frameworks/base into HEAD Android 13.0.0 release 76 Change-Id: Id0fa6f618d383eecee8fd2d96761f1be82bb3b99
| * [DO NOT MERGE] Update quickshare intent rather than recreatingMiranda Kephart2023-09-011-47/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we extract the quickshare intent and re-wrap it as a new PendingIntent once we get the screenshot URI. This is insecure as it leads to executing the original with SysUI's permissions, which the app may not have. This change switches to using Intent.fillin to add the URI, keeping the original PendingIntent and original permission set. Bug: 278720336 Fix: 278720336 Test: manual (to test successful quickshare), atest SaveImageInBackgroundTaskTest (to verify original pending intent unchanged) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:589ce3909c6e9e30f073df86e7de4503854a032a) Merged-In: Icad3d5f939fcfb894e2038948954bc2735dbe326 Change-Id: Icad3d5f939fcfb894e2038948954bc2735dbe326
* | Merge tag 'android-13.0.0_r52' of ↵George Zacharia2023-08-021-6/+8
|\| | | | | | | | | | | | | https://android.googlesource.com/platform/frameworks/base into t13.0 Android 13.0.0 Release 52 (TQ3A.230605.012) Change-Id: Ic80f318636f1f70bbd009504352ddde511d0dead
| * Work profile first run updatesMatt Casey2022-12-291-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Show until the user dismisses it. - Fetch the app icon based upon config ComponentName. - Fetch the app name based upon config. - Extract relevant logic to WorkProfileMessageController - Some no-op cleanups in SaveIMageInBackgroundTask to prevent sysui studio from complaining. Flag: The calls into the new message controller are protected by SCREENSHOT_WORK_PROFILE_POLICY (in teamfood). Bug: 254245929 Test: atest WorkProfileMessageControllerTest Test: Manually testing dismissal and UI. Change-Id: I943303992fdc2caeba76a06f88c1b91419d02be8
* | Merge tag 'android-13.0.0_r35' of ↵George Zacharia2023-04-031-32/+61
|\| | | | | | | | | | | | | | | https://android.googlesource.com/platform/frameworks/base into t13.0 Android 13.0.0 release 35 Change-Id: I709958b2f015d1774b2ece25894467c3a279f93c
| * Disable screenshot actions for work profile.Matt Casey2022-11-151-19/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Additional work will be needed to ensure intent launching works properly for these, defering that to post-launch. Behavior changes all protected by the flag SCREENSHOT_WORK_PROFILE_POLICY but had to move the smartActionsEnabled computation to be passed around instead of an instance variable (so it could honor the new constraint). Bug: 258706103 Test: Validate that actions work in personal profile but not work profile Test: atest ScreenshotNotificationSmartActionsTest Change-Id: I08b6c50f98cdf38287b6dadb9dde563f57af5dc2
| * Fix share/edit actions for work profile.Matt Casey2022-10-141-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to be able to proxy the permissions to read/write the screenshot when editing/sharing, the intents must be launched from a service running *as* the work profile user (if the screenshot is work profile). That is done with ScreenshotProxyService. In order to untangle action execution to accomodate this, I created ActionIntentExecutor, which does the following: 1. Dismisses the keyguard 2. Launches the intent (either directly if it's the main user, or delegating to the cross profile service if it's not) 3. Override some transition logic for shared element. This flow is used whenever the work profile flag is set (it works for either profile, but is required for work profile). Once we switch to this model, we can drop a lot of the SaveImageInBackgroundTask action code, drop ActionProxyReceiver entirely, etc. Extracted intent creation to its own class so it could be tested. All behavior changes covered by currently-off flags. Known issues: 1. This doesn't fix smart actions 2. If you do an action on the lock screen, the bouncer doesn't come up in the new implementation. I verified that the same call is being made and it's even getting to the bouncer's show() call but haven't figured out what's wrong here yet. Bug: 231957192 Test: manual sharing and editing screenshtos of wp and non-wp apps. Change-Id: Id2b423c22d209fc73f796ed6ba6e3d153e0f638e
| * Work profile screenshots: save to ownerMark Renouf2022-10-041-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a work profile screenshot is taken, propagate the owner UserHandle through to the Image export step. This change will write the image to the correct user profile and generate a URI with the userId embedded within using the form: content://10@media/external/images/media/000001.png Since URIs are user-specific, but not unique among users the userId prefix will carry this information through to downstream consumers. The ID can easily be retrieved from the URI using: int userId = ContentProvider.getUserIdFromUri(uri) If there is no userId within the URI, the return value will be the same as Process.myUserHandle(), the user of the current process. Because of this, an explicit UserHandle may not be needed if this information is conveyed entirely within the URI (it is included in this CL as-is). All behavior changes arising from these changes are currently gated on the SysUi flags: SCREENSHOT_REQUEST_PROCESSOR SCREENSHOT_WORK_PROFILE_POLICY This change does not include support for long screenshots nor fixes for screenshot actions (share, edit, etc). Bug: 159422805 Test: atest ImageExporterTest Change-Id: I641544f6a1b4685c743e7983d0af156e32796f56
* | Merge tag 'android-13.0.0_r16' into t13.0George Zacharia2022-12-151-12/+5
|\| | | | | | | | | | | | | | | | | | | | | Android 13.0.0 Release 16 (TQ1A.221205.011) Also included the following reverts: 1. Revert "fw/b: Import Wi-Fi standard icon [1/2]" 2. Revert "Add preference for toggling the wallpaper zooming animation" Co-authored-by: Semavi Ulusoy <doc.divxm@gmail.com> Change-Id: I9a6b51e452c28d10411712c59778bb54da5783e9
| * Remove #createScreenshotNotificationSmartActionsProvider from SystemUIFactoryDave Mankoff2022-07-121-12/+5
| | | | | | | | | | | | | | Bug: 235624311 Test: atest SystemUITests Change-Id: I78ef7481ac3be5929c1c2716576c3920ac659d92 Merged-In: I78ef7481ac3be5929c1c2716576c3920ac659d92
* | SystemUI: Integrate Google Lens into Screenshot UIAshutoshSundresh2022-10-261-0/+24
| | | | | | | | | | | | | | | | - shares the screenshot taken to Google Lens - informs the user to install Google Lens if it is not installed Signed-off-by: str-br <alexfinhart@gmail.com> Change-Id: I5117e23348b8ab1d8d06078320db00284728897f
* | Screenshot: Append app name to filenameezio842022-10-181-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Author: ezio84 <brabus84@gmail.com> Date: Tue Dec 19 14:37:35 2017 +0100 Screenshot: append app name to filename Kang Samsung's idea. Change-Id: Ibc6a52b5e2597e6014a2da6a4211febe17ec02c7 Author: Wang Han <wanghan1995315@gmail.com> Date: Fri May 11 12:47:40 2018 +0200 SystemUI: Don't append app name to file on lockscreen When device is locked, current implementation will append the current app name to file when taking screenshot. This causes information leaks. To prevent this, we check for isKeyGuardLocked() and fall back not to append the app name when taking screenshot on lockscreen. Change-Id: I04498faf51986e1a3723a32befd97d29e1f3fe58 Author: DroidFreak32 <rushabshah32@gmail.com> Date: Thu Oct 4 11:33:07 2018 +0530 Screenshot: Append app name after screenshot date. Change-Id: I2ee5d65006ff22dfa381aae50e5757b8e7596e91 Author: ezio84 <brabus84@gmail.com> Date: Sat Jun 16 16:57:19 2018 +0200 GlobalScreenshot: Fix screenshot not saved with some languages like Virgin Islands English when taking a screenshot of the Settings app Change-Id: Ic04f66f5813b9597c96835d15c74509c93530a5c Author: Han Wang <416810799@qq.com> Date: Mon May 25 11:18:01 2020 +0200 SystemUI: Do not convert application name to ISO-8859-15 * ISO-8859-15 does not handle CJK chars, so all of them are 'unknown' and empty eventually. Change-Id: I27c689f5d737190d381146e49c1989e998b4f623 Author: LuK1337 <priv.luk@gmail.com> Date: Mon Aug 24 17:52:39 2020 +0200 SystemUI: Use TaskStackChangeListener API for contextual screenshot package name * This should hopefully fix mislabeled screenshots. Change-Id: Ifde106c0e306a6700081e4d724c1cf0c06dd126c Change-Id: Ic2a42536bf763a0c6f7fb9ac4bbbe84f73723f91
* | SystemUI: screenshot: open the screenshot instead of editTimi Rautamäki2022-10-181-0/+46
|/ | | | | | | | | Open the taken screenshot in gallery application when clicking on the preview. There is a seperate edit button, so the preview imageview should open gallery instead. Test: atest com.android.systemui.screenshot.ScreenshotNotificationSmartActionsTest Change-Id: I8f882ddd0da47ca50acc37d25ee0866ce5698e4f
* Propagate write_uri perms from screenshot to sharesheetMiranda Kephart2022-04-041-1/+4
| | | | | | | | | | Add the WRITE_URI flag to the share intent, to allow deleting image from sharesheet -> edit [Markup]. Bug: 227693908 Fix: 227693908 Test: manual Change-Id: Id00ea1418619bdf31d04542d7d0441a207196b05
* Merge "Fix edit button in screenshot share activity" am: d7013fb94e am: ↵mrenouf2022-04-011-1/+1
|\ | | | | | | | | | | | | | | | | c6158cc84d am: e50de70f41 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1991974 Change-Id: Ie7e14f32b81b457ce6505d2a8a522879133480d1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| * Fix edit button in screenshot share activityEdward Savage-Jones2022-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | Update the screenshot share intent to align it with the data that is present in the screenshot edit intent. Bug: 220161786 Test: Take screenshot. Tap share. Tap Edit, which opens screenshot in Photos. See buganizer for more info. Change-Id: I7a1254e579cea38fd70fc13da81e1dae98f5f968
* | Standardize screenshot naming schemeMiranda Kephart2021-09-231-4/+2
|/ | | | | | | | | | | Remove "global_" prefix across the screenshot code. Previously names were mixed between "screenshot_" and "global_screenshot_" which made finding files/elements confusing. Bug: 191661294 Fix: 191661294 Test: manual -- no logic change, just renaming Change-Id: I65ba13601660007ea38d08515adb5afecf39bf2e
* Make Markup fade in from screenshotsMiranda Kephart2021-06-151-0/+1
| | | | | | | | | | | Uses RemoteAnimationAdapter to override the pending app transition so that Markup fades in in-place instead of doing a slide translation from the bottom. This is a workaround for b/190806800. Bug: 188696811 Fix: 188696811 Test: manual (visual inspection) Change-Id: I0838bb5dc1cd271456779cecb9a7710d7a3ad7a1
* Query and surface Quick Share chip before screenshot image compress/export. ↵Song Hu2021-04-231-2/+87
| | | | | | | | Update chip intent, once image URL is available after compress/export. Test: test on local device Bug: 185423664 Change-Id: I2710a727d4fc4fabaa1404d965feaa0c97d502fc
* Merge "ImageExporter: Accept and store UUID as ImageUniqueId in output"Mark Renouf2021-01-221-3/+2
|\
| * ImageExporter: Accept and store UUID as ImageUniqueId in outputMark Renouf2021-01-201-3/+2
| | | | | | | | | | | | | | | | Write a provided UUID as the ImageUniqueId tag in the Exif metadata. Bug: 177996487 Test: atest ImageExporterTest Change-Id: I150af1bf80e6ead7e78d7d961168a64112994ede
* | Merge "Return more information from ImageExporter"TreeHugger Robot2021-01-211-20/+25
|\|
| * Return more information from ImageExporterMark Renouf2021-01-201-20/+25
| | | | | | | | | | | | | | | | | | | | | | | | Adds filename, compress format and timestamp This eliminates additional duplicated code between SaveImageInBackgroundTask and ImageExporer, related to determining the filename and the capture time. Bug: 177996487 Test: atest ImageExporterTest Change-Id: I794727f8c67bc6b39de81978df0482de67894616
* | Add shared transitions from screenshot to markupMiranda Kephart2021-01-131-43/+48
|/ | | | | | | | | | | | Fixes earlier issue where UI didn't get dismissed correctly. Avoids removing the ExitTransitionCoordinator callback too early, so that we get the hideSharedElements call. Bug: 170138961 Bug: 159419046 Test: manual Change-Id: I78193e46c97d01943df9b8438a29c6ee1e0106ff
* Screenshots: use ImageExporterMark Renouf2021-01-071-95/+6
| | | | | | | | | | | | Use a single tested module for image export steps which is now shared between the standard flow and the long screenshot feature. Test: ImageExporterTest android.assist.cts.ScreenshotTest ScreenshotNotificationSmartActionsTest Bug: 175744393 Fix: 175744393 Change-Id: Id08716736edb4ac1d00c13224e7763e8ca53c979
* Revert "Add shared transitions for screenshot->markup"Miranda Kephart2021-01-061-48/+43
| | | | | | | | This reverts commit 6b330ef7eec82acae8ae5b4d503d0f6745f49455. Reason for revert: cause of bug: 176874121 Change-Id: Icc87484f7cbe26bbe479fc47dca0aadae82e377b
* Add shared transitions for screenshot->markupMiranda Kephart2021-01-051-43/+48
| | | | | | | | Bug: 170138961 Bug: 159419046 Test: manual Change-Id: I3a9c7487cbc36a4a7183030d2e3aa432958f7e1a
* Merge "Screenshot to share sheet shared element transition."TreeHugger Robot2020-12-171-59/+69
|\
| * Screenshot to share sheet shared element transition.Jon Miranda2020-12-161-59/+69
| | | | | | | | | | | | | | | | | | | | | | | | Switching the share action to a Supplier interface allows us to maintain the current code style, while ensuring that the APIs required to start the transition are called when the share chip is pressed. Bug: 174811491 Test: manual Change-Id: I201b82eaea650fcef23909212385fd6d56831429
* | Fix screenshot exif attributesMiranda Kephart2020-12-161-2/+3
|/ | | | | | | | | | | Update to using the androidx support library for exif data. Also update the error notification since failing to save isn't always caused by limited storage space. Test: manual Bug: 173543930 Fix: 173543930 Change-Id: I31ca5ac30eadc5b2ff781784c3c0f0f9ac6c586f
* Screenshots logging updateMark Renouf2020-12-021-8/+43
| | | | | | | | | | | | Unify logging tags and flags across screenshots Log to single tag by default, with option for class name Individual flags for categories of logs and a master on/off Test: set LogConfig.DEBUG_ALL = true adb shell input keyevent SYSRQ adb logcat -s Screenshot:* Change-Id: I728de8e8b77269d74d40f382fcd947e4e40520ae
* Make PendingIntents in screenshots immutableMiranda Kephart2020-10-231-7/+13
| | | | | | | | | | | S and later will require PendingIntents to explicity specify whether they are mutable or immutable. Test: manual, just a flag change (tested that normal screenshot flow works, verified that the log nags for unspecified mutability disappeared) Change-Id: I79b78f80c2d6af07a3826b6f79d0d86a5fc2f756
* Refactor GlobalScreenshotMiranda Kephart2020-10-211-19/+19
| | | | | | | | | | | | | | | | | | Pull apart into View vs Controller model, to separate views/ animations from state handling. This is a large change, but not as large as it looks since most sections are copied from GlobalScreenshot into either ScreenshotView or ScreenshotController. Roughly speaking, ScreenshotController handles the overall screenshot initiation, flow, and callbacks, while ScreenshotView handles the subviews and constructs the animations. Test: manual Change-Id: Ic3238571ac2d7aa749eff078c2297f2b6ed06b78
* Fix logs when screenshot fails to saveMiranda Kephart2020-10-091-2/+0
| | | | | | | | | | We currently incorrectly show the failed-to-capture string rather than the failed-to-save string, when a screenshot fails to save. This is confusing and makes it more difficult to track down problems. Bug: 170310033 Test: manual Change-Id: Iea30b670cf083ab2ea061ed5e4ae1ee928d06e15
* Move screenshot receivers and add testsMiranda Kephart2020-07-211-13/+11
| | | | | | | | | | | | | | | | | | | Moves the various broadcast receivers out of GlobalScreenshot and adds unit tests for them, along with some other changes to make them more easily testable: - ScreenshotSmartActions is now a stateless injectable class, instead of a collection of static methods - DeleteImageInBackgroundTask removed, in favor of just calling a background executor directly - remove the TargetChosenReceiver (used to remove notifications after a share target is chosen) since we're not using notifications anymore Bug: 160325487 Test: atest SystemUITests, plus manually checked that screenshots continue to function as expected Change-Id: I1c054dddd76404f385e59f7ab7317beaafde1106
* Add FLAG_CANCEL_CURRENT to screenshot share intentMiranda Kephart2020-06-241-2/+4
| | | | | | | | | | | | The share intent uses clipData, which isn't used to match intents. Thus, subsequent screenshots didn't update the share intent, so trying to share a second screenshot would end up sharing the first one. Adding FLAG_CANCEL_CURRENT fixes this problem. Bug: 159751741 Fix: 159751741 Test: manual Change-Id: I5eb63f075c3156e5061ee9f63ba17afa6b7abbbd
* Make ActionProxyReceiver use PendingIntent.Matt Casey2020-06-221-4/+9
| | | | | | | | | | | | | | | | | | | | PendingIntent lets SaveImageInBackgroundTask pass the permission directly to the target. Flow is: SaveImageInBackgroundTask (current user) -> ActionProxyReceiver (system user) -> Share or edit target (current user) The pending intent created in the first step allows read/write permission to be passed to the final destination, as ActionProxyReceiver itself does not have access to the screenshot. Bug: 159455848 Test: Share and edit a screenshot with the following variations: - lockscreen on / off - primary user / secondary user Verify that full UI flow apperars, final destination can show the screenshot Change-Id: Ie92212f2ffc3f8a11c3e5380908460f5f7fbb439
* Remove legacy screenshot notifications flowMiranda Kephart2020-06-101-3/+0
| | | | | | | | | | Bug: 158673382 Fix: 158673382 Test: manual -- this has no visible changes since the old code was flag-guarded behind "false", but built and ran through the screenshots flow. Change-Id: If09c16e8de1333137600f2192929af934ca5fd23
* Raise priority of screenshot saving taskMiranda Kephart2020-06-041-0/+1
| | | | | | | Bug: 157499085 Fix: 157499085 Test: manual Change-Id: I71c9ff7809011f815a1854da367940616468055a
* Merge "Fix logging for successive screenshots" into rvc-devMiranda Kephart2020-05-271-9/+6
|\
| * Fix logging for successive screenshotsMiranda Kephart2020-05-261-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When two screenshots are taken in quick succession, we don't show UI for the first one (but do still continue the task for saving the screenshot in the background). However, the logging was done as part of the UI flow, meaning that we currently don't log when the first screenshot is saved. This change fixes the logic flow so that we log success/failure of the saving task in all cases, but only show UI for the last successive screenshot. Bug: 157244123 Fix: 157244123 Test: manual; tested that we don't see the log before the fix and do after Change-Id: I7646f4a3cb6cfd0f903472e101fb385cef58ddea
* | Merge "Pass the user handle for the screenshot app to the content suggestion ↵Katsiaryna Naliuka2020-05-261-5/+3
|\ \ | |/ |/| | | service (SysUI part)." into rvc-dev
| * Pass the user handle for the screenshot app to the content suggestionKatsiaryna Naliuka2020-05-141-5/+3
| | | | | | | | | | | | | | | | service (SysUI part). Bug: 156405841 Test: atest ScreenshotNotificationSmartActionsTest Change-Id: Ie57744f11b00a8e8fa76184174e107330f7e3cf9
* | Ensure screenshot edit action gets permissions for current userMatt Casey2020-05-201-2/+2
|/ | | | | | | | | | | | | Previously, edit action intent was sent to ActionProxyReceiver with the SYSTEM user. It had the FLAG_GRANT_READ_URI_PERMISSION flag, but when the current user wasn't the system user, the system user wouldn't have permissions to read that URI so it didn't work. This caused Markup to fail to open the screenshot since it wasn't given permission. Bug: 148128165 Test: Validate that Markup can read/write/delete screenshot w/ secondary user. Change-Id: Ifa1d8fd195d5f777ab51972183ed6db4e6735ffd
* Merge "Clear back stack when editing a screenshot" into rvc-devMatt Casey2020-04-271-0/+1
|\
| * Clear back stack when editing a screenshotMatt Casey2020-04-251-0/+1
| | | | | | | | | | | | | | | | | | Previously old screenshot editing sessions could be accessed via back (or similar on-screen affordance). Bug: 149483164 Test: Manual testing of bug resolution. Change-Id: Ic508371220c13b42b72ea9b42c0395d9f250f8a7
* | Merge "Pass the URI of the new screenshot instead of file name (framework). ↵Katsiaryna Naliuka2020-04-271-6/+6
|\ \ | | | | | | | | | This better matches the recommended way to access on-device media." into rvc-dev
| * | Pass the URI of the new screenshot instead of file name (framework).Katsiaryna Naliuka2020-04-271-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | This better matches the recommended way to access on-device media. Bug: 150460149 Test: locally; atest ScreenshotNotificationSmartActionsTest Change-Id: Icace4826c4a414a5a0cfef8f89c4d1d626efe5ec
* | | Keep screenshot process boundMiranda Kephart2020-04-241-0/+13
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the screenshot process only remains bound to SysUI (by ScreenshotHelper) until the screenshot finishes saving. This makes it vulnerable to getting cached and frozen. Since the process now includes UI with touch focus for longer than that, this can cause ANRs in the screenshot process, if it is frozen while it's supposed to be accepting touch input. Retaining the binding for the entire lifecycle of the screenshot UI fixes this problem. Test: manual -- used the steps in b/153577093 to verify the freezing behavior and verified that it no longer occurred after the change Bug: 153418099 Fix: 153418099 Change-Id: Idca24a69274af3d633e1243b46b602613cb04d50
* / Add screenshots loggingMiranda Kephart2020-04-171-33/+53
|/ | | | | | Bug: 150710005 Test: manual Change-Id: I54a37eb0a62234c6c53fc0f3c80e18e9ee269f12