diff options
| author | 2025-03-07 12:27:47 +0000 | |
|---|---|---|
| committer | 2025-03-10 17:35:48 +0000 | |
| commit | a786d80b58f5ca49eef5b90c0490cbc75be16f53 (patch) | |
| tree | 0bbf96d4593fae3fddb6118d72020ffd48fb32c1 | |
| parent | 69c08bc00b8130c844bdf7e3bdbb7f6cd009a1ed (diff) | |
[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
| -rw-r--r-- | services/core/jni/com_android_server_input_InputManagerService.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index e32ce525cb40..ec8794f8073f 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -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); } |