Refactor InputController into PeripheralController.
Rename the InputController and related class to PeripheralController,
and rename MiscDevice to AssociatedDevice to better reflect the behavior
of these hardwares.
Bug: 13831915
Test: atest inputflinger_tests
Change-Id: Ib61f7f6cc4fe616d08afc29bf1f1e08c1c9f565d
diff --git a/services/inputflinger/reader/InputDevice.cpp b/services/inputflinger/reader/InputDevice.cpp
index f935c36..8f75d22 100644
--- a/services/inputflinger/reader/InputDevice.cpp
+++ b/services/inputflinger/reader/InputDevice.cpp
@@ -23,11 +23,11 @@
#include "CursorInputMapper.h"
#include "ExternalStylusInputMapper.h"
-#include "InputController.h"
#include "InputReaderContext.h"
#include "JoystickInputMapper.h"
#include "KeyboardInputMapper.h"
#include "MultiTouchInputMapper.h"
+#include "PeripheralController.h"
#include "RotaryEncoderInputMapper.h"
#include "SensorInputMapper.h"
#include "SingleTouchInputMapper.h"
@@ -165,9 +165,9 @@
}
// Battery-like devices or light-containing devices.
- // InputController will be created with associated EventHub device.
+ // PeripheralController will be created with associated EventHub device.
if (classes.test(InputDeviceClass::BATTERY) || classes.test(InputDeviceClass::LIGHT)) {
- mController = std::make_unique<InputController>(*contextPtr);
+ mController = std::make_unique<PeripheralController>(*contextPtr);
}
// Keyboard-like devices.
@@ -504,8 +504,6 @@
for_each_mapper([when, readTime](InputMapper& mapper) { mapper.cancelTouch(when, readTime); });
}
-// TODO b/180733860 support multiple battery in API and remove this.
-constexpr int32_t DEFAULT_BATTERY_ID = 1;
std::optional<int32_t> InputDevice::getBatteryCapacity() {
return mController ? mController->getBatteryCapacity(DEFAULT_BATTERY_ID) : std::nullopt;
}