fastboot: Hide bootloader/baseband/hw versions if empty
Change-Id: I557957da2a13a2c64b76f6126409363334af7a93
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index ac30192..1000554 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -37,14 +37,23 @@
};
void FillDefaultFastbootLines(std::vector<std::string>& title_lines) {
+ std::string bootloader_version = android::base::GetProperty("ro.bootloader", "");
+ std::string baseband_version = android::base::GetProperty("ro.build.expect.baseband", "");
+ std::string hw_version = android::base::GetProperty("ro.revision", "");
+
title_lines.push_back("Product name - " + android::base::GetProperty("ro.product.device", ""));
- title_lines.push_back("Bootloader version - " + android::base::GetProperty("ro.bootloader", ""));
- title_lines.push_back("Baseband version - " +
- android::base::GetProperty("ro.build.expect.baseband", ""));
+ if (!android::base::EqualsIgnoreCase(bootloader_version, "unknown")) {
+ title_lines.push_back("Bootloader version - " + bootloader_version);
+ }
+ if (!baseband_version.empty()) {
+ title_lines.push_back("Baseband version - " + baseband_version);
+ }
title_lines.push_back("Serial number - " + android::base::GetProperty("ro.serialno", ""));
title_lines.push_back(std::string("Secure boot - ") +
((android::base::GetProperty("ro.secure", "") == "1") ? "yes" : "no"));
- title_lines.push_back("HW version - " + android::base::GetProperty("ro.revision", ""));
+ if (!android::base::EqualsIgnoreCase(hw_version, "0")) {
+ title_lines.push_back("HW version - " + android::base::GetProperty("ro.revision", ""));
+ }
}
void FillWearableFastbootLines(std::vector<std::string>& title_lines) {