From 33da5c9493c1ecd8a9930f7780ff589d129bfe65 Mon Sep 17 00:00:00 2001 From: Bowgo Tsai Date: Wed, 13 Nov 2019 17:13:49 +0800 Subject: [PATCH] fastbootd: exporting CPU ABI info CPU ABI info, e.g., arm64-v8a, can be useful to determine image compatibility, prior to flash. Adding this info in fastbootd. Bug: 74445765 Test: fastboot getvar cpu-abi # arm64-v8a Change-Id: Ied494b646c551320295956b7890c0102fdb88382 --- fastboot/constants.h | 1 + fastboot/device/commands.cpp | 3 ++- fastboot/device/variables.cpp | 6 ++++++ fastboot/device/variables.h | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fastboot/constants.h b/fastboot/constants.h index 7fba67c54..5a554a0d2 100644 --- a/fastboot/constants.h +++ b/fastboot/constants.h @@ -68,3 +68,4 @@ #define FB_VAR_BATTERY_SOC_OK "battery-soc-ok" #define FB_VAR_SUPER_PARTITION_NAME "super-partition-name" #define FB_VAR_SNAPSHOT_UPDATE_STATUS "snapshot-update-status" +#define FB_VAR_CPU_ABI "cpu-abi" diff --git a/fastboot/device/commands.cpp b/fastboot/device/commands.cpp index dfd569062..a2c95d636 100644 --- a/fastboot/device/commands.cpp +++ b/fastboot/device/commands.cpp @@ -105,7 +105,8 @@ bool GetVarHandler(FastbootDevice* device, const std::vector& args) {FB_VAR_BATTERY_SOC_OK, {GetBatterySoCOk, nullptr}}, {FB_VAR_HW_REVISION, {GetHardwareRevision, nullptr}}, {FB_VAR_SUPER_PARTITION_NAME, {GetSuperPartitionName, nullptr}}, - {FB_VAR_SNAPSHOT_UPDATE_STATUS, {GetSnapshotUpdateStatus, nullptr}}}; + {FB_VAR_SNAPSHOT_UPDATE_STATUS, {GetSnapshotUpdateStatus, nullptr}}, + {FB_VAR_CPU_ABI, {GetCpuAbi, nullptr}}}; if (args.size() < 2) { return device->WriteFail("Missing argument"); diff --git a/fastboot/device/variables.cpp b/fastboot/device/variables.cpp index 6e613d647..717db064f 100644 --- a/fastboot/device/variables.cpp +++ b/fastboot/device/variables.cpp @@ -458,3 +458,9 @@ bool GetSnapshotUpdateStatus(FastbootDevice* device, const std::vector& /* args */, + std::string* message) { + *message = android::base::GetProperty("ro.product.cpu.abi", ""); + return true; +} diff --git a/fastboot/device/variables.h b/fastboot/device/variables.h index 4dec10f79..90840d6d2 100644 --- a/fastboot/device/variables.h +++ b/fastboot/device/variables.h @@ -63,6 +63,7 @@ bool GetSuperPartitionName(FastbootDevice* device, const std::vector& args, std::string* message); +bool GetCpuAbi(FastbootDevice* device, const std::vector& args, std::string* message); // Helpers for getvar all. std::vector> GetAllPartitionArgsWithSlot(FastbootDevice* device);