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

Commit c463aa04 authored by Arpit Singh's avatar Arpit Singh Committed by Android (Google) Code Review
Browse files

Merge "[1/n CD Cursor] Pass topology to InputDispatcher" into main

parents f7a4518e 2b940870
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -7202,6 +7202,12 @@ void InputDispatcher::setInputMethodConnectionIsActive(bool isActive) {
    }
}

void InputDispatcher::setDisplayTopology(
        const android::DisplayTopologyGraph& displayTopologyGraph) {
    std::scoped_lock _l(mLock);
    mWindowInfos.setDisplayTopology(displayTopologyGraph);
}

InputDispatcher::ConnectionManager::ConnectionManager(const sp<android::Looper>& looper)
      : mLooper(looper) {}

@@ -7337,6 +7343,11 @@ void InputDispatcher::DispatcherWindowInfo::setMaximumObscuringOpacityForTouch(f
    mMaximumObscuringOpacityForTouch = opacity;
}

void InputDispatcher::DispatcherWindowInfo::setDisplayTopology(
        const DisplayTopologyGraph& displayTopologyGraph) {
    mTopology = displayTopologyGraph;
}

ftl::Flags<InputTarget::Flags> InputDispatcher::DispatcherTouchState::getTargetFlags(
        const sp<WindowInfoHandle>& targetWindow, vec2 targetPosition, bool isSplit,
        const DispatcherWindowInfo& windowInfos) {
+9 −0
Original line number Diff line number Diff line
@@ -164,6 +164,8 @@ public:

    void setInputMethodConnectionIsActive(bool isActive) override;

    void setDisplayTopology(const DisplayTopologyGraph& displayTopologyGraph) override;

private:
    enum class DropReason {
        NOT_DROPPED,
@@ -291,6 +293,8 @@ private:

        void setMaximumObscuringOpacityForTouch(float opacity);

        void setDisplayTopology(const DisplayTopologyGraph& displayTopologyGraph);

        // Get a reference to window handles by display, return an empty vector if not found.
        const std::vector<sp<android::gui::WindowInfoHandle>>& getWindowHandlesForDisplay(
                ui::LogicalDisplayId displayId) const;
@@ -341,6 +345,11 @@ private:
        std::unordered_map<ui::LogicalDisplayId /*displayId*/, android::gui::DisplayInfo>
                mDisplayInfos;
        float mMaximumObscuringOpacityForTouch{1.0f};

        // Topology is initialized with default-constructed value, which is an empty topology until
        // we receive setDisplayTopology call. Meanwhile we will treat every display as an
        // independent display.
        DisplayTopologyGraph mTopology;
    };

    DispatcherWindowInfo mWindowInfos GUARDED_BY(mLock);
+6 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include <android/os/InputEventInjectionSync.h>
#include <gui/InputApplication.h>
#include <gui/WindowInfo.h>
#include <input/DisplayTopologyGraph.h>
#include <input/InputDevice.h>
#include <input/InputTransport.h>
#include <unordered_map>
@@ -243,6 +244,11 @@ public:
     * Notify the dispatcher that the state of the input method connection changed.
     */
    virtual void setInputMethodConnectionIsActive(bool isActive) = 0;

    /*
     * Notify the dispatcher of the latest DisplayTopology.
     */
    virtual void setDisplayTopology(const DisplayTopologyGraph& displayTopologyGraph) = 0;
};

} // namespace android