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

Commit d5a65ea5 authored by Vishnu Nair's avatar Vishnu Nair Committed by Automerger Merge Worker
Browse files

SurfaceControl: Add setDropInputMode api am: 77daf700

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/16740114

Change-Id: I7ab2f02c81569e5ae72fff8a2e1f3ea8fccd8a2e
parents 9c097670 77daf700
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -128,6 +128,7 @@ struct InputWindowInfo : public Parcelable {
        DISABLE_TOUCH_PAD_GESTURES = 0x00000001,
        DISABLE_TOUCH_PAD_GESTURES = 0x00000001,
        NO_INPUT_CHANNEL = 0x00000002,
        NO_INPUT_CHANNEL = 0x00000002,
        DISABLE_USER_ACTIVITY = 0x00000004,
        DISABLE_USER_ACTIVITY = 0x00000004,
        INPUT_FEATURE_DROP_INPUT = 0x00000008,
    };
    };


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


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

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

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


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

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


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


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


@@ -539,6 +543,10 @@ void layer_state_t::merge(const layer_state_t& other) {
        what |= eTrustedOverlayChanged;
        what |= eTrustedOverlayChanged;
        isTrustedOverlay = other.isTrustedOverlay;
        isTrustedOverlay = other.isTrustedOverlay;
    }
    }
    if (other.what & eDropInputModeChanged) {
        what |= eDropInputModeChanged;
        dropInputMode = other.dropInputMode;
    }
    if (other.what & eReleaseBufferListenerChanged) {
    if (other.what & eReleaseBufferListenerChanged) {
        if (releaseBufferListener) {
        if (releaseBufferListener) {
            ALOGW("Overriding releaseBufferListener");
            ALOGW("Overriding releaseBufferListener");
+15 −0
Original line number Original line Diff line number Diff line
@@ -1669,6 +1669,21 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setTrust
    return *this;
    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(
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setApplyToken(
        const sp<IBinder>& applyToken) {
        const sp<IBinder>& applyToken) {
    mApplyToken = applyToken;
    mApplyToken = applyToken;
+40 −0
Original line number Original line 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