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

Commit a397ac4a authored by Yeabkal Wubshit's avatar Yeabkal Wubshit Committed by Android (Google) Code Review
Browse files

Merge "Support -f option for Current shell command" into main

parents 3069c5c5 abf0df95
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -974,6 +974,7 @@ public final class BatteryService extends SystemService {
                unplugBattery(/* forceUpdate= */ (opts & OPTION_FORCE_UPDATE) != 0, pw);
            } break;
            case "get": {
                final int opts = parseOptions(shell);
                final String key = shell.getNextArg();
                if (key == null) {
                    pw.println("No property specified");
@@ -1007,11 +1008,17 @@ public final class BatteryService extends SystemService {
                        break;
                    case "current_now":
                        if (batteryServiceSupportCurrentAdbCommand()) {
                            if ((opts & OPTION_FORCE_UPDATE) != 0) {
                                updateHealthInfo();
                            }
                            pw.println(mHealthInfo.batteryCurrentMicroamps);
                        }
                        break;
                    case "current_average":
                        if (batteryServiceSupportCurrentAdbCommand()) {
                            if ((opts & OPTION_FORCE_UPDATE) != 0) {
                                updateHealthInfo();
                            }
                            pw.println(mHealthInfo.batteryCurrentAverageMicroamps);
                        }
                        break;
@@ -1125,6 +1132,14 @@ public final class BatteryService extends SystemService {
        return 0;
    }

    private void updateHealthInfo() {
        try {
            mHealthServiceWrapper.scheduleUpdate();
        } catch (RemoteException e) {
            Slog.e(TAG, "Unable to update health service data.", e);
        }
    }

    private void setChargerAcOnline(boolean online, boolean forceUpdate) {
        if (!mUpdatesStopped) {
            copyV1Battery(mLastHealthInfo, mHealthInfo);