Merge "Calculate apk size multiple times"

This commit is contained in:
Jiakai Zhang
2023-01-04 16:04:14 +00:00
committed by Gerrit Code Review

View File

@@ -572,11 +572,14 @@ public final class BackgroundDexOptService {
size += getDirectorySize(path); size += getDirectorySize(path);
if (!ArrayUtils.isEmpty(info.applicationInfo.splitSourceDirs)) { if (!ArrayUtils.isEmpty(info.applicationInfo.splitSourceDirs)) {
for (String splitSourceDir : info.applicationInfo.splitSourceDirs) { for (String splitSourceDir : info.applicationInfo.splitSourceDirs) {
path = Paths.get(splitSourceDir).toFile(); File pathSplitSourceDir = Paths.get(splitSourceDir).toFile();
if (path.isFile()) { if (pathSplitSourceDir.isFile()) {
path = path.getParentFile(); pathSplitSourceDir = pathSplitSourceDir.getParentFile();
} }
size += getDirectorySize(path); if (path.getAbsolutePath().equals(pathSplitSourceDir.getAbsolutePath())) {
continue;
}
size += getDirectorySize(pathSplitSourceDir);
} }
} }
return size; return size;