Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e962321 authored by Michael Schwartz's avatar Michael Schwartz Committed by Android (Google) Code Review
Browse files

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

parents 39b375c9 1851118a
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -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");