Prevent apk-in-apex from being registered under wrong apex
Without this fix, an apk-in-apex located in path /apex/com.android.mediaprovider will be added as apk-in-apex for com.android.media too, just because they have the same prefix. Added a info log too to make it easier to understand which apk-in-apex is being registered under which apex. Bug: 170640411 Test: Manual testing Change-Id: Idc989ac84777589b4bdd72012833cdbdab7e872c
This commit is contained in:
@@ -777,12 +777,15 @@ public abstract class ApexManager {
|
|||||||
void registerApkInApex(AndroidPackage pkg) {
|
void registerApkInApex(AndroidPackage pkg) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
for (ActiveApexInfo aai : mActiveApexInfosCache) {
|
for (ActiveApexInfo aai : mActiveApexInfosCache) {
|
||||||
if (pkg.getBaseApkPath().startsWith(aai.apexDirectory.getAbsolutePath())) {
|
if (pkg.getBaseApkPath().startsWith(
|
||||||
|
aai.apexDirectory.getAbsolutePath() + File.separator)) {
|
||||||
List<String> apks = mApksInApex.get(aai.apexModuleName);
|
List<String> apks = mApksInApex.get(aai.apexModuleName);
|
||||||
if (apks == null) {
|
if (apks == null) {
|
||||||
apks = Lists.newArrayList();
|
apks = Lists.newArrayList();
|
||||||
mApksInApex.put(aai.apexModuleName, apks);
|
mApksInApex.put(aai.apexModuleName, apks);
|
||||||
}
|
}
|
||||||
|
Slog.i(TAG, "Registering " + pkg.getPackageName() + " as apk-in-apex of "
|
||||||
|
+ aai.apexModuleName);
|
||||||
apks.add(pkg.getPackageName());
|
apks.add(pkg.getPackageName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user