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

Commit 3c769a4d authored by Arpit Singh's avatar Arpit Singh
Browse files

[CD Cursor] Update pointer display in line with topology update

This CL fixes issues related to pointer display on topology update. When
we are working with topology cursor display should only be updated when
topology is updated or user moves the cursor between displays. This CL
Specifically implements following behaviour:

1. Ignore setDefaultMouseDisplayId whith topology.
2. Only update pointer display when topology is set.
3. Fallback to the primary display id pointer display is removed.

Test: atest inputflinger_tests
Bug: 395033854
Flag: com.android.input.flags.connected_displays_cursor
Change-Id: I576107b0ee5b81d596bdb91c796ceb6ac9eb2f73
parent 44ff4fc9
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -602,15 +602,21 @@ void PointerChoreographer::notifyPointerCaptureChanged(
}

void PointerChoreographer::setDisplayTopology(const DisplayTopologyGraph& displayTopologyGraph) {
    PointerDisplayChange pointerDisplayChange;
    { // acquire lock
        std::scoped_lock _l(getLock());
        mTopology = displayTopologyGraph;

    // make primary display default mouse display, if it was not set
    // or the existing display was removed
        // make primary display default mouse display, if it was not set or
        // the existing display was removed
        if (mDefaultMouseDisplayId == ui::LogicalDisplayId::INVALID ||
        mTopology.graph.find(mDefaultMouseDisplayId) != mTopology.graph.end()) {
            mTopology.graph.find(mDefaultMouseDisplayId) == mTopology.graph.end()) {
            mDefaultMouseDisplayId = mTopology.primaryDisplayId;
            pointerDisplayChange = updatePointerControllersLocked();
        }
    } // release lock

    notifyPointerDisplayChange(pointerDisplayChange, mPolicy);
}

void PointerChoreographer::dump(std::string& dump) {
@@ -785,6 +791,10 @@ PointerChoreographer::calculatePointerDisplayChangeToNotify() {
}

void PointerChoreographer::setDefaultMouseDisplayId(ui::LogicalDisplayId displayId) {
    if (InputFlags::connectedDisplaysCursorEnabled()) {
        // In connected displays scenario, default mouse display will only be updated from topology.
        return;
    }
    PointerDisplayChange pointerDisplayChange;

    { // acquire lock
+256 −94

File changed.

Preview size limit exceeded, changes collapsed.