Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c3009bf authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge changes from topic "toast-security-fix-sc-dev" into sc-dev

* changes:
  SurfaceFlinger: Implement drop input modes
  InputFlinger: Add DROP_INPUT feature flags
  SurfaceControl: Add setDropInputMode api
parents ec7e4d9a 9b0d13dc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -128,6 +128,7 @@ struct InputWindowInfo : public Parcelable {
        DISABLE_TOUCH_PAD_GESTURES = 0x00000001,
        NO_INPUT_CHANNEL = 0x00000002,
        DISABLE_USER_ACTIVITY = 0x00000004,
        DROP_INPUT = 0x00000008,
    };

    /* These values are filled in by the WM and passed through SurfaceFlinger
+9 −1
Original line number Diff line number Diff line
@@ -39,13 +39,20 @@ cc_library_headers {
    min_sdk_version: "29",
}

// AIDL files that should be exposed to java
filegroup {
    name: "guiconstants_aidl",
    srcs: [
        "android/gui/DropInputMode.aidl",
    ],
}

cc_library_headers {
    name: "libgui_aidl_headers",
    vendor_available: true,
    static_libs: [
        "libgui_aidl_static",
    ],

    export_static_lib_headers: [
        "libgui_aidl_static",
    ],
@@ -102,6 +109,7 @@ cc_library_shared {
    ],

    srcs: [
        ":guiconstants_aidl",
        ":framework_native_aidl",
        ":inputconstants_aidl",
        ":libgui_bufferqueue_sources",
+9 −1
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ layer_state_t::layer_state_t()
        frameNumber(0),
        autoRefresh(false),
        isTrustedOverlay(false),
        dropInputMode(gui::DropInputMode::NONE),
        bufferCrop(Rect::INVALID_RECT),
        destinationFrame(Rect::INVALID_RECT),
        releaseBufferListener(nullptr) {
@@ -172,7 +173,7 @@ status_t layer_state_t::write(Parcel& output) const
    SAFE_PARCEL(output.write, bufferCrop);
    SAFE_PARCEL(output.write, destinationFrame);
    SAFE_PARCEL(output.writeBool, isTrustedOverlay);

    output.writeUint32(static_cast<uint32_t>(dropInputMode));
    return NO_ERROR;
}

@@ -304,6 +305,9 @@ status_t layer_state_t::read(const Parcel& input)
    SAFE_PARCEL(input.read, destinationFrame);
    SAFE_PARCEL(input.readBool, &isTrustedOverlay);

    uint32_t mode;
    mode = input.readUint32();
    dropInputMode = static_cast<gui::DropInputMode>(mode);
    return NO_ERROR;
}

@@ -539,6 +543,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 & eReleaseBufferListenerChanged) {
        if (releaseBufferListener) {
            ALOGW("Overriding releaseBufferListener");
+15 −0
Original line number Diff line number Diff line
@@ -1669,6 +1669,21 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setTrust
    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;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setApplyToken(
        const sp<IBinder>& applyToken) {
    mApplyToken = applyToken;
+40 −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,
}
Loading