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/BatteryService.cpp b/services/sensorservice/BatteryService.cpp
index 94de55c..b0fbe5d 100644
--- a/services/sensorservice/BatteryService.cpp
+++ b/services/sensorservice/BatteryService.cpp
@@ -74,6 +74,14 @@
}
}
+void BatteryService::noteWakeupSensorEventImpl(int64_t elapsedNanos, uid_t uid, int handle) {
+ if (checkService()) {
+ int64_t identity = IPCThreadState::self()->clearCallingIdentity();
+ mBatteryStatService->noteWakeupSensorEvent(elapsedNanos, uid, handle);
+ IPCThreadState::self()->restoreCallingIdentity(identity);
+ }
+}
+
bool BatteryService::checkService() {
if (mBatteryStatService == nullptr) {
const sp<IServiceManager> sm(defaultServiceManager());