Rename ApexInfo.package{Name,Path} to module{Name,Path}

This should resolve the confusion between internal name of APEXes that
comes from apex_manifest.json and packageName that comes from
AndroidManifest.xml.

Follow-up CLs:
* Rename package to module for all apexservice binder APIs.
* Rename package to module in apexd codebase.

Test: atest apexservice_test
Test: atest CtsStagedInstallHostTestCases
Bug: 132428457
Change-Id: If0bd3d368c7373ab0028211a8a4246a9821893af
This commit is contained in:
Nikita Ioffe
2019-06-28 15:46:04 +01:00
parent 4377d5637f
commit ec67395d7d
4 changed files with 9 additions and 9 deletions

View File

@@ -8391,7 +8391,7 @@ public class PackageParser {
public static PackageInfo generatePackageInfoFromApex(ApexInfo apexInfo, int flags) public static PackageInfo generatePackageInfoFromApex(ApexInfo apexInfo, int flags)
throws PackageParserException { throws PackageParserException {
PackageParser pp = new PackageParser(); PackageParser pp = new PackageParser();
File apexFile = new File(apexInfo.packagePath); File apexFile = new File(apexInfo.modulePath);
final Package p = pp.parsePackage(apexFile, flags, false); final Package p = pp.parsePackage(apexFile, flags, false);
PackageUserState state = new PackageUserState(); PackageUserState state = new PackageUserState();
PackageInfo pi = generatePackageInfo(p, EmptyArray.INT, flags, 0, 0, PackageInfo pi = generatePackageInfo(p, EmptyArray.INT, flags, 0, 0,

View File

@@ -498,14 +498,14 @@ public class PackageParserTest {
@Test @Test
public void testApexPackageInfoGeneration() throws Exception { public void testApexPackageInfoGeneration() throws Exception {
String apexPackageName = "com.android.tzdata.apex"; String apexModuleName = "com.android.tzdata.apex";
File apexFile = copyRawResourceToFile(apexPackageName, File apexFile = copyRawResourceToFile(apexModuleName,
R.raw.com_android_tzdata); R.raw.com_android_tzdata);
ApexInfo apexInfo = new ApexInfo(); ApexInfo apexInfo = new ApexInfo();
apexInfo.isActive = true; apexInfo.isActive = true;
apexInfo.isFactory = false; apexInfo.isFactory = false;
apexInfo.packageName = apexPackageName; apexInfo.moduleName = apexModuleName;
apexInfo.packagePath = apexFile.getPath(); apexInfo.modulePath = apexFile.getPath();
apexInfo.versionCode = 191000070; apexInfo.versionCode = 191000070;
int flags = PackageManager.GET_META_DATA | PackageManager.GET_SIGNING_CERTIFICATES; int flags = PackageManager.GET_META_DATA | PackageManager.GET_SIGNING_CERTIFICATES;
PackageInfo pi = PackageParser.generatePackageInfoFromApex(apexInfo, flags); PackageInfo pi = PackageParser.generatePackageInfoFromApex(apexInfo, flags);

View File

@@ -117,7 +117,7 @@ class ApexManager {
for (ApexInfo ai : allPkgs) { for (ApexInfo ai : allPkgs) {
// If the device is using flattened APEX, don't report any APEX // If the device is using flattened APEX, don't report any APEX
// packages since they won't be managed or updated by PackageManager. // packages since they won't be managed or updated by PackageManager.
if ((new File(ai.packagePath)).isDirectory()) { if ((new File(ai.modulePath)).isDirectory()) {
break; break;
} }
try { try {
@@ -131,7 +131,7 @@ class ApexManager {
"Two active packages have the same name: " "Two active packages have the same name: "
+ pkg.packageName); + pkg.packageName);
} }
activePackagesSet.add(ai.packageName); activePackagesSet.add(pkg.packageName);
} }
if (ai.isFactory) { if (ai.isFactory) {
if (factoryPackagesSet.contains(pkg.packageName)) { if (factoryPackagesSet.contains(pkg.packageName)) {
@@ -139,7 +139,7 @@ class ApexManager {
"Two factory packages have the same name: " "Two factory packages have the same name: "
+ pkg.packageName); + pkg.packageName);
} }
factoryPackagesSet.add(ai.packageName); factoryPackagesSet.add(pkg.packageName);
} }
} catch (PackageParserException pe) { } catch (PackageParserException pe) {
throw new IllegalStateException("Unable to parse: " + ai, pe); throw new IllegalStateException("Unable to parse: " + ai, pe);

View File

@@ -170,7 +170,7 @@ public class StagingManager {
PackageManager.GET_META_DATA); PackageManager.GET_META_DATA);
} catch (PackageParserException e) { } catch (PackageParserException e) {
throw new PackageManagerException(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED, throw new PackageManagerException(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
"Failed to parse APEX package " + newPackage.packagePath, e); "Failed to parse APEX package " + newPackage.modulePath, e);
} }
final PackageInfo activePackage = mApexManager.getPackageInfo(pkg.packageName, final PackageInfo activePackage = mApexManager.getPackageInfo(pkg.packageName,
ApexManager.MATCH_ACTIVE_PACKAGE); ApexManager.MATCH_ACTIVE_PACKAGE);