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

Commit bfaca30a authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Replace incomplete path-based check with statx" am: 0791285a am: 7d47c82b am: 0edf2cdb

parents e5c72cf3 0edf2cdb
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -40,8 +40,6 @@ import android.content.pm.SigningDetails.SignatureSchemeVersion;
import android.content.pm.parsing.ApkLiteParseUtils;
import android.content.pm.parsing.result.ParseResult;
import android.content.pm.parsing.result.ParseTypeImpl;
import android.os.Environment;
import android.os.FileUtils;
import android.os.Handler;
import android.os.RemoteException;
import android.os.SystemClock;
@@ -637,18 +635,9 @@ public class ApkChecksums {
        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) {
        // verity first
        // Skip /product folder.
        // TODO(b/231354111): remove this hack once we are allowed to change SELinux rules.
        if (!containsFile(Environment.getProductDirectory(), filePath)) {
        if (VerityUtils.hasFsverity(filePath)) {
            byte[] verityHash = VerityUtils.getFsverityDigest(filePath);
            if (verityHash != null) {
                return new ApkChecksum(split, TYPE_WHOLE_MERKLE_ROOT_4K_SHA256, verityHash);