Loading fastboot/constants.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -69,6 +69,7 @@ #define FB_VAR_VARIANT "variant" #define FB_VAR_VARIANT "variant" #define FB_VAR_OFF_MODE_CHARGE_STATE "off-mode-charge" #define FB_VAR_OFF_MODE_CHARGE_STATE "off-mode-charge" #define FB_VAR_BATTERY_VOLTAGE "battery-voltage" #define FB_VAR_BATTERY_VOLTAGE "battery-voltage" #define FB_VAR_BATTERY_SOC "battery-soc" #define FB_VAR_BATTERY_SOC_OK "battery-soc-ok" #define FB_VAR_BATTERY_SOC_OK "battery-soc-ok" #define FB_VAR_SUPER_PARTITION_NAME "super-partition-name" #define FB_VAR_SUPER_PARTITION_NAME "super-partition-name" #define FB_VAR_SNAPSHOT_UPDATE_STATUS "snapshot-update-status" #define FB_VAR_SNAPSHOT_UPDATE_STATUS "snapshot-update-status" Loading fastboot/device/commands.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -134,6 +134,7 @@ const std::unordered_map<std::string, VariableHandlers> kVariableMap = { {FB_VAR_IS_FORCE_DEBUGGABLE, {GetIsForceDebuggable, nullptr}}, {FB_VAR_IS_FORCE_DEBUGGABLE, {GetIsForceDebuggable, nullptr}}, {FB_VAR_OFF_MODE_CHARGE_STATE, {GetOffModeChargeState, nullptr}}, {FB_VAR_OFF_MODE_CHARGE_STATE, {GetOffModeChargeState, nullptr}}, {FB_VAR_BATTERY_VOLTAGE, {GetBatteryVoltage, nullptr}}, {FB_VAR_BATTERY_VOLTAGE, {GetBatteryVoltage, nullptr}}, {FB_VAR_BATTERY_SOC, {GetBatterySoC, nullptr}}, {FB_VAR_BATTERY_SOC_OK, {GetBatterySoCOk, nullptr}}, {FB_VAR_BATTERY_SOC_OK, {GetBatterySoCOk, nullptr}}, {FB_VAR_HW_REVISION, {GetHardwareRevision, nullptr}}, {FB_VAR_HW_REVISION, {GetHardwareRevision, nullptr}}, {FB_VAR_SUPER_PARTITION_NAME, {GetSuperPartitionName, nullptr}}, {FB_VAR_SUPER_PARTITION_NAME, {GetSuperPartitionName, nullptr}}, Loading fastboot/device/variables.cpp +26 −0 Original line number Original line Diff line number Diff line Loading @@ -130,6 +130,21 @@ bool GetBatteryVoltageHelper(FastbootDevice* device, int32_t* battery_voltage) { return true; return true; } } bool GetBatterySoCHelper(FastbootDevice* device, int32_t* battery_soc) { using aidl::android::hardware::health::HealthInfo; auto health_hal = device->health_hal(); if (!health_hal) { return false; } HealthInfo health_info; auto res = health_hal->getHealthInfo(&health_info); if (!res.isOk()) return false; *battery_soc = health_info.batteryLevel; return true; } bool GetBatterySoCOk(FastbootDevice* device, const std::vector<std::string>& /* args */, bool GetBatterySoCOk(FastbootDevice* device, const std::vector<std::string>& /* args */, std::string* message) { std::string* message) { int32_t battery_voltage = 0; int32_t battery_voltage = 0; Loading Loading @@ -185,6 +200,17 @@ bool GetBatteryVoltage(FastbootDevice* device, const std::vector<std::string>& / return false; return false; } } bool GetBatterySoC(FastbootDevice* device, const std::vector<std::string>& /* args */, std::string* message) { int32_t battery_soc = 0; if (GetBatterySoCHelper(device, &battery_soc)) { *message = std::to_string(battery_soc); return true; } *message = "Unable to get battery soc"; return false; } bool GetCurrentSlot(FastbootDevice* device, const std::vector<std::string>& /* args */, bool GetCurrentSlot(FastbootDevice* device, const std::vector<std::string>& /* args */, std::string* message) { std::string* message) { std::string suffix = device->GetCurrentSlot(); std::string suffix = device->GetCurrentSlot(); Loading fastboot/device/variables.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,8 @@ bool GetOffModeChargeState(FastbootDevice* device, const std::vector<std::string std::string* message); std::string* message); bool GetBatteryVoltage(FastbootDevice* device, const std::vector<std::string>& args, bool GetBatteryVoltage(FastbootDevice* device, const std::vector<std::string>& args, std::string* message); std::string* message); bool GetBatterySoC(FastbootDevice* device, const std::vector<std::string>& args, std::string* message); bool GetBatterySoCOk(FastbootDevice* device, const std::vector<std::string>& args, bool GetBatterySoCOk(FastbootDevice* device, const std::vector<std::string>& args, std::string* message); std::string* message); bool GetSuperPartitionName(FastbootDevice* device, const std::vector<std::string>& args, bool GetSuperPartitionName(FastbootDevice* device, const std::vector<std::string>& args, Loading Loading
fastboot/constants.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -69,6 +69,7 @@ #define FB_VAR_VARIANT "variant" #define FB_VAR_VARIANT "variant" #define FB_VAR_OFF_MODE_CHARGE_STATE "off-mode-charge" #define FB_VAR_OFF_MODE_CHARGE_STATE "off-mode-charge" #define FB_VAR_BATTERY_VOLTAGE "battery-voltage" #define FB_VAR_BATTERY_VOLTAGE "battery-voltage" #define FB_VAR_BATTERY_SOC "battery-soc" #define FB_VAR_BATTERY_SOC_OK "battery-soc-ok" #define FB_VAR_BATTERY_SOC_OK "battery-soc-ok" #define FB_VAR_SUPER_PARTITION_NAME "super-partition-name" #define FB_VAR_SUPER_PARTITION_NAME "super-partition-name" #define FB_VAR_SNAPSHOT_UPDATE_STATUS "snapshot-update-status" #define FB_VAR_SNAPSHOT_UPDATE_STATUS "snapshot-update-status" Loading
fastboot/device/commands.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -134,6 +134,7 @@ const std::unordered_map<std::string, VariableHandlers> kVariableMap = { {FB_VAR_IS_FORCE_DEBUGGABLE, {GetIsForceDebuggable, nullptr}}, {FB_VAR_IS_FORCE_DEBUGGABLE, {GetIsForceDebuggable, nullptr}}, {FB_VAR_OFF_MODE_CHARGE_STATE, {GetOffModeChargeState, nullptr}}, {FB_VAR_OFF_MODE_CHARGE_STATE, {GetOffModeChargeState, nullptr}}, {FB_VAR_BATTERY_VOLTAGE, {GetBatteryVoltage, nullptr}}, {FB_VAR_BATTERY_VOLTAGE, {GetBatteryVoltage, nullptr}}, {FB_VAR_BATTERY_SOC, {GetBatterySoC, nullptr}}, {FB_VAR_BATTERY_SOC_OK, {GetBatterySoCOk, nullptr}}, {FB_VAR_BATTERY_SOC_OK, {GetBatterySoCOk, nullptr}}, {FB_VAR_HW_REVISION, {GetHardwareRevision, nullptr}}, {FB_VAR_HW_REVISION, {GetHardwareRevision, nullptr}}, {FB_VAR_SUPER_PARTITION_NAME, {GetSuperPartitionName, nullptr}}, {FB_VAR_SUPER_PARTITION_NAME, {GetSuperPartitionName, nullptr}}, Loading
fastboot/device/variables.cpp +26 −0 Original line number Original line Diff line number Diff line Loading @@ -130,6 +130,21 @@ bool GetBatteryVoltageHelper(FastbootDevice* device, int32_t* battery_voltage) { return true; return true; } } bool GetBatterySoCHelper(FastbootDevice* device, int32_t* battery_soc) { using aidl::android::hardware::health::HealthInfo; auto health_hal = device->health_hal(); if (!health_hal) { return false; } HealthInfo health_info; auto res = health_hal->getHealthInfo(&health_info); if (!res.isOk()) return false; *battery_soc = health_info.batteryLevel; return true; } bool GetBatterySoCOk(FastbootDevice* device, const std::vector<std::string>& /* args */, bool GetBatterySoCOk(FastbootDevice* device, const std::vector<std::string>& /* args */, std::string* message) { std::string* message) { int32_t battery_voltage = 0; int32_t battery_voltage = 0; Loading Loading @@ -185,6 +200,17 @@ bool GetBatteryVoltage(FastbootDevice* device, const std::vector<std::string>& / return false; return false; } } bool GetBatterySoC(FastbootDevice* device, const std::vector<std::string>& /* args */, std::string* message) { int32_t battery_soc = 0; if (GetBatterySoCHelper(device, &battery_soc)) { *message = std::to_string(battery_soc); return true; } *message = "Unable to get battery soc"; return false; } bool GetCurrentSlot(FastbootDevice* device, const std::vector<std::string>& /* args */, bool GetCurrentSlot(FastbootDevice* device, const std::vector<std::string>& /* args */, std::string* message) { std::string* message) { std::string suffix = device->GetCurrentSlot(); std::string suffix = device->GetCurrentSlot(); Loading
fastboot/device/variables.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,8 @@ bool GetOffModeChargeState(FastbootDevice* device, const std::vector<std::string std::string* message); std::string* message); bool GetBatteryVoltage(FastbootDevice* device, const std::vector<std::string>& args, bool GetBatteryVoltage(FastbootDevice* device, const std::vector<std::string>& args, std::string* message); std::string* message); bool GetBatterySoC(FastbootDevice* device, const std::vector<std::string>& args, std::string* message); bool GetBatterySoCOk(FastbootDevice* device, const std::vector<std::string>& args, bool GetBatterySoCOk(FastbootDevice* device, const std::vector<std::string>& args, std::string* message); std::string* message); bool GetSuperPartitionName(FastbootDevice* device, const std::vector<std::string>& args, bool GetSuperPartitionName(FastbootDevice* device, const std::vector<std::string>& args, Loading