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

Commit 2ca96c73 authored by Elliott Hughes's avatar Elliott Hughes Committed by Android (Google) Code Review
Browse files

Merge "All devices are treble now." into main

parents 7b7dd8c0 92e57980
Loading
Loading
Loading
Loading
+4 −65
Original line number Diff line number Diff line
@@ -1753,14 +1753,6 @@ public class Build {
    public static final int HW_TIMEOUT_MULTIPLIER =
        SystemProperties.getInt("ro.hw_timeout_multiplier", 1);

    /**
     * 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.
@@ -1778,65 +1770,12 @@ 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.verifyBuildAtBoot();

        if (result != 0) {
                Slog.e(TAG, "Vendor interface is incompatible, error="
                        + String.valueOf(result));
            }

            return result == 0;
        }

        final String system = SystemProperties.get("ro.system.build.fingerprint");
        final String vendor = SystemProperties.get("ro.vendor.build.fingerprint");
        final String bootimage = SystemProperties.get("ro.bootimage.build.fingerprint");
        final String requiredBootloader = SystemProperties.get("ro.build.expect.bootloader");
        final String currentBootloader = SystemProperties.get("ro.bootloader");
        final String requiredRadio = SystemProperties.get("ro.build.expect.baseband");
        final String currentRadio = joinListOrElse(
                TelephonyProperties.baseband_version(), "");

        if (TextUtils.isEmpty(system)) {
            Slog.e(TAG, "Required ro.system.build.fingerprint is empty!");
            Slog.e(TAG, "Vendor interface is incompatible, error=" + result);
           return false;
        }

        if (!TextUtils.isEmpty(vendor)) {
            if (!Objects.equals(system, vendor)) {
                Slog.e(TAG, "Mismatched fingerprints; system reported " + system
                        + " but vendor reported " + vendor);
                return false;
            }
        }

        /* TODO: Figure out issue with checks failing
        if (!TextUtils.isEmpty(bootimage)) {
            if (!Objects.equals(system, bootimage)) {
                Slog.e(TAG, "Mismatched fingerprints; system reported " + system
                        + " but bootimage reported " + bootimage);
                return false;
            }
        }

        if (!TextUtils.isEmpty(requiredBootloader)) {
            if (!Objects.equals(currentBootloader, requiredBootloader)) {
                Slog.e(TAG, "Mismatched bootloader version: build requires " + requiredBootloader
                        + " but runtime reports " + currentBootloader);
                return false;
            }
        }

        if (!TextUtils.isEmpty(requiredRadio)) {
            if (!Objects.equals(currentRadio, requiredRadio)) {
                Slog.e(TAG, "Mismatched radio version: build requires " + requiredRadio
                        + " but runtime reports " + currentRadio);
                return false;
            }
        }
        */

        return true;
    }