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

Commit 2c358bf8 authored by Robert Carr's avatar Robert Carr
Browse files

Add setInputWindowInfo to SurfaceComposerClient::Transaction

In preparation for passing input through SurfaceFlinger to the InputDispatcher.

Bug: 80101428
Bug: 113136004
Bug: 111440400
Change-Id: I5f67fbb9894136bfb16c718ffe1cc23a02f3414d
parent 7b0e9118
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#ifndef _LIBINPUT_INPUT_H
#define _LIBINPUT_INPUT_H

#pragma GCC system_header

/**
 * Native input event structures.
 */
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#ifndef _LIBINPUT_INPUT_TRANSPORT_H
#define _LIBINPUT_INPUT_TRANSPORT_H

#pragma GCC system_header

/**
 * Native input transport.
 *
+3 −1
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ cc_library_shared {
        "libutils",
        "libnativewindow",
        "liblog",
        "libinput",
        "libhidlbase",
        "libhidltransport",
        "android.hidl.token@1.0-utils",
@@ -146,7 +147,7 @@ cc_library_shared {
    // bufferhub is not used when building libgui for vendors
    target: {
        vendor: {
            cflags: ["-DNO_BUFFERHUB"],
            cflags: ["-DNO_BUFFERHUB", "-DNO_INPUT"],
            exclude_srcs: [
                "BufferHubConsumer.cpp",
                "BufferHubProducer.cpp",
@@ -155,6 +156,7 @@ cc_library_shared {
                "libbufferhub",
                "libbufferhubqueue",
                "libpdx_default_transport",
                "libinput"
            ],
        },
    },
+15 −0
Original line number Diff line number Diff line
@@ -50,6 +50,9 @@ status_t layer_state_t::write(Parcel& output) const
    output.writeFloat(color.r);
    output.writeFloat(color.g);
    output.writeFloat(color.b);
#ifndef NO_INPUT
    inputInfo.write(output);
#endif
    output.write(transparentRegion);
    output.writeUint32(transform);
    output.writeBool(transformToDisplayInverse);
@@ -120,6 +123,11 @@ status_t layer_state_t::read(const Parcel& input)
    color.r = input.readFloat();
    color.g = input.readFloat();
    color.b = input.readFloat();

#ifndef NO_INPUT
    inputInfo = InputWindowInfo::read(input);
#endif

    input.read(transparentRegion);
    transform = input.readUint32();
    transformToDisplayInverse = input.readBool();
@@ -343,6 +351,13 @@ void layer_state_t::merge(const layer_state_t& other) {
        listenerCallbacks = other.listenerCallbacks;
    }

#ifndef NO_INPUT
    if (other.what & eInputInfoChanged) {
        what |= eInputInfoChanged;
        inputInfo = other.inputInfo;
    }
#endif

    if ((other.what & what) != other.what) {
        ALOGE("Unmerged SurfaceComposer Transaction properties. LayerState::merge needs updating? "
              "other.what=0x%X what=0x%X",
+19 −0
Original line number Diff line number Diff line
@@ -42,6 +42,10 @@
#include <gui/Surface.h>
#include <gui/SurfaceComposerClient.h>

#ifndef NO_INPUT
#include <input/InputWindow.h>
#endif

#include <private/gui/ComposerService.h>

namespace android {
@@ -759,6 +763,21 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setGeome
    return *this;
}

#ifndef NO_INPUT
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setInputWindowInfo(
        const sp<SurfaceControl>& sc,
        const InputWindowInfo& info) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }
    s->inputInfo = info;
    s->what |= layer_state_t::eInputInfoChanged;
    return *this;
}
#endif

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::destroySurface(
        const sp<SurfaceControl>& sc) {
    layer_state_t* s = getLayerState(sc);
Loading