summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/systemui/screenshot/TakeScreenshotService.java
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'android-13.0.0_r52' of ↵George Zacharia2023-08-021-28/+53
|\ | | | | | | | | | | | | https://android.googlesource.com/platform/frameworks/base into t13.0 Android 13.0.0 Release 52 (TQ3A.230605.012) Change-Id: Ic80f318636f1f70bbd009504352ddde511d0dead
| * Split SCREENSHOT_METADATA into two different flags.Matt Casey2023-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The screenshot metadata work consisted of two things: 1. Flag-guarded refactors to support metadata handling. 2. The actual fetching and sending of the metadata URL itself. The second part we've chosen to leave in teamfood for an extended time, but some other features were expecting to launch along with the flag-guarded refactor, so we need to flag and launch that separately. No behavior change in this CL, just splitting one teamfood flag into two teamfood flags. Bug: 268484562 Bug: 268484915 Test: atest TakeScreenshotServiceTest Change-Id: I4654b86206f77a589c1f95565ddb0622c0ce5849
| * Add log on screenshot capture failedMiranda Kephart2023-01-311-28/+37
| | | | | | | | | | | | | | | | | | | | Also moves the request logging slightly earlier so we capture the request even if it fails due to e.g. locked storage. Bug: 264457397 Fix: 264457397 Test: atest TakeScreenshotService, statsd_testdrive Change-Id: I7cd268114a91ffa63328fa37f12d201316c94173
| * Migrate to ScreenshotData objectMatt Casey2023-01-201-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of passing around a handful of objects, use a single object to represent the accumulated state in the processing pipeline. This is to facilitate the passing of screenshot metadata (in a later CL). Flag: All behavior changes are protected by SCREENSHOT_METADATA flag, several methods in the acquisition pipeline have been forked to use the new data structure. Bug: 265075469 Test: atest RequestProcessorTest Test: atest TakeScreenshotServiceTest Test: atest ScreenshotDataTest Change-Id: I65b996215a7c0cc2040390cca5876c22cb216b22
| * Make ScreenshotRequest handle hardware bitmap conversionMiranda Kephart2023-01-181-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, ScreenshotHelper provides utility functions to convert between a hardware bitmap and a parcelable form for sending between processes, but the originating code must handle the conversion itself. This change moves the conversion so that it occurs seamlessly inside of the ScreenshotRequest class, and refactors the inputs to ScreenshotHelper slightly so that the ScreenshotRequest data class is what gets passed in. Bug: 264457397 Test: atest Merged-In: I1041bbcfdc5f5ece6e98bd0844017d4f3dc4e9f3 Change-Id: I1041bbcfdc5f5ece6e98bd0844017d4f3dc4e9f3
| * Remove SCREENSHOT_REQUEST_PROCESSOR FlagMatt Casey2022-12-161-10/+2
| | | | | | | | | | | | | | | | | | It's been released a while, everyone loves it. Bug: 254512719 Test: Build and run Test: atest TakeScreenshotServiceTest Change-Id: I5cdb47067fbd95a0b287b37d5cf0344ca49919c2
* | fixup! SystemUI: screenshot: open long screenshot activity for partial ↵Michael Bestas2023-04-161-0/+6
|/ | | | | | screenshots Change-Id: I718cb0d8516d72d55fd439b132c27e6edc81158c
* Merge "Fix screenshot swipe dismiss logs" into tm-qpr-devMiranda Kephart2022-10-141-2/+1
|\
| * Fix screenshot swipe dismiss logsMiranda Kephart2022-10-121-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we log a "swipe dismiss" event whenever we animate to the side, even if it wasn't caused by a swipe -- e.g. if the UI times out, we log both a "timeout" and a "swipe dismiss" event. This change fixes the logging logic so that we only log swipe dismiss if it was caused by a swipe/fling, as well as adding a couple of missing dismissal logs in edge cases. Bug: 252823661 Test: atest DraggableConstraintLayoutTest Change-Id: I437de637e606f4d2fe806ca6dd6a397b4ca372c6
* | Remove partial screenshot codeMiranda Kephart2022-09-271-6/+0
|/ | | | | | | | | | | | | It's broken currently, is extremely difficult to access, and will need to be heavily rewritten/refactored anyway if we decide to bring it back. Fix: 249325548 Test: adb shell input keycombination -t 300 META_LEFT CTRL_LEFT SHIFT_LEFT S (now takes a regular screenshot) Change-Id: I2cde564f6369b88bd4c6b20a9eecf8172fae7e7a
* Fix double call to ScreenshotControllerMark Renouf2022-08-291-0/+1
| | | | | | | | | | | | | When SCREENSHOT_REQUEST_PROCESSOR is enabled, the request is dispatched via RequestProcessor callback. This should return without following the original code path without the flag enabled. Added a test case to ensure the request is only forwarded once. Bug: 159422805 Test: atest TakeScreenshotServiceTest Change-Id: I8df2dd8e97e1aadde9bbeb141fe29940f9b6a5ba
* Adds test coverage for TakeScreenshotServiceMark Renouf2022-08-241-22/+24
| | | | | | Test: atest TakeScreenshotServiceTest Bug: 159422805 Change-Id: I2dce0852c7f2ab178faa09c69e2bc7810a0a9098
* Merge "Make mScreenshotController final and @NonNull" into tm-qpr-devMark Renouf2022-08-231-9/+3
|\
| * Make mScreenshotController final and @NonNullMark Renouf2022-08-191-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simplifies the code by removing the need to null check altogether. Until the service is onDestroy()'d, it should be capable of handling requests, since it may be rebound before this. Nulling the field in onDestroy is also unneccesary. Making the field final removes the risk of NPE entirely. Note: this also allows mScreenshot.onDestroy() to actually be called, as is this is never executed. (This was part of my change introduced in commit b283231) Test: manual; Take screenshots, dismiss and immediately take another Test: monkey test, see bug Fix: 242881882 Change-Id: I2a25fd4311f2fc7d5802a5d2a9bd8af64f845868
* | Initial work profile screenshot policy handlingMark Renouf2022-08-221-15/+25
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a request is received, screen contents are inspected to determine the most appropriate owner. If the primary content belongs to a work profile app, the screenshot will be isolated to the task content. See: go/work-profile-screenshots for details. This change also enables the foreground app package name to be provided with uievent logging. Additional functionality to follow. To activate, enable the flag WORK_PROFILE_SCREENSHOT_POLICY adb shell cmd statusbar flag 1301 on This also requires the flag SCREENSHOTS_REQUEST_PROCESSOR adb shell cmd statusbar flag 1300 on Bug: 159422805 Bug: 231957192 Bug: 200294244 Test: atest RequestProcessorTest manual; enable flags, take screenshot of launcher take screenshot of work profile app observe logs and screenshot content Change-Id: Idc74b04ddd449bfd9765ab9a456e9f9344c3aa2c
* More minor cleanups to ScreenshotRequestMark Renouf2022-08-121-2/+2
| | | | | | | | | | | | | * Adds screenshotType into the request instead of relying on the Message it is sent in (msg.what). * Adds a constructor which accepts type, source and topComponent * Adds more @IntDef annotations to `int` constructor args Bug: 231957192 Test: atest ScreenshotHelperTest Change-Id: If4bf8ef1b889e4e7b2fabf195a538a13664cce12
* Screenshot request processorMark Renouf2022-08-021-1/+16
| | | | | | | | | | | | | | | | | | | Inserts a preprocessing stage to screenshot request handling to contain support for new features. This new branch is guarded by the flag 'SCREENSHOT_REQUEST_PROCESSOR'. To enable: adb shell cmd statusbar flag 1300 on No other functional changes should be observed. Bug: 231957192 Bug: 200294244 Test: atest RequestProcessorTest Test: manual; enable flags, take screenshots Change-Id: I2fb26f9bf30513199b7e6d5cb97f6ccf99fcc0eb
* Use MediaPlayer in a background thread.Matt Casey2022-06-031-2/+1
| | | | | | | | | The intitial sound loading is slow so needs to be async. Bug: 231494899 Test: Manual verification including logs for timing, also requesting a lot of screenshots very fast to ensure it doesn't fall over. Change-Id: I011093e5a96912e52a16e957c44f1d899022ae13
* Add logs for clipboard and screenshotsMiranda Kephart2022-05-201-0/+2
| | | | | | Bug: 227744473 Test: make statsd_testdrive && $ANDROID_HOST_OUT/bin/statsd_testdrive 90 Change-Id: I4937237acad74b281610f9dc256a83ad0baee8b2
* Add missing enterprise updatable strings in SysUIkholoud mohamed2022-05-111-7/+19
| | | | | | | | Bug: 231592687 Fixes: 231592329 Fixes: 231576660 Test: manual Change-Id: I45a087e83b2116917b1681e3e21c5db40cdf4167
* Prevent screenshot when admin disable screenshots for all usersAlex Johnston2022-04-271-2/+17
| | | | | | | | | | | | * An IT admin has the ability to disable screenshots for all users when the device has a DO or COPE PO * When screenshots are disabled for all users, prevent a screenshot from being taken instead of taking a black screenshot Bug: 217558483 Test: Manual testing with TestDPC Change-Id: I167996bb337cc906b5475089f674fd9c37dff808
* Provide game task bitmap to TakeScreenshotService as screenshotXiang Wang2022-03-041-2/+1
| | | | | | | | | | * Move the BitmapUtil to com.android.internal package * Remove bitmap result from GameSession#takeScreenshot API Bug: 219992742 Test: atest GameServiceProviderInstanceImplTest Change-Id: I4bf29d623f781434ec7ffe4443e658880c31e619 Move the BitmapUtil to com.android.internal package
* Add clipboard overlay prototypeMiranda Kephart2022-01-121-2/+2
| | | | | | | | | | | | Adds a floating window/overlay (similar to screenshots) when something is copied to the clipboard. Opens Markup or a lightweight test editing activity (as appropriate) when edit is tapped. Bug: 195554988 Test: manual (tested copying text/images, and interactions with screenshots) Change-Id: I02aff237a1245ed2fed130d5e43112472d320a9c
* Add RECEIVER_EXPORTED flags to screenshotsMiranda Kephart2022-01-061-1/+2
| | | | | | | | | | | | | | | | Builds on T+ require either the RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED flag to be set when registering a broadcast receiver. Recently a change went in to change from logging a warning to throwing an error, causing sysui to crash when screenshots are taken. This change adds the RECEIVER_EXPORTED flag to screenshot code. Bug: 213406883 Fix: 213406883 Test: verified that warnings no longer appear and sysui does not crash when taking a screenshot Change-Id: I0fa1c2272f1a994e51945be5f6c67cdccbb84cc2
* Add package name to screenshot from overviewMiranda Kephart2021-10-081-4/+5
| | | | | | | | | Bug: 201080390 Fix: 201080390 Test: make statsd testdrive && $ANDROID_HOST_OUT/bin/statsd_testdrive -terse 90 Change-Id: Ice56c94634560d1ae65f75b549f4ccd2eadb5c9c
* Simplify UI and animation choreography a bitMark Renouf2021-01-271-17/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | A number of changes to improve the robustness of the startup/reset/dismiss process of the screenshot UI. Brief summary: Use visibility=invisible always for preview image Wait for pre-draw to start animation Apply initial config to "interesting changes" tracker Rename: mOnCompleteAction -> mOnDismissedAction Rease more resources earlier at shutdown Remove some uneccessary main thread deferrals resetScreenshotView -> finishDismiss Resolve some cases where reset is called multiple times on exit Update window token usage and apply to scroll capture at window attach Simplified animation parameters, coordinate systems, etc. Bug: 174509231 Bug: 174682382 Test: manual; take a screenshot, dismiss, share, edit, swipe away Test: manual; open overview, tap screenshot Change-Id: I3b84da3592970ac5c2a5eb34326eabaef003993f Merged-In: I3b84da3592970ac5c2a5eb34326eabaef003993f
* Merge "Add shared transitions from screenshot to markup"Miranda Kephart2021-01-191-1/+3
|\
| * Add shared transitions from screenshot to markupMiranda Kephart2021-01-131-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Release screenshot WindowContext when process endsMiranda Kephart2021-01-121-0/+3
|/ | | | | | | | | | | Bug: 176600157 Fix: 176600157 Test: manual -- reproducible by taking a screenshot several times (5-10) in quick succession, and observing crash in logs. Crash no longer occurs when we release the WindowContext when the screenshot process is destroyed. Change-Id: I33047ffb03867f65b591a1b43f6a56d49093fc0e
* Revert "Add shared transitions for screenshot->markup"Miranda Kephart2021-01-061-3/+1
| | | | | | | | This reverts commit 6b330ef7eec82acae8ae5b4d503d0f6745f49455. Reason for revert: cause of bug: 176874121 Change-Id: Icc87484f7cbe26bbe479fc47dca0aadae82e377b
* Add shared transitions for screenshot->markupMiranda Kephart2021-01-051-1/+3
| | | | | | | | Bug: 170138961 Bug: 159419046 Test: manual Change-Id: I3a9c7487cbc36a4a7183030d2e3aa432958f7e1a
* Screenshots logging updateMark Renouf2020-12-021-4/+56
| | | | | | | | | | | | 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
* Misc cleanups and simplificationsMark Renouf2020-12-011-73/+75
| | | | | | | | | | | | | | | | TakeScreenshotService migrated to Handler.Callback skip posting to handler for binder call ScreenshotController create WindowContext from DisplayContext simplified configuration change checking Test: adb shell input SYSRQ change system dark mode, repeat open overview, tap screenshot action Change-Id: I18fc23f9e00cc0a455335d6de6975ded669b6629
* Notify if screenshot fails due to locked deviceMiranda Kephart2020-11-231-2/+10
| | | | | | | | | | | | | Currently, if the user tries to take a screenshot while the device is locked, we fail silently. This change adds an error notification to tell the user what happened. Bug: 173815237 Fix: 173815237 Test: manual (tried with user locked and unlocked; only change is additional notification when locked) Change-Id: I630d2d948b5e19e6b7e6e93bb965ef153baf13c9
* Close screenshot process on user switchedMiranda Kephart2020-11-161-2/+2
| | | | | | | | | | | | | | | | | Currently, we keep the process up even if the user switches, meaning that in some cases (if the user is switched while the screenshot UI is up) we will save images to the wrong profile. This change makes ScreenshotHelper listen for user switches and close the screenshot service, so that a new screenshot is guaranteed to be constructed with the correct user's context. Bug: 170474245 Fix: 170474245 Test: manual -- verified bad state occurs if user switches within the timeout period, ensured that screenshots work immediately after switching with this change. Change-Id: I9d32d0928e6c2bda161d04555438d0dd7afef0ba
* Move dismiss animation into ScreenshotViewMiranda Kephart2020-11-111-1/+1
| | | | | | | | | | | | | | | | | Lets the view handle more of its own logic around dismissal, rather than needing to call back through ScreenshotController. Now just calls back once the dismissal is complete. This will make integrating the swipe dismissal code simpler. This also ensures that the view is reset and the service connection is ended after dismissing for any reason. Bug: 157223526 Test: manual (ensured the same behavior from dismissing through various means and if taking a second screenshot while the UI is already up). Change-Id: I7e15a9312a0b1c981733b70be24f0f1b22721d47
* Refactor GlobalScreenshotMiranda Kephart2020-10-211-4/+6
| | | | | | | | | | | | | | | | | | 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
* Animate out screenshot UI on back and CLOSE_SYSTEM_DIALOGSMatt Casey2020-07-241-1/+1
| | | | | | | Bug: 162036868 Bug: 160189912 Test: Screenshot, press back, observe animation. Change-Id: I0ab4d029315765cff76ee22a4556e0647b938e07
* Rearrange/rename GlobalScreenshot methodsMiranda Kephart2020-07-011-1/+1
| | | | | | | | | | | Moves methods to a more logical order (public/protected methods before private, make method order closer to logical flow) and renames the various takeScreenshot methods to better distinguish them from one another. Bug: 160325487 Test: manual (rearrangement/renaming only, no logical changes) Change-Id: I113608b9638383e615404dbfd89e032327f9e3ca
* Close screenshot UI on CLOSE_SYSTEM_DIALOGS intentMiranda Kephart2020-06-191-0/+21
| | | | | | | | | | | Bug: 158845370 Fix: 158845370 Bug: 148808304 Test: manual -- tapped search bar, took a screenshot, and then swiped up to home to verify that the home screen reappeared correctly Change-Id: I74d16e71392482185bb87d8f5d71ea93f38a40d6
* Remove legacy screenshot notifications flowMiranda Kephart2020-06-101-30/+5
| | | | | | | | | | 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
* Screenshot - pass bitmap as bundled hardware buffer from LauncherZak Cohen2020-06-031-5/+10
| | | | | | | | | | | | When passing a screenshot from Launcher to Sysui it should be passed as a hardware buffer inside a bundle to avoid copying the underlying pixels. Change also adds userid and component when a screenshot is passed. Bug: 157380566 Bug: 156757117 Test: local Change-Id: I531f1d1a41d179a257fe7202b68a6d1a78cc0f79
* Keep screenshot process boundMiranda Kephart2020-04-241-9/+20
| | | | | | | | | | | | | | | | | | | | 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
* Cleanup (remove ldap, reduce screenshot log level)Miranda Kephart2020-04-211-1/+1
| | | | | | Fix: 154631563 Test: manual (cleanup) Change-Id: If19ea21915cb3c09b55b28325d7df4101c8a391f
* Add screenshots loggingMiranda Kephart2020-04-171-11/+23
| | | | | | Bug: 150710005 Test: manual Change-Id: I54a37eb0a62234c6c53fc0f3c80e18e9ee269f12
* Turn screenshot corner flow onMiranda Kephart2020-03-051-7/+1
| | | | | | Bug: 147424031 Test: manual Change-Id: I9c09e79eb37235e850ca556ce03dcc6484b87580
* Turn screenshot corner flow on for droidfoodMiranda Kephart2020-02-211-1/+1
| | | | | | Bug: 147424031 Test: manual Change-Id: I608d30fa38390ba772c24744398689aa40ef7a01
* Screenshot helper - add method that allows the caller to supply bitmap.Zak Cohen2020-01-231-0/+19
| | | | | | | | | | | Add a method to screenshot helper that allows the caller to provide the bitmap to be treated as a screen shot. First use Overview can provide a task snapshot to use as a screenshot. Test: update tests, local Bug: 145297320 Change-Id: I4d21906212797bf394094d7a29208be02a6bfd7e
* Implement visual spec for screenshots corner flowMiranda Kephart2020-01-211-0/+1
| | | | | | | | Bug: 147423001 Test: tested behavior both in old and new flows (no change to notifications flow; visual changes to new flow) Change-Id: If3a170c73609edb4f74db81b9109d83cc160b206
* Fork GlobalScreenshot into notif vs corner flowsMiranda Kephart2020-01-131-4/+26
| | | | | | | | | | | | | | Moves GlobalScreenshot into two different files: GlobalScreenshot (with the new corner flow) and GlobalScreenshotLegacy (with the previous notifications flow). This is to allow easier iteration on the new flow; once it is fully tested, the notification/legacy version will eventually be removed. Bug: 137153302 Bug: 147423001 Test: tested old and new flows to ensure no user-visible changes; also tested smart screenshots in old flow to ensure no behavior change Change-Id: Ia776e2a7c2e8d0d298ea3e0f18f3419aa2b64415