Pipe wakeup sensor events to batterystats

Creating another method in BatteryService to send notifcations from
sensor event connection to BatteryStatsService.

Passing the sensor handle so java code can retrieve a Sensor object and
then query any properties of the sensor from there.

Test: Manually trigger sensor events and check logcat

Ignore-AOSP-First: AIDL method definition not present in AOSP.

Bug: 275436924
Change-Id: I7c3009b33a38047463214eb32ba67925ddc20773
diff --git a/services/sensorservice/SensorEventConnection.cpp b/services/sensorservice/SensorEventConnection.cpp
index 7a6b31d..dc5070c 100644
--- a/services/sensorservice/SensorEventConnection.cpp
+++ b/services/sensorservice/SensorEventConnection.cpp
@@ -23,6 +23,7 @@
 #include <sensor/SensorEventQueue.h>
 
 #include "vec.h"
+#include "BatteryService.h"
 #include "SensorEventConnection.h"
 #include "SensorDevice.h"
 
@@ -391,6 +392,8 @@
     if (hasSensorAccess()) {
         index_wake_up_event = findWakeUpSensorEventLocked(scratch, count);
         if (index_wake_up_event >= 0) {
+            BatteryService::noteWakeupSensorEvent(scratch[index_wake_up_event].timestamp,
+                                                  mUid, scratch[index_wake_up_event].sensor);
             scratch[index_wake_up_event].flags |= WAKE_UP_SENSOR_EVENT_NEEDS_ACK;
             ++mWakeLockRefCount;
 #if DEBUG_CONNECTIONS