Loading libs/gui/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ cc_library_headers { filegroup { name: "guiconstants_aidl", srcs: [ "android/**/DropInputMode.aidl", "android/**/TouchOcclusionMode.aidl", ], } Loading libs/gui/LayerState.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -70,7 +70,8 @@ layer_state_t::layer_state_t() isTrustedOverlay(false), bufferCrop(Rect::INVALID_RECT), destinationFrame(Rect::INVALID_RECT), releaseBufferListener(nullptr) { releaseBufferListener(nullptr), dropInputMode(gui::DropInputMode::NONE) { matrix.dsdx = matrix.dtdy = 1.0f; matrix.dsdy = matrix.dtdx = 0.0f; hdrMetadata.validTypes = 0; Loading Loading @@ -175,6 +176,7 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.writeBool, isTrustedOverlay); SAFE_PARCEL(output.writeStrongBinder, releaseBufferEndpoint); SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(dropInputMode)); return NO_ERROR; } Loading Loading @@ -305,6 +307,10 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.readBool, &isTrustedOverlay); SAFE_PARCEL(input.readNullableStrongBinder, &releaseBufferEndpoint); uint32_t mode; SAFE_PARCEL(input.readUint32, &mode); dropInputMode = static_cast<gui::DropInputMode>(mode); return NO_ERROR; } Loading Loading @@ -563,6 +569,10 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eDestinationFrameChanged; destinationFrame = other.destinationFrame; } 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, Loading libs/gui/SurfaceComposerClient.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -1739,6 +1739,21 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDesti return *this; } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDropInputMode( const sp<SurfaceControl>& 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; } // --------------------------------------------------------------------------- DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp<IBinder>& token) { Loading libs/gui/android/gui/DropInputMode.aidl 0 → 100644 +45 −0 Original line number Diff line number Diff line /** * Copyright (c) 2021, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.gui; /** * Input event drop modes: Input event drop options for windows and its children. * * @hide */ @Backing(type="int") enum DropInputMode { /** * Default mode, input events are sent to the target as usual. */ NONE, /** * Window and its children will not receive any input even if it has a valid input channel. * Touches and keys will be dropped. If a window is focused, it will remain focused but will * not receive any keys. If the window has a touchable region and is the target of an input * event, the event will be dropped and will not go to the window behind. ref: b/197296414 */ ALL, /** * Similar to DROP but input events are only dropped if the window is considered to be * obscured. ref: b/197364677 */ OBSCURED } libs/gui/include/gui/LayerState.h +5 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <gui/ITransactionCompletedListener.h> #include <math/mat4.h> #include <android/gui/DropInputMode.h> #include <android/gui/FocusRequest.h> #include <gui/ISurfaceComposer.h> Loading Loading @@ -117,6 +118,7 @@ struct layer_state_t { eAutoRefreshChanged = 0x1000'00000000, eStretchChanged = 0x2000'00000000, eTrustedOverlayChanged = 0x4000'00000000, eDropInputModeChanged = 0x8000'00000000, }; layer_state_t(); Loading Loading @@ -247,6 +249,9 @@ struct layer_state_t { // releaseCallbackId and release fence to all listeners so we store which listener the setBuffer // was called with. sp<IBinder> releaseBufferEndpoint; // Force inputflinger to drop all input events for the layer and its children. gui::DropInputMode dropInputMode; }; struct ComposerState { Loading Loading
libs/gui/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ cc_library_headers { filegroup { name: "guiconstants_aidl", srcs: [ "android/**/DropInputMode.aidl", "android/**/TouchOcclusionMode.aidl", ], } Loading
libs/gui/LayerState.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -70,7 +70,8 @@ layer_state_t::layer_state_t() isTrustedOverlay(false), bufferCrop(Rect::INVALID_RECT), destinationFrame(Rect::INVALID_RECT), releaseBufferListener(nullptr) { releaseBufferListener(nullptr), dropInputMode(gui::DropInputMode::NONE) { matrix.dsdx = matrix.dtdy = 1.0f; matrix.dsdy = matrix.dtdx = 0.0f; hdrMetadata.validTypes = 0; Loading Loading @@ -175,6 +176,7 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.writeBool, isTrustedOverlay); SAFE_PARCEL(output.writeStrongBinder, releaseBufferEndpoint); SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(dropInputMode)); return NO_ERROR; } Loading Loading @@ -305,6 +307,10 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.readBool, &isTrustedOverlay); SAFE_PARCEL(input.readNullableStrongBinder, &releaseBufferEndpoint); uint32_t mode; SAFE_PARCEL(input.readUint32, &mode); dropInputMode = static_cast<gui::DropInputMode>(mode); return NO_ERROR; } Loading Loading @@ -563,6 +569,10 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eDestinationFrameChanged; destinationFrame = other.destinationFrame; } 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, Loading
libs/gui/SurfaceComposerClient.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -1739,6 +1739,21 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDesti return *this; } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDropInputMode( const sp<SurfaceControl>& 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; } // --------------------------------------------------------------------------- DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp<IBinder>& token) { Loading
libs/gui/android/gui/DropInputMode.aidl 0 → 100644 +45 −0 Original line number Diff line number Diff line /** * Copyright (c) 2021, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.gui; /** * Input event drop modes: Input event drop options for windows and its children. * * @hide */ @Backing(type="int") enum DropInputMode { /** * Default mode, input events are sent to the target as usual. */ NONE, /** * Window and its children will not receive any input even if it has a valid input channel. * Touches and keys will be dropped. If a window is focused, it will remain focused but will * not receive any keys. If the window has a touchable region and is the target of an input * event, the event will be dropped and will not go to the window behind. ref: b/197296414 */ ALL, /** * Similar to DROP but input events are only dropped if the window is considered to be * obscured. ref: b/197364677 */ OBSCURED }
libs/gui/include/gui/LayerState.h +5 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <gui/ITransactionCompletedListener.h> #include <math/mat4.h> #include <android/gui/DropInputMode.h> #include <android/gui/FocusRequest.h> #include <gui/ISurfaceComposer.h> Loading Loading @@ -117,6 +118,7 @@ struct layer_state_t { eAutoRefreshChanged = 0x1000'00000000, eStretchChanged = 0x2000'00000000, eTrustedOverlayChanged = 0x4000'00000000, eDropInputModeChanged = 0x8000'00000000, }; layer_state_t(); Loading Loading @@ -247,6 +249,9 @@ struct layer_state_t { // releaseCallbackId and release fence to all listeners so we store which listener the setBuffer // was called with. sp<IBinder> releaseBufferEndpoint; // Force inputflinger to drop all input events for the layer and its children. gui::DropInputMode dropInputMode; }; struct ComposerState { Loading