Send the system image build fingerprint and bootloader versions.
In Android, we had STUBS for the bootloader (firmware) version, board,
and EC version. This patch populates those versions and strings based on
the system props using Android standard properties and includes the full
build.fingerprint in the request, which could be used to double-check
the request.
Bug: 35364971
Test: `update_engine_client --check_for_update` sends all this
information now.
(cherry picked from commit 094ce0bec1de7952e2ddc6c0f3c94dc3615b99c0)
Change-Id: I8265c5b8f4415f825160ea259c5b84b4b77372d7
diff --git a/hardware_android.cc b/hardware_android.cc
index 653ccf9..91c3fbe 100644
--- a/hardware_android.cc
+++ b/hardware_android.cc
@@ -25,6 +25,7 @@
#include <bootloader.h>
#include <base/files/file_util.h>
+#include <base/strings/stringprintf.h>
#include <brillo/make_unique_ptr.h>
#include <cutils/properties.h>
@@ -45,6 +46,15 @@
"--wipe_data\n"
"--reason=wipe_data_from_ota\n";
+// Android properties that identify the hardware and potentially non-updatable
+// parts of the bootloader (such as the bootloader version and the baseband
+// version).
+const char kPropBootBootloader[] = "ro.boot.bootloader";
+const char kPropBootBaseband[] = "ro.boot.baseband";
+const char kPropProductManufacturer[] = "ro.product.manufacturer";
+const char kPropBootHardwareSKU[] = "ro.boot.hardware.sku";
+const char kPropBootRevision[] = "ro.boot.revision";
+
// Write a recovery command line |message| to the BCB. The arguments to recovery
// must be separated by '\n'. An empty string will erase the BCB.
bool WriteBootloaderRecoveryMessage(const string& message) {
@@ -139,18 +149,26 @@
}
string HardwareAndroid::GetHardwareClass() const {
- LOG(WARNING) << "STUB: GetHardwareClass().";
- return "ANDROID";
+ char manufacturer[PROPERTY_VALUE_MAX];
+ char sku[PROPERTY_VALUE_MAX];
+ char revision[PROPERTY_VALUE_MAX];
+ property_get(kPropBootHardwareSKU, sku, "");
+ property_get(kPropProductManufacturer, manufacturer, "");
+ property_get(kPropBootRevision, revision, "");
+
+ return base::StringPrintf("%s:%s:%s", manufacturer, sku, revision);
}
string HardwareAndroid::GetFirmwareVersion() const {
- LOG(WARNING) << "STUB: GetFirmwareVersion().";
- return "0";
+ char bootloader[PROPERTY_VALUE_MAX];
+ property_get(kPropBootBootloader, bootloader, "");
+ return bootloader;
}
string HardwareAndroid::GetECVersion() const {
- LOG(WARNING) << "STUB: GetECVersion().";
- return "0";
+ char baseband[PROPERTY_VALUE_MAX];
+ property_get(kPropBootBaseband, baseband, "");
+ return baseband;
}
int HardwareAndroid::GetPowerwashCount() const {