Allow no ro.vendor.fingerprint am: f703196045 am: 87dccab91c am: 00e174bd74 am: 0b6d2a1c74
am: 11cdae32ac

Bug: 138173477
Bug: 138346824
Bug: 138313101
Bug: 138352618

Change-Id: Icfedf5fa76af8eed723fa40d3f360374fd7bbdfb
(cherry picked from commit 874eff2e0ef9b9321d186767eee30aaefd5acb57)
Merged-In: 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());
                 }