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

Unverified Commit e31cb08c authored by Zhao Wei Liew's avatar Zhao Wei Liew Committed by Michael Bestas
Browse files

batteryservice: Remove remnants of CAF's HVDCP changes

Commit 86e9bc79 removed the usage
of isHvdcpPresent(), but did not remove the function itself.

Remove isHvdcpPresent() as clean-up.

This essentially reverts the rest of the following commits:
9f8e6008 batteryservice: Avoid exception if device doesn't support HVDCP
4df4f532 batteryservice: add support for charger led blinking

Change-Id: Ie39c11ee9811f6af84a55ed85b72123cc449c735
parent 20549453
Loading
Loading
Loading
Loading
+0 −29
Original line number Diff line number Diff line
@@ -58,9 +58,7 @@ import java.io.File;
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;

@@ -965,33 +963,6 @@ public final class BatteryService extends SystemService {
                    org.cyanogenmod.platform.internal.R.bool.config_useSegmentedBatteryLed);
        }

        private boolean isHvdcpPresent() {
            File mChargerTypeFile = new File("/sys/class/power_supply/usb/type");
            FileReader fileReader;
            BufferedReader br;
            String type;
            boolean ret = false;

            if (!mChargerTypeFile.exists()) {
                // Device does not support HVDCP
                return ret;
            }

            try {
                fileReader = new FileReader(mChargerTypeFile);
                br = new BufferedReader(fileReader);
                type =  br.readLine();
                if (type.regionMatches(true, 0, "USB_HVDCP", 0, 9))
                    ret = true;
                br.close();
                fileReader.close();
            } catch (IOException e) {
                Slog.e(TAG, "Failure in reading charger type", e);
            }

            return ret;
        }

        /**
         * Synchronize on BatteryService.
         */