Merge "Prevent apk-in-apex from being registered under wrong apex" into rvc-qpr-dev

This commit is contained in:
Nikita Ioffe
2021-04-19 11:40:07 +00:00
committed by Android (Google) Code Review

View File

@@ -757,12 +757,15 @@ public abstract class ApexManager {
void registerApkInApex(AndroidPackage pkg) {
synchronized (mLock) {
for (ActiveApexInfo aai : mActiveApexInfosCache) {
if (pkg.getBaseCodePath().startsWith(aai.apexDirectory.getAbsolutePath())) {
if (pkg.getBaseCodePath().startsWith(
aai.apexDirectory.getAbsolutePath() + File.separator)) {
List<String> apks = mApksInApex.get(aai.apexModuleName);
if (apks == null) {
apks = Lists.newArrayList();
mApksInApex.put(aai.apexModuleName, apks);
}
Slog.i(TAG, "Registering " + pkg.getPackageName() + " as apk-in-apex of "
+ aai.apexModuleName);
apks.add(pkg.getPackageName());
}
}