healthd中充电类型的识别

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},
    };

  

posted @ 2024-07-10 12:18  轻轻的吻  阅读(39)  评论(0编辑  收藏  举报