From 77daf700ce9707d147d2cc3075d6e6bbc1a4280a Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Thu, 27 Jan 2022 17:13:18 +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/SurfaceComposerClient.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libs/gui/SurfaceComposerClient.cpp') diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 96da8efd19..6ffd25d227 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -1669,6 +1669,21 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setTrust return *this; } +SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDropInputMode( + const sp& sc, gui::DropInputMode mode) { + layer_state_t* s = getLayerState(sc); + if (!s) { + mStatus = BAD_INDEX; + return *this; + } + + s->what |= layer_state_t::eDropInputModeChanged; + s->dropInputMode = mode; + + registerSurfaceControlForCallback(sc); + return *this; +} + SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setApplyToken( const sp& applyToken) { mApplyToken = applyToken; -- cgit v1.2.3-59-g8ed1b