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

Commit a786d80b authored by Arpit Singh's avatar Arpit Singh
Browse files

[CD Cursor] Add DisplayTopologyValidator in InputManager

Adding a DisplayTopologyValidator to discard any invalid topology
updates. We are not adding FATAL here because in most cases a valid
update will follow invalid updates. This may happen due to hardware
errors or changes in display configuration while topology is being
populated.

Test: atest inputflinger_tests
Bug: 401219231
Flag: com.android.input.flags.enable_display_topology_validation

Change-Id: Ic7aaf25cef6e9d1ee8c6f50942ea691334f87fc3
parent 69c08bc0
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -671,9 +671,13 @@ void NativeInputManager::setDisplayTopology(JNIEnv* env, jobject topologyGraph)
        return;
    }

    // TODO(b/383092013): Add topology validation
    const DisplayTopologyGraph displayTopology =
            android_hardware_display_DisplayTopologyGraph_toNative(env, topologyGraph);
    if (input_flags::enable_display_topology_validation() && !displayTopology.isValid()) {
        LOG(ERROR) << "Ignoring Invalid DisplayTopology";
        return;
    }

    mInputManager->getDispatcher().setDisplayTopology(displayTopology);
    mInputManager->getChoreographer().setDisplayTopology(displayTopology);
}