Loading include/input/InputDevice.h +5 −0 Original line number Diff line number Diff line Loading @@ -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. Loading services/inputflinger/reader/mapper/KeyboardInputMapper.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -148,8 +148,12 @@ std::list<NotifyArgs> KeyboardInputMapper::reconfigure(nsecs_t when, if (!changes.any() || changes.test(InputReaderConfiguration::Change::KEYBOARD_LAYOUT_ASSOCIATION)) { mKeyboardLayoutInfo = std::optional<KeyboardLayoutInfo> newKeyboardLayoutInfo = getValueByKey(config.keyboardLayoutAssociations, getDeviceContext().getLocation()); if (mKeyboardLayoutInfo != newKeyboardLayoutInfo) { mKeyboardLayoutInfo = newKeyboardLayoutInfo; bumpGeneration(); } } return out; Loading services/inputflinger/tests/InputReader_test.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -3687,6 +3687,7 @@ TEST_F(KeyboardInputMapperTest, Configure_AssignKeyboardLayoutInfo) { mDevice->configure(ARBITRARY_TIME, mFakePolicy->getReaderConfiguration(), /*changes=*/{}); uint32_t generation = mReader->getContext()->getGeneration(); mFakePolicy->addKeyboardLayoutAssociation(DEVICE_LOCATION, DEVICE_KEYBOARD_LAYOUT_INFO); unused += mDevice->configure(ARBITRARY_TIME, mFakePolicy->getReaderConfiguration(), Loading @@ -3697,6 +3698,14 @@ TEST_F(KeyboardInputMapperTest, Configure_AssignKeyboardLayoutInfo) { deviceInfo.getKeyboardLayoutInfo()->languageTag); ASSERT_EQ(DEVICE_KEYBOARD_LAYOUT_INFO.layoutType, deviceInfo.getKeyboardLayoutInfo()->layoutType); ASSERT_TRUE(mReader->getContext()->getGeneration() != generation); // Call change layout association with the same values: Generation shouldn't change generation = mReader->getContext()->getGeneration(); mFakePolicy->addKeyboardLayoutAssociation(DEVICE_LOCATION, DEVICE_KEYBOARD_LAYOUT_INFO); unused += mDevice->configure(ARBITRARY_TIME, mFakePolicy->getReaderConfiguration(), InputReaderConfiguration::Change::KEYBOARD_LAYOUT_ASSOCIATION); ASSERT_TRUE(mReader->getContext()->getGeneration() == generation); } TEST_F(KeyboardInputMapperTest, LayoutInfoCorrectlyMapped) { Loading services/vibratorservice/benchmarks/VibratorHalControllerBenchmarks.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * limitations under the License. */ #define LOG_TAG "PowerHalControllerBenchmarks" #define LOG_TAG "VibratorHalControllerBenchmarks" #include <benchmark/benchmark.h> #include <vibratorservice/VibratorHalController.h> Loading Loading @@ -183,7 +183,7 @@ BENCHMARK_WRAPPER(VibratorBench, setAmplitudeCached, { return; } auto duration = 6000s; auto duration = 60s; auto callback = []() {}; auto amplitude = 1.0f; Loading Loading
include/input/InputDevice.h +5 −0 Original line number Diff line number Diff line Loading @@ -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. Loading
services/inputflinger/reader/mapper/KeyboardInputMapper.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -148,8 +148,12 @@ std::list<NotifyArgs> KeyboardInputMapper::reconfigure(nsecs_t when, if (!changes.any() || changes.test(InputReaderConfiguration::Change::KEYBOARD_LAYOUT_ASSOCIATION)) { mKeyboardLayoutInfo = std::optional<KeyboardLayoutInfo> newKeyboardLayoutInfo = getValueByKey(config.keyboardLayoutAssociations, getDeviceContext().getLocation()); if (mKeyboardLayoutInfo != newKeyboardLayoutInfo) { mKeyboardLayoutInfo = newKeyboardLayoutInfo; bumpGeneration(); } } return out; Loading
services/inputflinger/tests/InputReader_test.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -3687,6 +3687,7 @@ TEST_F(KeyboardInputMapperTest, Configure_AssignKeyboardLayoutInfo) { mDevice->configure(ARBITRARY_TIME, mFakePolicy->getReaderConfiguration(), /*changes=*/{}); uint32_t generation = mReader->getContext()->getGeneration(); mFakePolicy->addKeyboardLayoutAssociation(DEVICE_LOCATION, DEVICE_KEYBOARD_LAYOUT_INFO); unused += mDevice->configure(ARBITRARY_TIME, mFakePolicy->getReaderConfiguration(), Loading @@ -3697,6 +3698,14 @@ TEST_F(KeyboardInputMapperTest, Configure_AssignKeyboardLayoutInfo) { deviceInfo.getKeyboardLayoutInfo()->languageTag); ASSERT_EQ(DEVICE_KEYBOARD_LAYOUT_INFO.layoutType, deviceInfo.getKeyboardLayoutInfo()->layoutType); ASSERT_TRUE(mReader->getContext()->getGeneration() != generation); // Call change layout association with the same values: Generation shouldn't change generation = mReader->getContext()->getGeneration(); mFakePolicy->addKeyboardLayoutAssociation(DEVICE_LOCATION, DEVICE_KEYBOARD_LAYOUT_INFO); unused += mDevice->configure(ARBITRARY_TIME, mFakePolicy->getReaderConfiguration(), InputReaderConfiguration::Change::KEYBOARD_LAYOUT_ASSOCIATION); ASSERT_TRUE(mReader->getContext()->getGeneration() == generation); } TEST_F(KeyboardInputMapperTest, LayoutInfoCorrectlyMapped) { Loading
services/vibratorservice/benchmarks/VibratorHalControllerBenchmarks.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * limitations under the License. */ #define LOG_TAG "PowerHalControllerBenchmarks" #define LOG_TAG "VibratorHalControllerBenchmarks" #include <benchmark/benchmark.h> #include <vibratorservice/VibratorHalController.h> Loading Loading @@ -183,7 +183,7 @@ BENCHMARK_WRAPPER(VibratorBench, setAmplitudeCached, { return; } auto duration = 6000s; auto duration = 60s; auto callback = []() {}; auto amplitude = 1.0f; Loading