healthd中充電型別的識別

轻轻的吻發表於2024-07-10

LA.UM.9.15.2.C3/system/core/healthd/BatteryMonitor.cpp

healthd中chg是AC還是usb充電讀取的是/sys/class/power_supply/usb/type

BatteryMonitor::PowerSupplyType BatteryMonitor::readPowerSupplyType(const String8& path) {
    static SysfsStringEnumMap<int> supplyTypeMap[] = {
            {"Unknown", ANDROID_POWER_SUPPLY_TYPE_UNKNOWN},
            {"Battery", ANDROID_POWER_SUPPLY_TYPE_BATTERY},
            {"UPS", ANDROID_POWER_SUPPLY_TYPE_AC},
            {"Mains", ANDROID_POWER_SUPPLY_TYPE_AC},
            {"USB", ANDROID_POWER_SUPPLY_TYPE_USB},
            {"USB_DCP", ANDROID_POWER_SUPPLY_TYPE_AC},
            {"USB_HVDCP", ANDROID_POWER_SUPPLY_TYPE_AC},
            {"USB_CDP", ANDROID_POWER_SUPPLY_TYPE_AC},
            {"USB_ACA", ANDROID_POWER_SUPPLY_TYPE_AC},
            {"USB_C", ANDROID_POWER_SUPPLY_TYPE_AC},
            {"USB_PD", ANDROID_POWER_SUPPLY_TYPE_AC},
            {"USB_PD_DRP", ANDROID_POWER_SUPPLY_TYPE_USB},
            {"Wireless", ANDROID_POWER_SUPPLY_TYPE_WIRELESS},
            {NULL, 0},
    };

  

相關文章