diff options
| author | 2021-09-17 12:16:08 -0700 | |
|---|---|---|
| committer | 2021-09-17 12:16:08 -0700 | |
| commit | 9cf4a4d4e57d059a4e4119f0a8f2a8be237f28c2 (patch) | |
| tree | d2e108395e328d83a579ed1cff54d803329b0342 /services/surfaceflinger/Layer.cpp | |
| parent | 133b3bc5a2bb7dec195a571ce718410d3b45d800 (diff) | |
SurfaceControl: Add setDropInputMode api
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
Change-Id: I443741d5ab51a45d37fb865f11c433c436d96c1e
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index ef6f115fdc..d549fe9966 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -135,6 +135,7 @@ Layer::Layer(const LayerCreationArgs& args) mDrawingState.postTime = -1; mDrawingState.destinationFrame.makeInvalid(); mDrawingState.isTrustedOverlay = false; + mDrawingState.dropInputMode = gui::DropInputMode::NONE; if (args.flags & ISurfaceComposerClient::eNoColorFill) { // Set an invalid color so there is no color fill. @@ -2541,6 +2542,14 @@ wp<Layer> Layer::fromHandle(const sp<IBinder>& handleBinder) { return handle->owner; } +bool Layer::setDropInputMode(gui::DropInputMode mode) { + if (mDrawingState.dropInputMode == mode) { + return false; + } + mDrawingState.dropInputMode = mode; + return true; +} + // --------------------------------------------------------------------------- std::ostream& operator<<(std::ostream& stream, const Layer::FrameRate& rate) { |