Refine getPackageInfo for Apex match policy
The legacy match policy could confuse, for example, the naming of MATCH_APEX do not named with "ONLY|FACTORY|ACTIVE", it's make sense to joint both active and factory apexes. Policy refined: 1. MATCH_FACTORY_ONLY : Return *factory* [eg. the version on the system image] APK packages only 2. MATCH_APEX : Return *active* APK or APEX packages 3. MATCH_FACTORY_ONLY | MATCH_APEX : Return *factory* APK or APEX packages 4. NONE (0) : Return *active* APK packages only Fixes: 142365486 Bug: 142115351 Test: adb shell pm path $APEX_PKG_NAME Test: adb shell pm path $APK_PKG_NAME Test: adb shell pm list packages --apex-only Test: atest ApexManagerTest Test: atest CtsStagedInstallHostTestCases Change-Id: Ifa01278201dd23672dfc1a30f67b888df9bc1bfd
This commit is contained in:
@@ -335,8 +335,8 @@ abstract class ApexManager {
|
||||
if (!packageInfo.packageName.equals(packageName)) {
|
||||
continue;
|
||||
}
|
||||
if ((!matchActive || isActive(packageInfo))
|
||||
&& (!matchFactory || isFactory(packageInfo))) {
|
||||
if ((matchActive && isActive(packageInfo))
|
||||
|| (matchFactory && isFactory(packageInfo))) {
|
||||
return packageInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4207,7 +4207,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
return generatePackageInfo(ps, flags, userId);
|
||||
}
|
||||
if (!matchFactoryOnly && (flags & MATCH_APEX) != 0) {
|
||||
if ((flags & MATCH_APEX) != 0) {
|
||||
return mApexManager.getPackageInfo(packageName, ApexManager.MATCH_ACTIVE_PACKAGE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user