Enable cursor to transition across multiple displays
This CL enables cursor to move between displays. It uses a fake
topology that assumes all available displays are connected in the
following order:
default-display (top-edge) -> next-display (right-edge)
-> next-display (right-edge) ...
Test: atest inputflinger_tests
Test: verify cursor can move between displays as expected
Bug: 367659738
Bug: 367660694
Flag: com.android.input.flags.connected_displays_cursor
Change-Id: I8b3b7c3c0e68dca1e7ce281cb7ff6efab263a500
diff --git a/services/inputflinger/PointerChoreographer.h b/services/inputflinger/PointerChoreographer.h
index fba1aef..a969935 100644
--- a/services/inputflinger/PointerChoreographer.h
+++ b/services/inputflinger/PointerChoreographer.h
@@ -113,6 +113,24 @@
void notifyDeviceReset(const NotifyDeviceResetArgs& args) override;
void notifyPointerCaptureChanged(const NotifyPointerCaptureChangedArgs& args) override;
+ // TODO(b/362719483) remove these when real topology is available
+ enum class DisplayPosition : int32_t {
+ RIGHT = 0,
+ TOP = 1,
+ LEFT = 2,
+ BOTTOM = 3,
+ ftl_last = BOTTOM,
+ };
+
+ struct AdjacentDisplay {
+ ui::LogicalDisplayId displayId;
+ DisplayPosition position;
+ float offsetPx;
+ };
+ void setDisplayTopology(
+ const std::unordered_map<ui::LogicalDisplayId, std::vector<AdjacentDisplay>>&
+ displayTopology);
+
void dump(std::string& dump) override;
private:
@@ -153,6 +171,19 @@
const std::unordered_set<ui::LogicalDisplayId>& privacySensitiveDisplays)
REQUIRES(getLock());
+ void handleUnconsumedDeltaLocked(PointerControllerInterface& pc,
+ const FloatPoint& unconsumedDelta) REQUIRES(getLock());
+
+ void populateFakeDisplayTopologyLocked(const std::vector<gui::DisplayInfo>& displayInfos)
+ REQUIRES(getLock());
+
+ std::optional<const DisplayViewport*> findDestinationDisplayLocked(
+ const DisplayViewport& sourceViewport, const FloatPoint& unconsumedDelta) const
+ REQUIRES(getLock());
+
+ std::unordered_map<ui::LogicalDisplayId, std::vector<AdjacentDisplay>> mTopology
+ GUARDED_BY(getLock());
+
/* This listener keeps tracks of visible privacy sensitive displays and updates the
* choreographer if there are any changes.
*