summaryrefslogtreecommitdiff
path: root/libs/input/InputDevice.cpp
diff options
context:
space:
mode:
author Vaibhav Devmurari <vdevmurari@google.com> 2022-08-16 15:34:01 +0000
committer Vaibhav Devmurari <vdevmurari@google.com> 2022-08-25 15:32:33 +0000
commitdd82b8ebbd271b5f48f8bbc620a9f5b549b0905e (patch)
tree20919ba093a93101ca41825d8c11dfe8dc97beed /libs/input/InputDevice.cpp
parent501a72a312b06d5a3438ca4a55f73749d1278162 (diff)
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
Diffstat (limited to 'libs/input/InputDevice.cpp')
-rw-r--r--libs/input/InputDevice.cpp7
1 files changed, 5 insertions, 2 deletions
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 <input/InputEventLabels.h>
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;