diff options
| author | 2017-05-24 21:50:47 +0000 | |
|---|---|---|
| committer | 2017-05-24 21:50:47 +0000 | |
| commit | ab0605ceb537bd10f946a41f44d689dc5e88355d (patch) | |
| tree | 94f8bd62ce042fa3b71606494bc2996e9d0c3256 | |
| parent | 6fbbedb6be6f9c4fff7f79d08539f858475f9b26 (diff) | |
| parent | 4e962321ad30709d04ca23e59aec26015d3a39a3 (diff) | |
Merge "Check VintfObject compatibility on boot" into oc-dev
am: 4e962321ad
Change-Id: Ie3f55facc983e421432549440a81c1978c3e9482
| -rw-r--r-- | core/java/android/os/Build.java | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 4bad7ab76be6..a2fb9db8c64b 100644 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -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"); |