BatteryService: allow IBatteryPropertiesRegistrar.scheduleUpdate calls
It is called by BatteryStatsImpl to request callbacks to be invoked.
Bug: 68217725
Test: logcat no longer shows
"must not call scheduleUpdate on battery properties"
Change-Id: I1f5b4ea8f85b72d386a97a9930edda806416bb1a
diff --git a/services/core/java/com/android/server/BatteryService.java b/services/core/java/com/android/server/BatteryService.java
index 46b671b..e7cf041 100644
--- a/services/core/java/com/android/server/BatteryService.java
+++ b/services/core/java/com/android/server/BatteryService.java
@@ -1060,6 +1060,7 @@
}
public int getProperty(int id, final BatteryProperty prop) throws RemoteException {
IHealth service = mHealthServiceWrapper.getLastService();
+ if (service == null) throw new RemoteException("no health service");
final MutableInt outResult = new MutableInt(Result.NOT_SUPPORTED);
switch(id) {
case BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER:
@@ -1101,8 +1102,10 @@
}
return outResult.value;
}
- public void scheduleUpdate() {
- Slog.e(TAG, "health: must not call scheduleUpdate on battery properties");
+ public void scheduleUpdate() throws RemoteException {
+ IHealth service = mHealthServiceWrapper.getLastService();
+ if (service == null) throw new RemoteException("no health service");
+ service.update();
}
}