summaryrefslogtreecommitdiff
path: root/core/java/android/view/SurfaceControl.java
Commit message (Collapse)AuthorAgeFilesLines
* Expose transaction idPablo Gamito2022-06-101-0/+10
| | | | | | | | We will need to dump the transaction id in transition traces to be able to reliably associated the start and end of a transition to the states in the SF trace. Bug: 230462538 Test: N/A Change-Id: I2a040503d9e1f4f4636549bae6b7fe12d5632049
* Fix colorSpace lose during screen rotation.Sally Qi2022-04-291-2/+2
| | | | | | | | - setColorSpace only supports Display_p3 and sRGB Bug: 229735367 Test: test picture rotation and check log Change-Id: If2d6ab965be28d35a3adf330e7050e16e40f9620
* Propagate HDR information to screenshot animation.Alec Mouri2022-04-271-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The screenshot animation must know whether the screenshot contains HDR layers so that it can correctly inform SurfaceFlinger whether its layer can be dimmed. This is due to the interplay of the following: 1. Devices are now able to configure DisplayManager to send significantly lower SDR white points relative to display brightness to SurfaceFlinger when HDR is simultaneously on-screen. 2. AIDL composer is required to support per-layer dimming, so that SDR layers may be dimmed to preserve the relative luminance of HDR video content. 3. Because the screenshot does not contain an HDR transfer function, SurfaceFlinger will treat the layer as SDR, and attempt to dim it. 4. Screen rotations containing HDR layers must request SurfaceFlinger to present the rotated screenshot at display brightness, to override (3) above. Otherwise, HDR content captured in the screenshot will suddenly dim during the rotation animation. 5. Also due to (3), DisplayManager no longer thinks that there is HDR content on screen, so a prior patch treated layers that requested to to be dimmed to be reported as HDR (I1d1b0dcaf230300ca34b84ea407d0817feb2c664). Otherwise, the display brightness will decrease during the animation and ramp back up afterwards. 6. But because of (5), screenshots that only contained SDR layers were incorrectly treated as HDR, which caused the display brightness to ramp up during the animation. This patch fixes (6) by allowing for the screenshot animation to learn whether the screenshot contains HDR layers, and request dimming capabilities accordingly. Bug: 230068567 Test: screen rotation Change-Id: I6bbb2433f976e368bfe2c04e084e110cfb551c15
* Disable HDR dimming when screen rotates.Sally Qi2022-03-301-0/+23
| | | | | | | | | | | | | | | | | | | | | - Disable dimming for screenshot layer This is to fix HDR flicker in picture-in-picture mode. Because the screenshot layer of rotation is an SDR image containing tone-mapping HDR content, and this would cause HDR part to be suddenly dimmed during rotation along with the entire screenshot, even though DisplayManager maintains different HDR and SDR while white points during during rotation animation. Therefore, we add a hidden api to allow to dim a particular layer. This effectively sets the white point for that layer to be same as the display brightness. Then the screenshot with this flag can be used a part of the rotation animation in order to remove flikering effects. Bug: 224860402 Test: check HDR vidoes when rotation Change-Id: Ib5c02635928cb9779e6f7968d2ec0ac9e659420b Merged-In: Ib5c02635928cb9779e6f7968d2ec0ac9e659420b
* Add setBuffer w/ release callbackJohn Reck2022-03-181-3/+54
| | | | | | | | | Also tweak SyncFence#getSignalTime javadocs Fixes: 220897032 Bug: 222095580 Test: SurfaceControlTest Change-Id: I83c000e1699c95b73ac7b41815e1798475c1a778
* Add argument checks in setScale and setCropGarfield Tan2022-03-081-0/+4
| | | | | | | | | They are now public API, so they should perform the same checks as in respective calls with ASurfaceTransaction. Bug: 210837722 Test: atest SurfaceControlTest Change-Id: I1f17f8402dc116a419189f31faf351ffa967ecda
* Merge changes from topics "cherrypick-sv-changes-8cq54jfvx9", ↵Vishnu Nair2022-02-241-0/+22
|\ | | | | | | | | | | | | | | "sv-changes-tm-dev" into tm-dev * changes: SurfaceView: Synchronize all surface view changes with VRI draw SurfaceView: Avoid destination frame updates on multiple threads 1/2
| * SurfaceView: Avoid destination frame updates on multiple threads 1/2Vishnu Nair2022-02-191-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The caller such as SurfaceView can optionally apply destination frame changes if they wish to synchronize buffer scale with other scales in the hierarchy. This is hard to synchronize if the buffer scale changes, since in fixed scaling mode we want the destination frame to be applied when a buffer of the new size is queued. This approach is brittle because SurfaceView does not have control over the buffer production and the app can get into a scenario where there is scaled incorrectly. Fix this by configuring BBQ to always apply destination frame changes or always defer to the caller. If the scaling mode is freeze, then BBQ will set a flag to ignore the destination frame. This allows us to synchronize destination frame changes with scale applied by a parent and avoid unwanted scaling if the scaling mode changes to freeze. Test: atest SurfaceViewTest Test: go/wm-smoke Bug: 217973491 Change-Id: I5226c304bae9dde890306f8528dfeabf6b015a32
* | Merge "Remove the current input focused window when ANR" into tm-devTreeHugger Robot2022-02-241-0/+12
|\ \
| * | Remove the current input focused window when ANRHQ Liu2022-02-211-0/+12
| |/ | | | | | | | | | | | | | | | | | | | | When a freeform app launched and focused, but its window is not ready, the input focus stays on the window of the previously focused freeform app. The focus should be removed from the previously foccused app, so ANR can be triggered correctly. Bug: 216852742 Test: atest AnrTests#slowOnCreateWithKeyEventTriggersAnr Change-Id: Id00c147ffab9b11fb2abdf0f3020bc017a31bea7
* / Deprecate SurfaceControl.Transaction#setGeometryVishnu Nair2022-02-181-0/+4
|/ | | | | | | | | | The java API is not consistent with the now deprecated native ASurfaceTransaction_setGeometry API. The existing functionality can be better composed with the available API to set position, scale, transform and crop. Bug: 220336806 Test: presubmit Change-Id: Ib2bf75876e2ce5e700da3085fab66218723ff54e
* Merge "Correct JankData.PREDICTION_ERROR meaning"Ady Abraham2022-02-171-3/+1
|\
| * Correct JankData.PREDICTION_ERROR meaningAdy Abraham2022-02-151-3/+1
| | | | | | | | | | | | | | | | | | JankData.PREDICTION_ERROR is asserted when SF vsync calculation is incorrect and should be attributed to SF missed frames. Bug: 211763914 Test: SF unit tests Change-Id: I332480ad1017c220501ed938319f8b2fbfe22826
* | Add setBuffer w/ SyncFenceJohn Reck2022-02-141-2/+41
|/ | | | | | Test: atest android.view.cts.SurfaceControlTest Bug: 217776226 Change-Id: Ia40947a8cc056d3fcc5569e522524af61c4e5b1b
* Merge "Add more docs per API council feedback"TreeHugger Robot2022-02-111-3/+14
|\
| * Add more docs per API council feedbackJohn Reck2022-02-101-3/+14
| | | | | | | | | | | | Test: make Fixes: 218314633 Change-Id: I49fa3defa7907f48e650618295f7db758e247a2a
* | getDisplayDecorationSupport: return more detailed infoLeon Scroggins III2022-02-091-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Call the updated native version of getDisplayDecorationSupport (added in I961051c0a660b596039ac04b546040764ee20d34), and convert the NDK struct into a Java class. Depend on the graphics AIDLs, which now have Java backends. A future CL will update SysUI to call the new API. Add a PixelFormat for R_8 to correspond to the native version. This will allow SysUI to use COLOR_MODE_A8 when the HAL reports R_8. If64fd6924960f592b7a211371bc2ca6536ae34f7 demonstrates using this. Bug: 216644902 Test: manual Change-Id: I0e34c6d6e369fda0a96231ab38c3bd5f3bfe3e06
* | Merge "Add gatherPendingTransactions in BBQ"Chavi Weingarten2022-02-091-3/+7
|\ \ | |/ |/|
| * Add gatherPendingTransactions in BBQchaviw2022-02-081-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | Instead of applying the pending transactions when a frame wasn't rendered, we gather the transactions and merge them with the transaction that will be used to sync. This is to ensure these frames are sent to the caller that requested the sync so they can ensure it's applied at the correct time. Test: Builds and run Bug: 200284684 Change-Id: I087c67138f31cc93e79df42c29464ab4f7989d52
* | Add setDataSpace SurfaceControl APIJohn Reck2022-02-081-3/+25
| | | | | | | | | | | | | | | | | | Also change DataSpace from long to int (HAL & native are both ints) Bug: 217776226 Fixes: 218320444 Test: make && SurfaceControlTest#testSurfaceTransaction_setDataSpace Change-Id: Ic2b9ccb1d0ba3c1d049839310b4fef0881a3d2e2
* | Merge "Adjust where TransactionCommittedListener lives"John Reck2022-02-071-0/+11
|\ \
| * | Adjust where TransactionCommittedListener livesJohn Reck2022-02-041-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | android.view.TransactionCommittedListener sounds generic & broad, but this is really very specific to a single callback in SurfaceControl. So move the listener there. Test: make Bug: 217776226 Change-Id: Ib51a525c5b5ca5fd5c08b667ade6742774047131
* | | Merge "Revert "Revert "Boot time resolution changes in framework"""TreeHugger Robot2022-02-021-2/+39
|\ \ \ | |/ / |/| |
| * | Revert "Revert "Boot time resolution changes in framework""Kriti Dang2022-02-021-2/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 5f415e6190891bc5193a4a974aa26c62b6e409df. Reason for revert: Fixed the underlying issue BUG: 217335654 Test: verified on forrest Change-Id: I599ed7c6ed8f3483b68653cfb35ddb1effb01efb
* | | Merge "Revert "Boot time resolution changes in framework""Shubham Dubey2022-02-011-39/+2
|\| |
| * | Revert "Boot time resolution changes in framework"Shubham Dubey2022-02-011-39/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit aef5aa78b5030fa33783af26591772ed058acebf. Reason for revert: Causing boot failures BUG: 217335654 Change-Id: I41e47b88ef7663804de4a04928be4eb08ad83f73
* | | Merge "Boot time resolution changes in framework"TreeHugger Robot2022-02-011-2/+39
|\| | | |/ |/|
| * Boot time resolution changes in frameworkKriti Dang2022-01-311-2/+39
| | | | | | | | | | | | | | | | | | Adding API and changes to incorporate boot-time resolution HAL APIs Bug: 209598222 Test: atest CtsBootDisplayModeTestCases Change-Id: I7081af903d8259cf7c0009238e7968d458ff3325
* | Merge "WM: Call Transaction#sanitize"Rob Carr2022-01-251-0/+8
|\ \
| * | WM: Call Transaction#sanitizeRobert Carr2022-01-221-0/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Various elements of the Transaction interface require a permission in order to apply. In particular the setTrustedOverlay and setInputWindowInfo fields. These permission checks are implemented by checking the PID and the UID of the process which sent the transaction. Unfortunately widespread use of transaction merging makes this inadequate. At the moment IWindowSession#finishDrawing seems to be the only boundary on which transactions move from client to system processes, and so we expose a sanitize method and use it from there to resolve the situation in an easily backportable way. Moving forward it likely make sense to move security sensitive interfaces off of Transaction. Most of the things behind permissions currently are not truly security sensitive, more of just a request not to use them. It was also considered to sanitize transactions at all process boundaries through writeToParcel, however this could be disruptive as previously permissioned processes (WM and SysUI) could freely exchange transactions. As the change needs to be backportable the lowest risk option was chosen. Bug: 213644870 Test: Existing tests pass Change-Id: I8d4a0ebe0cdfaed7ff1ad862724d49a14ed04478
* / Pipe display install orientation 2/2Vishnu Nair2022-01-221-3/+6
|/ | | | | | | | | | This is a step to move the layout logic to the client side. We won't invoke IWindowSession#relayout then, and the client should be able to set the transform hint on its own. Bug: 161810301 Test: presubmit Change-Id: Ib12a76fcc9906b3d9c487fb89bbe4520c682379a
* DisplayManager: Add an API to query for DISPLAY_DECORATONLeon Scroggins III2022-01-071-0/+15
| | | | | | | | | | | | | Tunnel through SurfaceControl to determine whether the HWC has this capability. This allows clients (i.e. SystemUI) to know whether they can use Composition.DISPLAY_DECORATON. If so, they may want to render differently (i.e. in A8). See Ib948c38ee189877eda675a6342cb70099f66122b for an example. Bug: 193170859 Test: manual Test: TODO Change-Id: I9904452b6408199bb1f86de9e21132e4d4444e1a
* Reland "Add/plumb SurfaceControl.DISPLAY_DECORATION"Leon Scroggins2021-12-281-0/+24
| | | | | | | | | | | | | | | The first time this topic landed, it resulted in b/212402133. We avoid running into this bug with Ib11d46439db57b90486bad07dd90f2cf0822182a. Original commit message: When passed to native, this flag will tell a Layer that it should use Composition.DISPLAY_DECORATION. Bug: 193170859 Test: manual Change-Id: I7f1685eb7dc57271f532065dcd1d4dcc449c5cb0
* Revert "Add/plumb SurfaceControl.DISPLAY_DECORATION"Leon Scroggins2021-12-231-24/+0
| | | | | | | | | | | | | | | Revert "Add eLayerIsDisplayDecoration flag" Revert submission 16511727-wm_DISPLAY_DECORATION Reason for revert: b/211835607 Reverted Changes: I1da3199ba:Allow changing composition from DISPLAY_DECORATION... I1fae74b36:Update documentation for DISPLAY_DECORATION I1da03a88f:Add eLayerIsDisplayDecoration flag I7f22dfd03:Add/plumb SurfaceControl.DISPLAY_DECORATION Change-Id: Ieef6e12206aaab6d3bcd2819a139ae1f201b2f8d
* Add/plumb SurfaceControl.DISPLAY_DECORATIONLeon Scroggins III2021-12-201-0/+24
| | | | | | | | | When passed to native, this flag will tell a Layer that it should use Composition.DISPLAY_DECORATION. Bug: 193170859 Test: manual Change-Id: I7f22dfd03d86786afee078a95f0af590be0bbdfd
* Reduce SurfaceControl feature gap to NDK APIJohn Reck2021-12-091-9/+126
| | | | | | | Bug: 200697201 Test: atest android.view.cts.SurfaceControlTest Change-Id: I1d0cff355714acb5668952b3d7f6fc0c15952523
* Remove frame rate flexibility tokenMarin Shalamanov2021-11-011-23/+0
| | | | | | | | | | | | Remove the frame rate flexiblity token which can be replaced with DisplayManager.setRefreshRateSwitchingType( DisplayManager.SWITCHING_TYPE_ACROSS_AND_WITHIN_GROUPS); DisplayManager.setShouldAlwaysRespectAppRequestedMode(true); Bug: 175371491 Test: m Change-Id: Ifde95dcdb936e39f894a0ca225ec49f39ca04e62
* Merge "ViewRootImpl: Replace usage of orientation with buffer transform for ↵Vishnu Nair2021-10-141-3/+4
|\ | | | | | | | | | | | | | | transform hint" into sc-v2-dev am: fb19c89e4d am: dd8c200bd2 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16040767 Change-Id: If7b74fa458c0a2ee14b876a2b3b8fe393fcc85cb
| * ViewRootImpl: Replace usage of orientation with buffer transform for ↵Vishnu Nair2021-10-121-3/+4
| | | | | | | | | | | | | | | | transform hint Fixes: 202797234 Test: atest VulkanPreTransformTest#testVulkanPreTransformNotSetToMatchCurrentTransform Change-Id: Iddb2e0b045096b4b86c0bc3f8222b61de67994bc
* | Merge "Rename getSurfaceTransformHint API and switch to using NDK transform ↵TreeHugger Robot2021-10-121-0/+70
|\| | | | | | | | | | | | | | | constants" into sc-v2-dev am: 492bdf0074 am: 030cee8122 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15937682 Change-Id: Ib479110b56925fc373eeee1a2398fd9ad2e46fb7
| * Merge "Rename getSurfaceTransformHint API and switch to using NDK transform ↵TreeHugger Robot2021-10-121-0/+70
| |\ | | | | | | | | | constants" into sc-v2-dev
| | * Rename getSurfaceTransformHint API and switch to using NDK transform constantsVishnu Nair2021-10-111-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NDK exposes ANativeWindowTransform/NATIVE_WINDOW_TRANSFORM_*. These constants are aligned with HAL definitions and are used internally to specify buffer transforms. Native consumers of the transform hint are expected to generate ANativeWindowTransform from the hint. Aligning the SDK and the NDK transform values will make the API less confusing. Bug: 196167822 Test: atest AttachedSurfaceControlTest Change-Id: Ib20be045f6c8c6d7befef93a839a27098da55ffa
| * | [DO NOT MERGE] Dump SurfaceControl's layerId to protoPablo Gamito2021-09-301-0/+2
| | | | | | | | | | | | | | | | | | | | | Test: Data appears in Winscope Bug: 197712697 Change-Id: Ida47f5506a56b19902fcaafc644d1df34ce6c4a3 (cherry picked from commit 120ee45bd05755f5325ba33b706f2c1e431122dc)
| * | [DO NOT MERGE] Expose SurfaceControl's native mLayerId property to JavaPablo Gamito2021-09-301-2/+12
| |/ | | | | | | | | | | | | | | | | Expose the layerId so that we can dump it in WindowManager proto traces. This is to allow us to link windows to their respective layer accurately and consistently from the trace data. This enables Flicker as a Service (go/wm-fass) to tag and assocaite animations across the WindowManager trace and SurfaceFlinger trace and allows us to better display and associate errors across both WM and SF hierarchy views in Winscope. Test: N/A Bug: 197712697 Change-Id: Ic11f33b8dc3e134d6c19ac68bfe03f801af04d06 (cherry picked from commit 9e98140a17e2e76a177112d993e307396f028a2c)
* | Merge "Expose TransactionCommittedCallback to Java"Chavi Weingarten2021-09-271-0/+29
|\ \
| * | Expose TransactionCommittedCallback to Javachaviw2021-09-241-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By exposing TransactionCommitCallback, we can allow tests to get a callback when a buffer has actually been latched instead of adding timeouts Bug: 192284443 Test: DisplayHashManagerTest#testGenerateAndVerifyDisplayHash Change-Id: Ic1c1a4d6c83191f64978a94fbd8076ac839197e6
* | | Merge "WM: Handle primary display orientation when calculating the transform ↵Vishnu Nair2021-09-231-0/+10
|\ \ \ | |/ / |/| / | |/ | | | | | | | | hint" into sc-v2-dev am: e84c7c6393 am: 5619ebfa14 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15838995 Change-Id: I54e16ca4058f3f90bf6e73a10ce8e6fd57e9d733
| * Merge "WM: Handle primary display orientation when calculating the transform ↵Vishnu Nair2021-09-231-0/+10
| |\ | | | | | | | | | hint" into sc-v2-dev
| | * WM: Handle primary display orientation when calculating the transform hintVishnu Nair2021-09-221-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Query the surface flinger property ro.surface_flinger.primary_display_orientation to determine the primary display's install orientation. If the window is on the primary display, then update the transform hint passed on to the client. Bug: 196167822 Test: check initial buffer transforms on displays with a different install orientation Change-Id: Idf010cd6be73172ba708820f87046c3ba3cf8001
| * | SurfaceControl: Add setDropInputMode apiVishnu Nair2021-09-201-2/+15
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces an API to drop input events on this SurfaceControl. This policy will be inherited by its children. The caller must hold the ACCESS_SURFACE_FLINGER permission. Options include: ALL: SurfaceControl and its children will not receive any input regardless of whether it has a valid input channel. OBSCURED: SurfaceControl and its children will not receive any input if the layer is obscured, cropped by its parent or translucent. These policies are used to enable features that allow for a less trusted interaction model between apps. See the bug for more details. Test: atest libgui_test InputDispatcherDropInputFeatureTest Bug:197364677 Merged-In: Ifcb4133306a43874e74e8fb0f42b60842daf6f25 Change-Id: Ifcb4133306a43874e74e8fb0f42b60842daf6f25