Merge "BatteryService: scheduleUpdate asynchronously" am: 238a04ef59
am: 8eec5d9ee4
Change-Id: I97342299680ab5e89ad6fb53c7a24c469c30a4d3
This commit is contained in:
@@ -1235,14 +1235,21 @@ public final class BatteryService extends SystemService {
|
||||
}
|
||||
@Override
|
||||
public void scheduleUpdate() throws RemoteException {
|
||||
traceBegin("HealthScheduleUpdate");
|
||||
try {
|
||||
IHealth service = mHealthServiceWrapper.getLastService();
|
||||
if (service == null) throw new RemoteException("no health service");
|
||||
service.update();
|
||||
} finally {
|
||||
traceEnd();
|
||||
}
|
||||
mHealthServiceWrapper.getHandlerThread().getThreadHandler().post(() -> {
|
||||
traceBegin("HealthScheduleUpdate");
|
||||
try {
|
||||
IHealth service = mHealthServiceWrapper.getLastService();
|
||||
if (service == null) {
|
||||
Slog.e(TAG, "no health service");
|
||||
return;
|
||||
}
|
||||
service.update();
|
||||
} catch (RemoteException ex) {
|
||||
Slog.e(TAG, "Cannot call update on health HAL", ex);
|
||||
} finally {
|
||||
traceEnd();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1319,7 +1326,7 @@ public final class BatteryService extends SystemService {
|
||||
Arrays.asList(INSTANCE_VENDOR, INSTANCE_HEALTHD);
|
||||
|
||||
private final IServiceNotification mNotification = new Notification();
|
||||
private final HandlerThread mHandlerThread = new HandlerThread("HealthServiceRefresh");
|
||||
private final HandlerThread mHandlerThread = new HandlerThread("HealthServiceHwbinder");
|
||||
// These variables are fixed after init.
|
||||
private Callback mCallback;
|
||||
private IHealthSupplier mHealthSupplier;
|
||||
|
||||
Reference in New Issue
Block a user