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
diff --git a/include/input/InputDevice.h b/include/input/InputDevice.h
index 3585392..d51d6a7 100644
--- a/include/input/InputDevice.h
+++ b/include/input/InputDevice.h
@@ -23,6 +23,8 @@
#include <unordered_map>
#include <vector>
+#include "android/hardware/input/InputDeviceCountryCode.h"
+
namespace android {
/*
@@ -210,8 +212,10 @@
};
void 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,
+ hardware::input::InputDeviceCountryCode countryCode =
+ hardware::input::InputDeviceCountryCode::INVALID);
inline int32_t getId() const { return mId; }
inline int32_t getControllerNumber() const { return mControllerNumber; }
@@ -223,6 +227,7 @@
}
inline bool isExternal() const { return mIsExternal; }
inline bool hasMic() const { return mHasMic; }
+ inline hardware::input::InputDeviceCountryCode getCountryCode() const { return mCountryCode; }
inline uint32_t getSources() const { return mSources; }
const MotionRange* getMotionRange(int32_t axis, uint32_t source) const;
@@ -274,9 +279,11 @@
std::string mAlias;
bool mIsExternal;
bool mHasMic;
+ hardware::input::InputDeviceCountryCode mCountryCode;
uint32_t mSources;
int32_t mKeyboardType;
std::shared_ptr<KeyCharacterMap> mKeyCharacterMap;
+
bool mHasVibrator;
bool mHasBattery;
bool mHasButtonUnderPad;