Merge "fastbootd: exporting more properties"

This commit is contained in:
Treehugger Robot 2020-01-23 07:34:09 +00:00 committed by Gerrit Code Review
commit cfd517d2a0
4 changed files with 84 additions and 1 deletions

View file

@ -47,6 +47,8 @@
#define FB_VAR_VERSION "version"
#define FB_VAR_VERSION_BOOTLOADER "version-bootloader"
#define FB_VAR_VERSION_BASEBAND "version-baseband"
#define FB_VAR_VERSION_OS "version-os"
#define FB_VAR_VERSION_VNDK "version-vndk"
#define FB_VAR_PRODUCT "product"
#define FB_VAR_SERIALNO "serialno"
#define FB_VAR_SECURE "secure"
@ -69,3 +71,9 @@
#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"
#define FB_VAR_SYSTEM_FINGERPRINT "system-fingerprint"
#define FB_VAR_VENDOR_FINGERPRINT "vendor-fingerprint"
#define FB_VAR_DYNAMIC_PARTITION "dynamic-partition"
#define FB_VAR_FIRST_API_LEVEL "first-api-level"
#define FB_VAR_SECURITY_PATCH_LEVEL "security-patch-level"
#define FB_VAR_TREBLE_ENABLED "treble-enabled"

View file

@ -106,6 +106,8 @@ bool GetVarHandler(FastbootDevice* device, const std::vector<std::string>& args)
{FB_VAR_VERSION, {GetVersion, nullptr}},
{FB_VAR_VERSION_BOOTLOADER, {GetBootloaderVersion, nullptr}},
{FB_VAR_VERSION_BASEBAND, {GetBasebandVersion, nullptr}},
{FB_VAR_VERSION_OS, {GetOsVersion, nullptr}},
{FB_VAR_VERSION_VNDK, {GetVndkVersion, nullptr}},
{FB_VAR_PRODUCT, {GetProduct, nullptr}},
{FB_VAR_SERIALNO, {GetSerial, nullptr}},
{FB_VAR_VARIANT, {GetVariant, nullptr}},
@ -127,7 +129,13 @@ bool GetVarHandler(FastbootDevice* device, const std::vector<std::string>& args)
{FB_VAR_HW_REVISION, {GetHardwareRevision, nullptr}},
{FB_VAR_SUPER_PARTITION_NAME, {GetSuperPartitionName, nullptr}},
{FB_VAR_SNAPSHOT_UPDATE_STATUS, {GetSnapshotUpdateStatus, nullptr}},
{FB_VAR_CPU_ABI, {GetCpuAbi, nullptr}}};
{FB_VAR_CPU_ABI, {GetCpuAbi, nullptr}},
{FB_VAR_SYSTEM_FINGERPRINT, {GetSystemFingerprint, nullptr}},
{FB_VAR_VENDOR_FINGERPRINT, {GetVendorFingerprint, nullptr}},
{FB_VAR_DYNAMIC_PARTITION, {GetDynamicPartition, nullptr}},
{FB_VAR_FIRST_API_LEVEL, {GetFirstApiLevel, nullptr}},
{FB_VAR_SECURITY_PATCH_LEVEL, {GetSecurityPatchLevel, nullptr}},
{FB_VAR_TREBLE_ENABLED, {GetTrebleEnabled, nullptr}}};
if (args.size() < 2) {
return device->WriteFail("Missing argument");

View file

@ -62,6 +62,18 @@ bool GetBasebandVersion(FastbootDevice* /* device */, const std::vector<std::str
return true;
}
bool GetOsVersion(FastbootDevice* /* device */, const std::vector<std::string>& /* args */,
std::string* message) {
*message = android::base::GetProperty("ro.build.version.release", "");
return true;
}
bool GetVndkVersion(FastbootDevice* /* device */, const std::vector<std::string>& /* args */,
std::string* message) {
*message = android::base::GetProperty("ro.vndk.version", "");
return true;
}
bool GetProduct(FastbootDevice* /* device */, const std::vector<std::string>& /* args */,
std::string* message) {
*message = android::base::GetProperty("ro.product.device", "");
@ -458,3 +470,42 @@ bool GetCpuAbi(FastbootDevice* /* device */, const std::vector<std::string>& /*
*message = android::base::GetProperty("ro.product.cpu.abi", "");
return true;
}
bool GetSystemFingerprint(FastbootDevice* /* device */, const std::vector<std::string>& /* args */,
std::string* message) {
*message = android::base::GetProperty("ro.system.build.fingerprint", "");
if (message->empty()) {
*message = android::base::GetProperty("ro.build.fingerprint", "");
}
return true;
}
bool GetVendorFingerprint(FastbootDevice* /* device */, const std::vector<std::string>& /* args */,
std::string* message) {
*message = android::base::GetProperty("ro.vendor.build.fingerprint", "");
return true;
}
bool GetDynamicPartition(FastbootDevice* /* device */, const std::vector<std::string>& /* args */,
std::string* message) {
*message = android::base::GetProperty("ro.boot.dynamic_partitions", "");
return true;
}
bool GetFirstApiLevel(FastbootDevice* /* device */, const std::vector<std::string>& /* args */,
std::string* message) {
*message = android::base::GetProperty("ro.product.first_api_level", "");
return true;
}
bool GetSecurityPatchLevel(FastbootDevice* /* device */, const std::vector<std::string>& /* args */,
std::string* message) {
*message = android::base::GetProperty("ro.build.version.security_patch", "");
return true;
}
bool GetTrebleEnabled(FastbootDevice* /* device */, const std::vector<std::string>& /* args */,
std::string* message) {
*message = android::base::GetProperty("ro.treble.enabled", "");
return true;
}

View file

@ -26,6 +26,10 @@ bool GetBootloaderVersion(FastbootDevice* device, const std::vector<std::string>
std::string* message);
bool GetBasebandVersion(FastbootDevice* device, const std::vector<std::string>& args,
std::string* message);
bool GetOsVersion(FastbootDevice* device, const std::vector<std::string>& args,
std::string* message);
bool GetVndkVersion(FastbootDevice* device, const std::vector<std::string>& args,
std::string* message);
bool GetProduct(FastbootDevice* device, const std::vector<std::string>& args, std::string* message);
bool GetSerial(FastbootDevice* device, const std::vector<std::string>& args, std::string* message);
bool GetSecure(FastbootDevice* device, const std::vector<std::string>& args, std::string* message);
@ -64,6 +68,18 @@ bool GetSuperPartitionName(FastbootDevice* device, const std::vector<std::string
bool GetSnapshotUpdateStatus(FastbootDevice* device, const std::vector<std::string>& args,
std::string* message);
bool GetCpuAbi(FastbootDevice* device, const std::vector<std::string>& args, std::string* message);
bool GetSystemFingerprint(FastbootDevice* device, const std::vector<std::string>& args,
std::string* message);
bool GetVendorFingerprint(FastbootDevice* device, const std::vector<std::string>& args,
std::string* message);
bool GetDynamicPartition(FastbootDevice* device, const std::vector<std::string>& args,
std::string* message);
bool GetFirstApiLevel(FastbootDevice* device, const std::vector<std::string>& args,
std::string* message);
bool GetSecurityPatchLevel(FastbootDevice* device, const std::vector<std::string>& args,
std::string* message);
bool GetTrebleEnabled(FastbootDevice* device, const std::vector<std::string>& args,
std::string* message);
// Helpers for getvar all.
std::vector<std::vector<std::string>> GetAllPartitionArgsWithSlot(FastbootDevice* device);