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

Commit e9a8efa9 authored by Yifan Hong's avatar Yifan Hong Committed by Gerrit Code Review
Browse files

Merge changes If24cdca9,Ifcc8412e into main

* changes:
  vintf: Disable kernel compat check at boot time.
  vintf: delete deprecated VintfObject.verify.
parents de8baa8a 052b036b
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -1315,9 +1315,7 @@ public class Build {
        if (IS_ENG) return true;

        if (IS_TREBLE_ENABLED) {
            // If we can run this code, the device should already pass AVB.
            // So, we don't need to check AVB here.
            int result = VintfObject.verifyWithoutAvb();
            int result = VintfObject.verifyBuildAtBoot();

            if (result != 0) {
                Slog.e(TAG, "Vendor interface is incompatible, error="
+3 −40
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package android.os;

import android.annotation.NonNull;
import android.annotation.TestApi;
import android.util.Slog;

import java.util.Map;

@@ -44,44 +43,8 @@ public class VintfObject {
    public static native String[] report();

    /**
     * Verify that the given metadata for an OTA package is compatible with
     * this device.
     *
     * @param packageInfo a list of serialized form of HalManifest's /
     * CompatibilityMatri'ces (XML).
     * @return = 0 if success (compatible)
     *         > 0 if incompatible
     *         < 0 if any error (mount partition fails, illformed XML, etc.)
     *
     * @deprecated Checking compatibility against an OTA package is no longer
     * supported because the format of VINTF metadata in the OTA package may not
     * be recognized by the current system.
     *
     * <p>
     * <ul>
     * <li>This function always returns 0 for non-empty {@code packageInfo}.
     * </li>
     * <li>This function returns the result of {@link #verifyWithoutAvb} for
     * null or empty {@code packageInfo}.</li>
     * </ul>
     *
     * @hide
     */
    @Deprecated
    public static int verify(String[] packageInfo) {
        if (packageInfo != null && packageInfo.length > 0) {
            Slog.w(LOG_TAG, "VintfObject.verify() with non-empty packageInfo is deprecated. "
                    + "Skipping compatibility checks for update package.");
            return 0;
        }
        Slog.w(LOG_TAG, "VintfObject.verify() is deprecated. Call verifyWithoutAvb() instead.");
        return verifyWithoutAvb();
    }

    /**
     * Verify Vintf compatibility on the device without checking AVB
     * (Android Verified Boot). It is useful to verify a running system
     * image where AVB check is irrelevant.
     * Verify Vintf compatibility on the device at boot time. Certain checks
     * like kernel checks, AVB checks are disabled.
     *
     * @return = 0 if success (compatible)
     *         > 0 if incompatible
@@ -89,7 +52,7 @@ public class VintfObject {
     *
     * @hide
     */
    public static native int verifyWithoutAvb();
    public static native int verifyBuildAtBoot();

    /**
     * @return a list of HAL names and versions that is supported by this
+7 −5
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ using vintf::toXml;
using vintf::Version;
using vintf::VintfObject;
using vintf::Vndk;
using vintf::CheckFlags::ENABLE_ALL_CHECKS;

template<typename V>
static inline jobjectArray toJavaStringArray(JNIEnv* env, const V& v) {
@@ -93,12 +94,13 @@ static jobjectArray android_os_VintfObject_report(JNIEnv* env, jclass)
    return toJavaStringArray(env, cStrings);
}

static jint android_os_VintfObject_verifyWithoutAvb(JNIEnv* env, jclass) {
static jint android_os_VintfObject_verifyBuildAtBoot(JNIEnv* env, jclass) {
    std::string error;
    int32_t status = VintfObject::GetInstance()->checkCompatibility(&error,
            ::android::vintf::CheckFlags::DISABLE_AVB_CHECK);
    int32_t status =
            VintfObject::GetInstance()
                    ->checkCompatibility(&error, ENABLE_ALL_CHECKS.disableAvb().disableKernel());
    if (status)
        LOG(WARNING) << "VintfObject.verifyWithoutAvb() returns " << status << ": " << error;
        LOG(WARNING) << "VintfObject.verifyBuildAtBoot() returns " << status << ": " << error;
    return status;
}

@@ -170,7 +172,7 @@ static jobject android_os_VintfObject_getTargetFrameworkCompatibilityMatrixVersi

static const JNINativeMethod gVintfObjectMethods[] = {
        {"report", "()[Ljava/lang/String;", (void*)android_os_VintfObject_report},
        {"verifyWithoutAvb", "()I", (void*)android_os_VintfObject_verifyWithoutAvb},
        {"verifyBuildAtBoot", "()I", (void*)android_os_VintfObject_verifyBuildAtBoot},
        {"getHalNamesAndVersions", "()[Ljava/lang/String;",
         (void*)android_os_VintfObject_getHalNamesAndVersions},
        {"getSepolicyVersion", "()Ljava/lang/String;",