Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c28b2ef authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Implement getBatteryHealthData in HealthServiceWrapper" into main

parents ab5ee287 e51ae85f
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -70,6 +70,21 @@ public abstract class HealthServiceWrapper {
     */
    public abstract android.hardware.health.HealthInfo getHealthInfo() throws RemoteException;

    /**
     * Calls into getBatteryHealthData() in the health HAL.
     * This function does not have a corresponding HIDL implementation, so
     * returns null by default, unless there is an AIDL class that overrides
     * this one.
     *
     * @return battery health data. {@code null} if no health HAL service.
     *     {@code null} if any service-specific error when calling {@code
     *     getBatteryHealthData}, e.g. it is unsupported.
     * @throws RemoteException for any transaction-level errors
     */
    public android.hardware.health.BatteryHealthData getBatteryHealthData() throws RemoteException {
        return null;
    }

    /**
     * Create a new HealthServiceWrapper instance.
     *
+11 −0
Original line number Diff line number Diff line
@@ -212,6 +212,17 @@ class HealthServiceWrapperAidl extends HealthServiceWrapper {
        }
    }

    @Override
    public BatteryHealthData getBatteryHealthData() throws RemoteException {
        IHealth service = mLastService.get();
        if (service == null) return null;
        try {
            return service.getBatteryHealthData();
        } catch (UnsupportedOperationException | ServiceSpecificException ex) {
            return null;
        }
    }

    public void setChargingPolicy(int policy) throws RemoteException {
        IHealth service = mLastService.get();
        if (service == null) return;