Fix the scanning on non-APEX devices.

On devices not supporting APEX the preInstalledApexPath is always equals
to "/system" with no trailing slash.

Test: atest ApkInApexTests; made non-APEX device boot
Merged-In: I238e88684f48981c44e7152f97b4ca16bed6d166
Change-Id: I238e88684f48981c44e7152f97b4ca16bed6d166
This commit is contained in:
Dario Freni
2021-11-11 22:09:41 +00:00
parent d76da0b633
commit c87a89846b

View File

@@ -21917,8 +21917,10 @@ public class PackageManagerService extends IPackageManager.Stub
ApexManager.ActiveApexInfo apexInfo) {
for (int i = 0, size = SYSTEM_PARTITIONS.size(); i < size; i++) {
ScanPartition sp = SYSTEM_PARTITIONS.get(i);
if (apexInfo.preInstalledApexPath.getAbsolutePath().startsWith(
sp.getFolder().getAbsolutePath() + File.separator)) {
if (apexInfo.preInstalledApexPath.getAbsolutePath().equals(
sp.getFolder().getAbsolutePath())
|| apexInfo.preInstalledApexPath.getAbsolutePath().startsWith(
sp.getFolder().getAbsolutePath() + File.separator)) {
return new ScanPartition(apexInfo.apexDirectory, sp, SCAN_AS_APK_IN_APEX);
}
}