Move fs-verity check into DexMetadataHelper
Bug: 180414192
Test: CtsDexMetadataHostTestCases (with pm.dexopt.dm.require_fsverity
true/false)
Change-Id: I91924fc92afd53bf7a276fa9ee62a7ce82d4e6b1
This commit is contained in:
@@ -29,6 +29,7 @@ import android.util.Log;
|
||||
import android.util.jar.StrictJarFile;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.security.VerityUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -76,7 +77,8 @@ public class DexMetadataHelper {
|
||||
* Returns whether fs-verity is required to install a dex metadata
|
||||
*/
|
||||
public static boolean isFsVerityRequired() {
|
||||
return SystemProperties.getBoolean(PROPERTY_DM_FSVERITY_REQUIRED, false);
|
||||
return VerityUtils.isFsVeritySupported()
|
||||
&& SystemProperties.getBoolean(PROPERTY_DM_FSVERITY_REQUIRED, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3060,7 +3060,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
// Also stage .dm.fsv_sig. .dm may be required to install with fs-verity signature on
|
||||
// supported on older devices.
|
||||
maybeStageFsveritySignatureLocked(dexMetadataFile, targetDexMetadataFile,
|
||||
VerityUtils.isFsVeritySupported() && DexMetadataHelper.isFsVerityRequired());
|
||||
DexMetadataHelper.isFsVerityRequired());
|
||||
}
|
||||
|
||||
private void storeBytesToInstallationFile(final String localPath, final String absolutePath,
|
||||
|
||||
Reference in New Issue
Block a user