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)
throws PackageParserException {
PackageParser pp = new PackageParser();
File apexFile = new File(apexInfo.packagePath);
File apexFile = new File(apexInfo.modulePath);
final Package p = pp.parsePackage(apexFile, flags, false);
PackageUserState state = new PackageUserState();
PackageInfo pi = generatePackageInfo(p, EmptyArray.INT, flags, 0, 0,

View File

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

View File

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

View File

@@ -170,7 +170,7 @@ public class StagingManager {
PackageManager.GET_META_DATA);
} catch (PackageParserException e) {
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,
ApexManager.MATCH_ACTIVE_PACKAGE);