From dd82b8ebbd271b5f48f8bbc620a9f5b549b0905e Mon Sep 17 00:00:00 2001 From: Vaibhav Devmurari Date: Tue, 16 Aug 2022 15:34:01 +0000 Subject: Fetch country code information from Device sysfs path HID devices report the country code via sysfs. Need to read it and pass it and save it as a member variable to InputDevice In subsequent CLs will use it to auto-detect a layout for PK. More information in DD: go/pk_auto_layout_detection Test: atest inputflinger_tests:InputReaderTest Bug: 242715614 Change-Id: I73ca7518dbee3e563c41024bb3ed41261c8d7846 --- libs/input/InputDevice.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libs/input/InputDevice.cpp') diff --git a/libs/input/InputDevice.cpp b/libs/input/InputDevice.cpp index a9089690b0..3fe03c7979 100644 --- a/libs/input/InputDevice.cpp +++ b/libs/input/InputDevice.cpp @@ -26,6 +26,7 @@ #include using android::base::StringPrintf; +using android::hardware::input::InputDeviceCountryCode; namespace android { @@ -177,6 +178,7 @@ InputDeviceInfo::InputDeviceInfo(const InputDeviceInfo& other) mAlias(other.mAlias), mIsExternal(other.mIsExternal), mHasMic(other.mHasMic), + mCountryCode(other.mCountryCode), mSources(other.mSources), mKeyboardType(other.mKeyboardType), mKeyCharacterMap(other.mKeyCharacterMap), @@ -192,8 +194,8 @@ InputDeviceInfo::~InputDeviceInfo() { } void InputDeviceInfo::initialize(int32_t id, int32_t generation, int32_t controllerNumber, - const InputDeviceIdentifier& identifier, const std::string& alias, bool isExternal, - bool hasMic) { + const InputDeviceIdentifier& identifier, const std::string& alias, + bool isExternal, bool hasMic, InputDeviceCountryCode countryCode) { mId = id; mGeneration = generation; mControllerNumber = controllerNumber; @@ -201,6 +203,7 @@ void InputDeviceInfo::initialize(int32_t id, int32_t generation, int32_t control mAlias = alias; mIsExternal = isExternal; mHasMic = hasMic; + mCountryCode = countryCode; mSources = 0; mKeyboardType = AINPUT_KEYBOARD_TYPE_NONE; mHasVibrator = false; -- cgit v1.2.3-59-g8ed1b