diff options
| author | 2019-07-04 08:48:49 -0700 | |
|---|---|---|
| committer | 2019-07-04 08:48:49 -0700 | |
| commit | 0ad641f9f65a4dede9ea5ed6f698ed12929fd775 (patch) | |
| tree | 4bd73509944d58a3712ddda9b7f652d7d370f1b9 | |
| parent | bee24f79f709d539dc348cba75f263cd612b6683 (diff) | |
| parent | 6a36ad8b7ec503872681b52c3e33ba0b0ccfe9c3 (diff) | |
Merge "Rename ApexInfo.package{Name,Path} to module{Name,Path}" into stage-aosp-master
am: 6a36ad8b7e
Change-Id: Idabee06e646addd278b0f47224da9a6401a81036
4 files changed, 23 insertions, 23 deletions
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index d5d835fd5739..643cb3e2b059 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -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, diff --git a/core/tests/coretests/src/android/content/pm/PackageParserTest.java b/core/tests/coretests/src/android/content/pm/PackageParserTest.java index 71d9a46eaa24..58c43ac2cf91 100644 --- a/core/tests/coretests/src/android/content/pm/PackageParserTest.java +++ b/core/tests/coretests/src/android/content/pm/PackageParserTest.java @@ -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); diff --git a/services/core/java/com/android/server/pm/ApexManager.java b/services/core/java/com/android/server/pm/ApexManager.java index df189235704a..c050be98b417 100644 --- a/services/core/java/com/android/server/pm/ApexManager.java +++ b/services/core/java/com/android/server/pm/ApexManager.java @@ -130,7 +130,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 { @@ -144,9 +144,9 @@ class ApexManager { "Two active packages have the same name: " + pkg.packageName); } - activePackagesSet.add(ai.packageName); + activePackagesSet.add(pkg.packageName); // TODO(b/132324953): remove. - mApexNameToPackageInfoCache.put(ai.packageName, pkg); + mApexNameToPackageInfoCache.put(ai.moduleName, pkg); } if (ai.isFactory) { if (factoryPackagesSet.contains(pkg.packageName)) { @@ -154,7 +154,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); diff --git a/services/core/java/com/android/server/pm/StagingManager.java b/services/core/java/com/android/server/pm/StagingManager.java index 9c87c748f867..88d681f973c4 100644 --- a/services/core/java/com/android/server/pm/StagingManager.java +++ b/services/core/java/com/android/server/pm/StagingManager.java @@ -104,7 +104,7 @@ public class StagingManager { return new ParceledListSlice<>(result); } - private boolean validateApexSignature(String apexPath, String packageName) { + private boolean validateApexSignature(String apexPath, String apexModuleName) { final SigningDetails signingDetails; try { signingDetails = ApkSignatureVerifier.verify(apexPath, SignatureSchemeVersion.JAR); @@ -113,11 +113,11 @@ public class StagingManager { return false; } - final PackageInfo packageInfo = mApexManager.getPackageInfoForApexName(packageName); + final PackageInfo packageInfo = mApexManager.getPackageInfoForApexName(apexModuleName); if (packageInfo == null) { // Don't allow installation of new APEX. - Slog.e(TAG, "Attempted to install a new apex " + packageName + ". Rejecting"); + Slog.e(TAG, "Attempted to install a new apex " + apexModuleName + ". Rejecting"); return false; } @@ -154,9 +154,9 @@ public class StagingManager { "APEX staging failed, check logcat messages from apexd for more details."); return false; } - for (ApexInfo newPackage : apexInfoList.apexInfos) { + for (ApexInfo newModule : apexInfoList.apexInfos) { PackageInfo activePackage = mApexManager.getPackageInfoForApexName( - newPackage.packageName); + newModule.moduleName); if (activePackage == null) { continue; } @@ -166,7 +166,7 @@ public class StagingManager { if (activeVersion != session.params.requiredInstalledVersionCode) { session.setStagedSessionFailed( SessionInfo.STAGED_SESSION_VERIFICATION_FAILED, - "Installed version of APEX package " + newPackage.packageName + "Installed version of APEX package " + activePackage.packageName + " does not match required. Active version: " + activeVersion + " required: " + session.params.requiredInstalledVersionCode); @@ -179,12 +179,12 @@ public class StagingManager { boolean allowsDowngrade = PackageManagerServiceUtils.isDowngradePermitted( session.params.installFlags, activePackage.applicationInfo.flags); - if (activeVersion > newPackage.versionCode && !allowsDowngrade) { + if (activeVersion > newModule.versionCode && !allowsDowngrade) { session.setStagedSessionFailed( SessionInfo.STAGED_SESSION_VERIFICATION_FAILED, - "Downgrade of APEX package " + newPackage.packageName + "Downgrade of APEX package " + activePackage.packageName + " is not allowed. Active version: " + activeVersion - + " attempted: " + newPackage.versionCode); + + " attempted: " + newModule.versionCode); if (!mApexManager.abortActiveSession()) { Slog.e(TAG, "Failed to abort apex session " + session.sessionId); @@ -242,13 +242,13 @@ public class StagingManager { // so we fail the session early if there is a signature mismatch. For APKs, the // signature verification will be done by the package manager at the point at which // it applies the staged install. - for (ApexInfo apexPackage : apexInfoList.apexInfos) { - if (!validateApexSignature(apexPackage.packagePath, - apexPackage.packageName)) { + for (ApexInfo apexModule : apexInfoList.apexInfos) { + if (!validateApexSignature(apexModule.modulePath, + apexModule.moduleName)) { session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED, "APK-container signature verification failed for package " - + apexPackage.packageName + ". Signature of file " - + apexPackage.packagePath + " does not match the signature of " + + apexModule.moduleName + ". Signature of file " + + apexModule.modulePath + " does not match the signature of " + " the package already installed."); // TODO(b/118865310): abort the session on apexd. return; |