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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14211761

Change-Id: I296b1d98f4268773f712c4b7167cd291d4731c94
This commit is contained in:
Nikita Ioffe
2021-04-19 11:57:58 +00:00
committed by Automerger Merge Worker

View File

@@ -766,12 +766,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());
}
}