Added the ability to read external batteries

Extended InputDevice and EventHub with capabilites to detect and read
external battery status and capacity. This allows devices such as
wireless gamepads to provide battery information to applications.

Bug: 161633432
Test: atest InputDeviceBatteryTest

Change-Id: I3c65166a1f0b055c5b85bad286afd5beb60bb303
Merged-In: I3c65166a1f0b055c5b85bad286afd5beb60bb303
diff --git a/services/inputflinger/include/InputReaderBase.h b/services/inputflinger/include/InputReaderBase.h
index ea9b483..69aea84 100644
--- a/services/inputflinger/include/InputReaderBase.h
+++ b/services/inputflinger/include/InputReaderBase.h
@@ -108,6 +108,10 @@
     virtual bool isVibrating(int32_t deviceId) = 0;
 
     virtual std::vector<int32_t> getVibratorIds(int32_t deviceId) = 0;
+    /* Get battery level of a particular input device. */
+    virtual std::optional<int32_t> getBatteryCapacity(int32_t deviceId) = 0;
+    /* Get battery status of a particular input device. */
+    virtual std::optional<int32_t> getBatteryStatus(int32_t deviceId) = 0;
 
     /* Return true if the device can send input events to the specified display. */
     virtual bool canDispatchToDisplay(int32_t deviceId, int32_t displayId) = 0;