Check VintfObject compatibility on boot

Bug: 36814984
Test: Build, flash boot sailfish and shared system image.
Change-Id: Ibd6694079d9e2641a7b77d774a2df085e9a8545a
This commit is contained in:
Michael Schwartz
2017-05-15 11:40:40 -07:00
parent aff7c3c71e
commit 1851118aa4

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");