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

Commit 7bc179c1 authored by Pasty Chang's avatar Pasty Chang
Browse files

Revert "Send WindowInfo even if the window isn't associated with..."

Revert submission 19396488

Reason for revert: Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/tests/view?invocationId=I83300010074249798&testResultId=TR51728160843391916, bug 240320932
Reverted Changes:
I0b50d6789:InputDispatcher: Allow all windows to be removed f...
Ibe0e4326d:Send WindowInfo even if the window isn't associate...

Bug: 240320932
Change-Id: I4c9c4dd575d48410fe35ee097adf6122b9d2e8ff
parent 8ccda435
Loading
Loading
Loading
Loading
+3 −14
Original line number Diff line number Diff line
@@ -78,7 +78,6 @@
namespace android {
namespace {
constexpr int kDumpTableRowLength = 159;
const ui::Transform kIdentityTransform;
} // namespace

using namespace ftl::flag_operators;
@@ -2210,8 +2209,7 @@ void Layer::writeToProtoCommonState(LayerProto* layerInfo, LayerVector::StateSet
    if ((traceFlags & LayerTracing::TRACE_INPUT) && needsInputInfo()) {
        WindowInfo info;
        if (useDrawing) {
            info = fillInputInfo(
                    InputDisplayArgs{.transform = &kIdentityTransform, .isSecure = true});
            info = fillInputInfo(ui::Transform(), /* displayIsSecure */ true);
        } else {
            info = state.inputInfo;
        }
@@ -2418,7 +2416,7 @@ void Layer::handleDropInputMode(gui::WindowInfo& info) const {
    }
}

WindowInfo Layer::fillInputInfo(const InputDisplayArgs& displayArgs) {
WindowInfo Layer::fillInputInfo(const ui::Transform& displayTransform, bool displayIsSecure) {
    if (!hasInputInfo()) {
        mDrawingState.inputInfo.name = getName();
        mDrawingState.inputInfo.ownerUid = mOwnerUid;
@@ -2427,21 +2425,12 @@ WindowInfo Layer::fillInputInfo(const InputDisplayArgs& displayArgs) {
        mDrawingState.inputInfo.displayId = getLayerStack().id;
    }

    const ui::Transform& displayTransform =
            displayArgs.transform != nullptr ? *displayArgs.transform : kIdentityTransform;

    WindowInfo info = mDrawingState.inputInfo;
    info.id = sequence;
    info.displayId = getLayerStack().id;

    fillInputFrameInfo(info, displayTransform);

    if (displayArgs.transform == nullptr) {
        // Do not let the window receive touches if it is not associated with a valid display
        // transform. We still allow the window to receive keys and prevent ANRs.
        info.inputConfig |= WindowInfo::InputConfig::NOT_TOUCHABLE;
    }

    // For compatibility reasons we let layers which can receive input
    // receive input before they have actually submitted a buffer. Because
    // of this we use canReceiveInput instead of isVisible to check the
@@ -2459,7 +2448,7 @@ WindowInfo Layer::fillInputInfo(const InputDisplayArgs& displayArgs) {

    // If the window will be blacked out on a display because the display does not have the secure
    // flag and the layer has the secure flag set, then drop input.
    if (!displayArgs.isSecure && isSecure()) {
    if (!displayIsSecure && isSecure()) {
        info.inputConfig |= WindowInfo::InputConfig::DROP_INPUT;
    }

+1 −5
Original line number Diff line number Diff line
@@ -854,11 +854,7 @@ public:
    bool getPremultipledAlpha() const;
    void setInputInfo(const gui::WindowInfo& info);

    struct InputDisplayArgs {
        const ui::Transform* transform = nullptr;
        bool isSecure = false;
    };
    gui::WindowInfo fillInputInfo(const InputDisplayArgs& displayArgs);
    gui::WindowInfo fillInputInfo(const ui::Transform& displayTransform, bool displayIsSecure);

    /**
     * Returns whether this layer has an explicitly set input-info.
+5 −5
Original line number Diff line number Diff line
@@ -3264,11 +3264,11 @@ void SurfaceFlinger::buildWindowInfos(std::vector<WindowInfo>& outWindowInfos,
    mDrawingState.traverseInReverseZOrder([&](Layer* layer) {
        if (!layer->needsInputInfo()) return;

        const auto opt = displayInputInfos.get(layer->getLayerStack(),
                                               [](const auto& info) -> Layer::InputDisplayArgs {
                                                   return {&info.transform, info.isSecure};
                                               });
        outWindowInfos.push_back(layer->fillInputInfo(opt.value_or(Layer::InputDisplayArgs{})));
        // Do not create WindowInfos for windows on displays that cannot receive input.
        if (const auto opt = displayInputInfos.get(layer->getLayerStack())) {
            const auto& info = opt->get();
            outWindowInfos.push_back(layer->fillInputInfo(info.transform, info.isSecure));
        }
    });

    sNumWindowInfos = outWindowInfos.size();