Merge "Check VintfObject compatibility on boot" into oc-dev

This commit is contained in:
Michael Schwartz
2017-05-24 21:34:03 +00:00
committed by Android (Google) Code Review

View File

@@ -807,8 +807,20 @@ public class Build {
}
/**
* Verifies the the current flash of the device is consistent with what
* True if Treble is enabled and required for this device.
*
* @hide
*/
public static final boolean IS_TREBLE_ENABLED =
SystemProperties.getBoolean("ro.treble.enabled", false);
/**
* Verifies the current flash of the device is consistent with what
* was expected at build time.
*
* Treble devices will verify the Vendor Interface (VINTF). A device
* launched without Treble:
*
* 1) Checks that device fingerprint is defined and that it matches across
* various partitions.
* 2) Verifies radio and bootloader partitions are those expected in the build.
@@ -819,6 +831,17 @@ public class Build {
// Don't care on eng builds. Incremental build may trigger false negative.
if (IS_ENG) return true;
if (IS_TREBLE_ENABLED) {
int result = VintfObject.verify(new String[0]);
if (result != 0) {
Slog.e(TAG, "Vendor interface is incompatible, error="
+ String.valueOf(result));
}
return result == 0;
}
final String system = SystemProperties.get("ro.build.fingerprint");
final String vendor = SystemProperties.get("ro.vendor.build.fingerprint");
final String bootimage = SystemProperties.get("ro.bootimage.build.fingerprint");