From e2b1e5c71765d5b8bc303bbfa6741c0c96e95d44 Mon Sep 17 00:00:00 2001 From: Chris Ye Date: Wed, 10 Mar 2021 22:45:12 -0800 Subject: Introduce Device Controller to InputReader Introduce Device Controller to manage non-evdev devices associated with the input device kernel interface. These devices doesn't interact with inputflinger with input events which requires a mapper to process the raw event with assoicated input sources. Bug: 180342233 Test: atest inputflinger_tests Change-Id: Ib492bb3de889db180c05367bb6a7e7a2e0d78ce7 --- libs/input/InputDevice.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libs/input/InputDevice.cpp') diff --git a/libs/input/InputDevice.cpp b/libs/input/InputDevice.cpp index ffcc1cd93a..31027b6476 100644 --- a/libs/input/InputDevice.cpp +++ b/libs/input/InputDevice.cpp @@ -231,6 +231,13 @@ void InputDeviceInfo::addSensorInfo(const InputDeviceSensorInfo& info) { mSensors.insert_or_assign(info.type, info); } +void InputDeviceInfo::addBatteryInfo(const InputDeviceBatteryInfo& info) { + if (mBatteries.find(info.id) != mBatteries.end()) { + ALOGW("Battery id %d already exists, will be replaced by new battery added.", info.id); + } + mBatteries.insert_or_assign(info.id, info); +} + void InputDeviceInfo::addLightInfo(const InputDeviceLightInfo& info) { if (mLights.find(info.id) != mLights.end()) { ALOGW("Light id %d already exists, will be replaced by new light added.", info.id); -- cgit v1.2.3-59-g8ed1b