From 122c4d2da0405be75ae8c249e19ba692722c6e13 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Thu, 27 Jan 2022 16:20:46 +0000 Subject: 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. These policies are used to enable features that allow for a less trusted interaction model between apps. See the bug for more details. Note: this backport does not include the OBSCURED option since its not needed for the security fix. Test: atest libgui_test InputDispatcherDropInputFeatureTest Bug: 197296414 Merged-In: I443741d5ab51a45d37fb865f11c433c436d96c1e Change-Id: I443741d5ab51a45d37fb865f11c433c436d96c1e --- libs/gui/LayerState.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libs/gui/LayerState.cpp') diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index a897d1025f..dfcef8fe7a 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -118,7 +118,7 @@ status_t layer_state_t::write(Parcel& output) const output.writeByte(frameRateCompatibility); output.writeUint32(fixedTransformHint); output.writeBool(isTrustedOverlay); - + output.writeUint32(static_cast(dropInputMode)); return NO_ERROR; } @@ -204,6 +204,9 @@ status_t layer_state_t::read(const Parcel& input) fixedTransformHint = static_cast(input.readUint32()); isTrustedOverlay = input.readBool(); + uint32_t mode; + mode = input.readUint32(); + dropInputMode = static_cast(mode); return NO_ERROR; } @@ -447,6 +450,10 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eTrustedOverlayChanged; isTrustedOverlay = other.isTrustedOverlay; } + if (other.what & eDropInputModeChanged) { + what |= eDropInputModeChanged; + dropInputMode = other.dropInputMode; + } if ((other.what & what) != other.what) { ALOGE("Unmerged SurfaceComposer Transaction properties. LayerState::merge needs updating? " "other.what=0x%" PRIu64 " what=0x%" PRIu64, -- cgit v1.2.3-59-g8ed1b