From 0a6fee80fbda45cd72a8e75948e0925798064648 Mon Sep 17 00:00:00 2001 From: Vaibhav Devmurari Date: Tue, 11 Apr 2023 18:53:04 +0000 Subject: Force input device changed callback when Keyboard layout info is updated Virtual keyboard creation uses KEYBOARD_LAYOUT_ASSOCIATION reconfig to associated input device with keyboard layout info. But this can happen after input device added (Race condition between device creation and input device added callback.) If input device already added then we sometimes don't get input device changed callback since the generation is same. Test: atest VirtualKeyboardLayoutTest Bug: 277778640 Change-Id: I218b6d797da27ec3a383fbcd2ebeacb0afbf5fab --- include/input/InputDevice.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/input/InputDevice.h') diff --git a/include/input/InputDevice.h b/include/input/InputDevice.h index 66d3435907..1a40fdb90c 100644 --- a/include/input/InputDevice.h +++ b/include/input/InputDevice.h @@ -212,6 +212,11 @@ struct KeyboardLayoutInfo { std::string languageTag; // The layout type such as QWERTY or AZERTY. std::string layoutType; + + inline bool operator==(const KeyboardLayoutInfo& other) const { + return languageTag == other.languageTag && layoutType == other.layoutType; + } + inline bool operator!=(const KeyboardLayoutInfo& other) const { return !(*this == other); } }; // The version of the Universal Stylus Initiative (USI) protocol supported by the input device. -- cgit v1.2.3-59-g8ed1b