summaryrefslogtreecommitdiff
path: root/include/input/InputDevice.h
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2018-07-06 11:19:32 +0100
committer Siarhei Vishniakou <svv@google.com> 2018-09-05 09:27:25 -0700
commitec8f725bcc099ae63c95a5d725f3ccd63eb4ebe3 (patch)
tree889412e90feec46767f5c3bd6f54558ccf8d66b1 /include/input/InputDevice.h
parent24d971f469272b59b45490487247f7c4d876c0ab (diff)
Prefer std::string over String8
String8 is deprecated, so use proper C++ std::string instead. Change DisplayViewport.uniqueId to std::string. The current usage of String8 in DisplayViewport hinders refactoring of the code to use viewport types inside the viewports themselves. Most of the dependency on String8 is now removed. Once the xml for properties patch is added, almost all String8 should be gone from the input system. Test: atest libinput_tests inputflinger_tests Bug: 111108021 Change-Id: I580dc27b0449e664a7c9db2cdec1a0c18bf71a09
Diffstat (limited to 'include/input/InputDevice.h')
-rw-r--r--include/input/InputDevice.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/include/input/InputDevice.h b/include/input/InputDevice.h
index 1ea69d352d..34d164c280 100644
--- a/include/input/InputDevice.h
+++ b/include/input/InputDevice.h
@@ -31,9 +31,9 @@ struct InputDeviceIdentifier {
}
// Information provided by the kernel.
- String8 name;
- String8 location;
- String8 uniqueId;
+ std::string name;
+ std::string location;
+ std::string uniqueId;
uint16_t bus;
uint16_t vendor;
uint16_t product;
@@ -45,7 +45,7 @@ struct InputDeviceIdentifier {
// It is hashed from whatever kernel provided information is available.
// Ideally, the way this value is computed should not change between Android releases
// because that would invalidate persistent settings that rely on it.
- String8 descriptor;
+ std::string descriptor;
// A value added to uniquely identify a device in the absence of a unique id. This
// is intended to be a minimum way to distinguish from other active devices and may
@@ -73,16 +73,16 @@ public:
};
void initialize(int32_t id, int32_t generation, int32_t controllerNumber,
- const InputDeviceIdentifier& identifier, const String8& alias, bool isExternal,
+ const InputDeviceIdentifier& identifier, const std::string& alias, bool isExternal,
bool hasMic);
inline int32_t getId() const { return mId; }
inline int32_t getControllerNumber() const { return mControllerNumber; }
inline int32_t getGeneration() const { return mGeneration; }
inline const InputDeviceIdentifier& getIdentifier() const { return mIdentifier; }
- inline const String8& getAlias() const { return mAlias; }
- inline const String8& getDisplayName() const {
- return mAlias.isEmpty() ? mIdentifier.name : mAlias;
+ inline const std::string& getAlias() const { return mAlias; }
+ inline const std::string& getDisplayName() const {
+ return mAlias.empty() ? mIdentifier.name : mAlias;
}
inline bool isExternal() const { return mIsExternal; }
inline bool hasMic() const { return mHasMic; }
@@ -121,7 +121,7 @@ private:
int32_t mGeneration;
int32_t mControllerNumber;
InputDeviceIdentifier mIdentifier;
- String8 mAlias;
+ std::string mAlias;
bool mIsExternal;
bool mHasMic;
uint32_t mSources;
@@ -149,7 +149,7 @@ enum InputDeviceConfigurationFileType {
*
* Returns an empty string if not found.
*/
-extern String8 getInputDeviceConfigurationFilePathByDeviceIdentifier(
+extern std::string getInputDeviceConfigurationFilePathByDeviceIdentifier(
const InputDeviceIdentifier& deviceIdentifier,
InputDeviceConfigurationFileType type);
@@ -162,8 +162,8 @@ extern String8 getInputDeviceConfigurationFilePathByDeviceIdentifier(
*
* Returns an empty string if not found.
*/
-extern String8 getInputDeviceConfigurationFilePathByName(
- const String8& name, InputDeviceConfigurationFileType type);
+extern std::string getInputDeviceConfigurationFilePathByName(
+ const std::string& name, InputDeviceConfigurationFileType type);
} // namespace android