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

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

SurfaceControl: Add setDropInputMode api am: 122c4d2d

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

Change-Id: Id57e0ba202d2003bceae29214d7c8fcd943756e0
parents 11402118 122c4d2d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ struct InputWindowInfo {
        INPUT_FEATURE_DISABLE_TOUCH_PAD_GESTURES = 0x00000001,
        INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002,
        INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004,
        INPUT_FEATURE_DROP_INPUT = 0x00000008,
    };

    /* These values are filled in by the WM and passed through SurfaceFlinger
+9 −0
Original line number Diff line number Diff line
@@ -30,6 +30,14 @@ 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_shared {
    name: "libgui",
    vendor_available: false,
@@ -41,6 +49,7 @@ cc_library_shared {
    defaults: ["libgui_bufferqueue-defaults"],

    srcs: [
        ":guiconstants_aidl",
        ":framework_native_aidl",
        ":libgui_bufferqueue_sources",

+8 −1
Original line number Diff line number Diff line
@@ -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<uint32_t>(dropInputMode));
    return NO_ERROR;
}

@@ -204,6 +204,9 @@ status_t layer_state_t::read(const Parcel& input)
    fixedTransformHint = static_cast<ui::Transform::RotationFlags>(input.readUint32());
    isTrustedOverlay = input.readBool();

    uint32_t mode;
    mode = input.readUint32();
    dropInputMode = static_cast<gui::DropInputMode>(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,
+15 −0
Original line number Diff line number Diff line
@@ -1497,6 +1497,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;
}

// ---------------------------------------------------------------------------

DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp<IBinder>& token) {
+40 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2022, 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