ApexManager: Allow duplicating VNDK APEX package names
Don't throw when the duplicating APEX names are VNDK. Explicitly allow duplicating builtin packages if they are VNDK APEX. For example, aosp_bonito has its VNDK APEX installed in the vendor partition and GSI installed its VNDK APEX in system partition. When booting with GSI as the system image, there would be two APEXes with the same name "com.android.vndk.v30", and only one is activated by apexd: - (inactive) /vendor/apex/com.android.vndk.current.on_vendor.apex - (active) /system/apex/com.android.vndk.current.apex Bug: 160611268 Test: Flash aosp_bonito / vendor.img + aosp_arm64 / system.img and boot to home screen Test: atest CtsStagedInstallHostTestCases Test: atest FrameworksServicesTests:PackageParserTest Test: atest FrameworksServicesTests:ApexManagerTest Test: adb shell dumpsys package Test: | com.android.vndk.current.apex is active Test: | com.android.vndk.current.on_vendor.apex is inactive Change-Id: I9f01ba075f26d22aa5101dc3da69d53c5a8b6202
This commit is contained in:
@@ -77,6 +77,8 @@ public abstract class ApexManager {
|
||||
public static final int MATCH_ACTIVE_PACKAGE = 1 << 0;
|
||||
static final int MATCH_FACTORY_PACKAGE = 1 << 1;
|
||||
|
||||
private static final String VNDK_APEX_MODULE_NAME_PREFIX = "com.android.vndk.";
|
||||
|
||||
private static final Singleton<ApexManager> sApexManagerSingleton =
|
||||
new Singleton<ApexManager>() {
|
||||
@Override
|
||||
@@ -521,7 +523,9 @@ public abstract class ApexManager {
|
||||
activePackagesSet.add(packageInfo.packageName);
|
||||
}
|
||||
if (ai.isFactory) {
|
||||
if (factoryPackagesSet.contains(packageInfo.packageName)) {
|
||||
// Don't throw when the duplicating APEX is VNDK APEX
|
||||
if (factoryPackagesSet.contains(packageInfo.packageName)
|
||||
&& !ai.moduleName.startsWith(VNDK_APEX_MODULE_NAME_PREFIX)) {
|
||||
throw new IllegalStateException(
|
||||
"Two factory packages have the same name: "
|
||||
+ packageInfo.packageName);
|
||||
|
||||
Reference in New Issue
Block a user