Allow no ro.vendor.fingerprint
Some older device don't have that property so ensure that
we only check it if it was available in retry.
Test: unit tests
Bug: 138173477
Change-Id: I3a5c3c18b86a41ae2221d4c2a8b6448e3bb77a04
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/BuildFingerPrintPreparer.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/BuildFingerPrintPreparer.java
index a96b76a..30e303b 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/BuildFingerPrintPreparer.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/BuildFingerPrintPreparer.java
@@ -54,17 +54,22 @@
if (!compare.equals(currentBuildFingerprint)) {
throw new TargetSetupError(
String.format(
- "Device build fingerprint must match %s. Found '%s' instead.",
+ "Device build fingerprint must match '%s'. Found '%s' instead.",
compare, currentBuildFingerprint),
device.getDeviceDescriptor());
}
if (mExpectedVendorFingerprint != null) {
String currentBuildVendorFingerprint =
device.getProperty(mVendorFingerprintProperty);
+ // Replace by empty string if null to do a proper comparison.
+ if (currentBuildVendorFingerprint == null) {
+ currentBuildVendorFingerprint = "";
+ }
if (!mExpectedVendorFingerprint.equals(currentBuildVendorFingerprint)) {
throw new TargetSetupError(
String.format(
- "Device vendor build fingerprint must match %s - found %s instead.",
+ "Device vendor build fingerprint must match '%s'. Found '%s' "
+ + "instead.",
mExpectedVendorFingerprint, currentBuildVendorFingerprint),
device.getDeviceDescriptor());
}