Move InputDeviceClass to enum class.
Move InputDeviceClass to enum class, and move the device classes to
Flag<InputDeviceClass> type.
Bug: 160010896
Test: atest libinput_tests, atest inputflinger_tests
Change-Id: I7761e7f59e89a57b03b9805b28b17a5dd1ad10ef
diff --git a/services/inputflinger/reader/InputReader.cpp b/services/inputflinger/reader/InputReader.cpp
index 16fe865..bb1ccbf 100644
--- a/services/inputflinger/reader/InputReader.cpp
+++ b/services/inputflinger/reader/InputReader.cpp
@@ -208,7 +208,7 @@
mDevices.emplace(eventHubId, device);
bumpGenerationLocked();
- if (device->getClasses() & INPUT_DEVICE_CLASS_EXTERNAL_STYLUS) {
+ if (device->getClasses().test(InputDeviceClass::EXTERNAL_STYLUS)) {
notifyExternalStylusPresenceChanged();
}
}
@@ -237,7 +237,7 @@
device->removeEventHubDevice(eventHubId);
- if (device->getClasses() & INPUT_DEVICE_CLASS_EXTERNAL_STYLUS) {
+ if (device->getClasses().test(InputDeviceClass::EXTERNAL_STYLUS)) {
notifyExternalStylusPresenceChanged();
}
@@ -360,7 +360,7 @@
void InputReader::getExternalStylusDevicesLocked(std::vector<InputDeviceInfo>& outDevices) {
for (auto& devicePair : mDevices) {
std::shared_ptr<InputDevice>& device = devicePair.second;
- if (device->getClasses() & INPUT_DEVICE_CLASS_EXTERNAL_STYLUS && !device->isIgnored()) {
+ if (device->getClasses().test(InputDeviceClass::EXTERNAL_STYLUS) && !device->isIgnored()) {
InputDeviceInfo info;
device->getDeviceInfo(&info);
outDevices.push_back(info);