summaryrefslogtreecommitdiff
path: root/core/java/android/view/AttachedSurfaceControl.java
Commit message (Collapse)AuthorAgeFilesLines
* AttachedSurfaceControl: Add setTouchableRegion APIRobert Carr2022-01-241-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an API for setting touchable regions. This API allows a view hierarchy to allow touches to pass through its surface in certain regions. Touch pass through of course follows the regular rules about UID/PID origins and touchable region does not effect the calculation of the TOUCH_OBSCURED flag. Such an API has existed as @hide since the beginning of time, via ViewTreeObserver.ComputeInternalInsetsListener. The API has already been wrapped in the IME system, and in VoiceInteractionSession. Desire to make the API public is motivated by 3 use cases: 1. GameOverlayService UI code moving out of framework required for their UX (multiple small buttons in a large transparent overlay) 2. SurfaceControlViewHost: A common point request among people who ask me about SurfaceControlViewHost is to be able to embed the SurfaceControlViewHost in a SurfaceView which is "setZOrderOnTop(false)" (hole punching) so that the host hierarchy can draw on top of the embedded hierarchy in some regions. This is possible today, but there will be no way to receive input without input hole punching. 3. There may be cases where apps are using multiple Popup type windows which could be combined in to one. In general reducing HWC layer count this way will be a good trade off. It was considered to ViewTreeObserver.ComputeInternalInsetsListener directly but ultimately decided against it for a few reasons: 1. Obscure naming 2. Other fields not useful for our use cases. Because insets/touchable region linkage not a useful API concept for us 3. Forces dispatch model via callbacks which may or may not be useful for a given app. It was also considered to create a gatherTouchableRegion API mirroring gatherTransparentRegion. Such a concept (as setting root surface touchable regions) is not really composable though. For example maybe a parent view requires touch regions, then a child view one day starts removing them. The fact that input order is not simply reverse drawing order (since parents come before children in both) means there is no way to ensure this always cleanly composes as expected. Given this, it's better to expose a "global" API and require the app developer to understand how their components are fitting together, rather than invite a View implementer to subclass gatherTouchableRegion and allow someone to break them. Bug: 213603716 Bug: 214239892 Test: SetTouchableRegionTest, SurfaceControlViewHostTests Change-Id: Ie49caec964455b7129daa2aaa6990a368309f8e9
* Rename getSurfaceTransformHint API and switch to using NDK transform constantsVishnu Nair2021-10-111-16/+19
| | | | | | | | | | | | | | 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
* Expose getSurfaceTransformHint APIVishnu Nair2021-09-211-0/+68
| | | | | | | | | | | | The transform hint can be used by a buffer producer to pre-rotate the rendering such that the final transformation in the system composer is identity. This can be very useful when used in conjunction with the h/w composer HAL in situations where it cannot handle rotations or handle them with an additional power cost. Bug: 196167822 Test: atest AttachedSurfaceControlTest Change-Id: Idb7fcf58ecbcc22cd43c226ee4faad958c265e72
* AttachedSurfaceControl: Respond to API feedback.Robert Carr2021-05-051-0/+56
"Root" is eliminated from the interface name as it is a property of the object and not the interface, but remains highlighted in the getters to express the relationship between the called and returned object. Bug: 185365821 Test: Existing tests pass Change-Id: I163fc23f2c37c984ef3ffeb7514c4d8c1c1a3f90