Merge "Replace incomplete path-based check with statx"
This commit is contained in:
@@ -40,8 +40,6 @@ import android.content.pm.SigningDetails.SignatureSchemeVersion;
|
|||||||
import android.content.pm.parsing.ApkLiteParseUtils;
|
import android.content.pm.parsing.ApkLiteParseUtils;
|
||||||
import android.content.pm.parsing.result.ParseResult;
|
import android.content.pm.parsing.result.ParseResult;
|
||||||
import android.content.pm.parsing.result.ParseTypeImpl;
|
import android.content.pm.parsing.result.ParseTypeImpl;
|
||||||
import android.os.Environment;
|
|
||||||
import android.os.FileUtils;
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
@@ -638,18 +636,9 @@ public class ApkChecksums {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean containsFile(File dir, String filePath) {
|
|
||||||
if (dir == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return FileUtils.contains(dir.getAbsolutePath(), filePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ApkChecksum extractHashFromFS(String split, String filePath) {
|
private static ApkChecksum extractHashFromFS(String split, String filePath) {
|
||||||
// verity first
|
// verity first
|
||||||
// Skip /product folder.
|
if (VerityUtils.hasFsverity(filePath)) {
|
||||||
// TODO(b/231354111): remove this hack once we are allowed to change SELinux rules.
|
|
||||||
if (!containsFile(Environment.getProductDirectory(), filePath)) {
|
|
||||||
byte[] verityHash = VerityUtils.getFsverityDigest(filePath);
|
byte[] verityHash = VerityUtils.getFsverityDigest(filePath);
|
||||||
if (verityHash != null) {
|
if (verityHash != null) {
|
||||||
return new ApkChecksum(split, TYPE_WHOLE_MERKLE_ROOT_4K_SHA256, verityHash);
|
return new ApkChecksum(split, TYPE_WHOLE_MERKLE_ROOT_4K_SHA256, verityHash);
|
||||||
|
|||||||
Reference in New Issue
Block a user