Calculate apk size multiple times

The getPackageSize function in the BackgroundDexOptService class will repeatedly calculate the package size

When calculating the size of the obtained directory, it is necessary to determine whether it has been calculated.

bug:263869388

Change-Id: I0efbc885cfba37b984c53c8ec274335631e1fdc1
Signed-off-by: wu di <fredericrystal@gmail.com>
This commit is contained in:
wu di
2022-12-30 14:58:49 +08:00
parent d469322a84
commit 15c7ec9851

View File

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