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

Commit 946e06d7 authored by Victor Hsieh's avatar Victor Hsieh
Browse files

Enforce fs-verity support for first_api_level >= R

This matches the approved CDD requirement.

Test: build
Bug: 133451372
Change-Id: I4c0defe08c988ac3c07c6a8352f754d222bd3a5d
parent e98ae477
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -577,7 +577,9 @@ public class PackageManagerServiceUtils {

    /** Returns true if standard APK Verity is enabled. */
    static boolean isApkVerityEnabled() {
        return SystemProperties.getInt("ro.apk_verity.mode", FSVERITY_DISABLED) == FSVERITY_ENABLED;
        return Build.VERSION.FIRST_SDK_INT >= Build.VERSION_CODES.R
                || SystemProperties.getInt("ro.apk_verity.mode", FSVERITY_DISABLED)
                        == FSVERITY_ENABLED;
    }

    static boolean isLegacyApkVerityEnabled() {
+3 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.IBinder;
import android.os.Process;
import android.os.SystemProperties;
@@ -55,7 +56,8 @@ public class FileIntegrityService extends SystemService {
    private final IBinder mService = new IFileIntegrityService.Stub() {
        @Override
        public boolean isApkVeritySupported() {
            return SystemProperties.getInt("ro.apk_verity.mode", 0) == 2;
            return Build.VERSION.FIRST_SDK_INT >= Build.VERSION_CODES.R
                    || SystemProperties.getInt("ro.apk_verity.mode", 0) == 2;
        }

        @Override