Disable key repeat when it is switched off
Read whether key repeats are disabled via settings and disable
generation of key repeats if so.
Bug: 336585002
Test: atest InputDispatcherKeyRepeatTest
Test: atest InputManagerServiceTests
Flag: com.android.input.flags.keyboard_repeat_keys
Change-Id: I871bbfc0808bde4a6f85b7ea47ea92d4e80156c7
diff --git a/services/inputflinger/dispatcher/include/InputDispatcherConfiguration.h b/services/inputflinger/dispatcher/include/InputDispatcherConfiguration.h
index 5eb3a32..ba197d4 100644
--- a/services/inputflinger/dispatcher/include/InputDispatcherConfiguration.h
+++ b/services/inputflinger/dispatcher/include/InputDispatcherConfiguration.h
@@ -34,8 +34,13 @@
// The key repeat inter-key delay.
nsecs_t keyRepeatDelay;
+ // Whether key repeat is enabled.
+ bool keyRepeatEnabled;
+
InputDispatcherConfiguration()
- : keyRepeatTimeout(500 * 1000000LL), keyRepeatDelay(50 * 1000000LL) {}
+ : keyRepeatTimeout(500 * 1000000LL),
+ keyRepeatDelay(50 * 1000000LL),
+ keyRepeatEnabled(true) {}
};
} // namespace android