diff --git a/apct-tests/perftests/core/src/android/os/PackageParsingPerfTest.kt b/apct-tests/perftests/core/src/android/os/PackageParsingPerfTest.kt index 29721c5936468..9e519f7afb939 100644 --- a/apct-tests/perftests/core/src/android/os/PackageParsingPerfTest.kt +++ b/apct-tests/perftests/core/src/android/os/PackageParsingPerfTest.kt @@ -184,11 +184,11 @@ class PackageParsingPerfTest { override fun startParsingPackage( packageName: String, - baseCodePath: String, - codePath: String, + baseApkPath: String, + path: String, manifestArray: TypedArray, isCoreApp: Boolean - ) = ParsingPackageImpl(packageName, baseCodePath, codePath, manifestArray) + ) = ParsingPackageImpl(packageName, baseApkPath, path, manifestArray) }) override fun parseImpl(file: File) = diff --git a/core/java/android/content/pm/parsing/PackageInfoWithoutStateUtils.java b/core/java/android/content/pm/parsing/PackageInfoWithoutStateUtils.java index e4507483c08f9..e573539221153 100644 --- a/core/java/android/content/pm/parsing/PackageInfoWithoutStateUtils.java +++ b/core/java/android/content/pm/parsing/PackageInfoWithoutStateUtils.java @@ -579,8 +579,8 @@ public class PackageInfoWithoutStateUtils { ii.handleProfiling = i.isHandleProfiling(); ii.functionalTest = i.isFunctionalTest(); - ii.sourceDir = pkg.getBaseCodePath(); - ii.publicSourceDir = pkg.getBaseCodePath(); + ii.sourceDir = pkg.getBaseApkPath(); + ii.publicSourceDir = pkg.getBaseApkPath(); ii.splitNames = pkg.getSplitNames(); ii.splitSourceDirs = pkg.getSplitCodePaths(); ii.splitPublicSourceDirs = pkg.getSplitCodePaths(); diff --git a/core/java/android/content/pm/parsing/ParsingPackageImpl.java b/core/java/android/content/pm/parsing/ParsingPackageImpl.java index f9679c7a8d538..ed12a17ad493b 100644 --- a/core/java/android/content/pm/parsing/ParsingPackageImpl.java +++ b/core/java/android/content/pm/parsing/ParsingPackageImpl.java @@ -145,7 +145,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable { private String realPackage; @NonNull - protected String baseCodePath; + protected String mBaseApkPath; private boolean requiredForAllUsers; @Nullable @@ -280,7 +280,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable { @NonNull @DataClass.ParcelWith(ForInternedString.class) - protected String codePath; + protected String mPath; private boolean use32BitAbi; private boolean visibleToInstantApps; @@ -429,11 +429,11 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable { private ArraySet mimeGroups; @VisibleForTesting - public ParsingPackageImpl(@NonNull String packageName, @NonNull String baseCodePath, - @NonNull String codePath, @Nullable TypedArray manifestArray) { + public ParsingPackageImpl(@NonNull String packageName, @NonNull String baseApkPath, + @NonNull String path, @Nullable TypedArray manifestArray) { this.packageName = TextUtils.safeIntern(packageName); - this.baseCodePath = baseCodePath; - this.codePath = codePath; + this.mBaseApkPath = baseApkPath; + this.mPath = path; if (manifestArray != null) { versionCode = manifestArray.getInteger(R.styleable.AndroidManifest_versionCode, 0); @@ -961,10 +961,10 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable { appInfo.volumeUuid = volumeUuid; appInfo.zygotePreloadName = zygotePreloadName; appInfo.setGwpAsanMode(gwpAsanMode); - appInfo.setBaseCodePath(baseCodePath); - appInfo.setBaseResourcePath(baseCodePath); - appInfo.setCodePath(codePath); - appInfo.setResourcePath(codePath); + appInfo.setBaseCodePath(mBaseApkPath); + appInfo.setBaseResourcePath(mBaseApkPath); + appInfo.setCodePath(mPath); + appInfo.setResourcePath(mPath); appInfo.setSplitCodePaths(splitCodePaths); appInfo.setSplitResourcePaths(splitCodePaths); appInfo.setVersionCode(PackageInfo.composeLongVersionCode(versionCodeMajor, versionCode)); @@ -993,7 +993,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable { dest.writeString(this.compileSdkVersionCodeName); sForInternedString.parcel(this.packageName, dest, flags); dest.writeString(this.realPackage); - dest.writeString(this.baseCodePath); + dest.writeString(this.mBaseApkPath); dest.writeBoolean(this.requiredForAllUsers); dest.writeString(this.restrictedAccountType); dest.writeString(this.requiredAccountType); @@ -1048,7 +1048,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable { dest.writeBundle(this.metaData); sForInternedString.parcel(this.volumeUuid, dest, flags); dest.writeParcelable(this.signingDetails, flags); - dest.writeString(this.codePath); + dest.writeString(this.mPath); dest.writeBoolean(this.use32BitAbi); dest.writeBoolean(this.visibleToInstantApps); dest.writeBoolean(this.forceQueryable); @@ -1157,7 +1157,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable { this.compileSdkVersionCodeName = in.readString(); this.packageName = sForInternedString.unparcel(in); this.realPackage = in.readString(); - this.baseCodePath = in.readString(); + this.mBaseApkPath = in.readString(); this.requiredForAllUsers = in.readBoolean(); this.restrictedAccountType = in.readString(); this.requiredAccountType = in.readString(); @@ -1212,7 +1212,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable { this.metaData = in.readBundle(boot); this.volumeUuid = sForInternedString.unparcel(in); this.signingDetails = in.readParcelable(boot); - this.codePath = in.readString(); + this.mPath = in.readString(); this.use32BitAbi = in.readBoolean(); this.visibleToInstantApps = in.readBoolean(); this.forceQueryable = in.readBoolean(); @@ -1361,8 +1361,8 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable { @NonNull @Override - public String getBaseCodePath() { - return baseCodePath; + public String getBaseApkPath() { + return mBaseApkPath; } @Override @@ -1647,8 +1647,8 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable { @NonNull @Override - public String getCodePath() { - return codePath; + public String getPath() { + return mPath; } @Override diff --git a/core/java/android/content/pm/parsing/ParsingPackageRead.java b/core/java/android/content/pm/parsing/ParsingPackageRead.java index 7e0fe7dc41bfd..dbd15f544bcd3 100644 --- a/core/java/android/content/pm/parsing/ParsingPackageRead.java +++ b/core/java/android/content/pm/parsing/ParsingPackageRead.java @@ -548,7 +548,7 @@ public interface ParsingPackageRead extends Parcelable { String getPackageName(); /** Path of base APK */ - String getBaseCodePath(); + String getBaseApkPath(); /** * Path where this package was found on disk. For monolithic packages @@ -556,7 +556,7 @@ public interface ParsingPackageRead extends Parcelable { * path to the cluster directory. */ @NonNull - String getCodePath(); + String getPath(); /** * @see ApplicationInfo#compatibleWidthLimitDp diff --git a/core/java/android/content/pm/parsing/ParsingPackageUtils.java b/core/java/android/content/pm/parsing/ParsingPackageUtils.java index 741e80cae4fcf..bce75cde20c2f 100644 --- a/core/java/android/content/pm/parsing/ParsingPackageUtils.java +++ b/core/java/android/content/pm/parsing/ParsingPackageUtils.java @@ -162,10 +162,10 @@ public class ParsingPackageUtils { @Override public ParsingPackage startParsingPackage( @NonNull String packageName, - @NonNull String baseCodePath, - @NonNull String codePath, + @NonNull String baseApkPath, + @NonNull String path, @NonNull TypedArray manifestArray, boolean isCoreApp) { - return new ParsingPackageImpl(packageName, baseCodePath, codePath, manifestArray); + return new ParsingPackageImpl(packageName, baseApkPath, path, manifestArray); } }); try { @@ -1213,9 +1213,9 @@ public class ParsingPackageUtils { features = ArrayUtils.add(features, featureInfo); } else { Slog.w(TAG, - "Unknown element under : " + innerTagName + - " at " + pkg.getBaseCodePath() + " " + - parser.getPositionDescription()); + "Unknown element under : " + innerTagName + + " at " + pkg.getBaseApkPath() + " " + + parser.getPositionDescription()); } } @@ -2419,7 +2419,7 @@ public class ParsingPackageUtils { R.styleable.AndroidManifestResourceOverlay_requiredSystemPropertyValue); if (!PackageParser.checkRequiredSystemProperties(propName, propValue)) { String message = "Skipping target and overlay pair " + target + " and " - + pkg.getBaseCodePath() + + pkg.getBaseApkPath() + ": overlay ignored due to required system property: " + propName + " with value: " + propValue; Slog.i(TAG, message); @@ -2674,7 +2674,7 @@ public class ParsingPackageUtils { " only supports string, integer, float, color, " + "boolean, and resource reference types: " + parser.getName() + " at " - + pkg.getBaseCodePath() + " " + + pkg.getBaseApkPath() + " " + parser.getPositionDescription()); } else { return input.error(" only supports string, integer, float, " @@ -2711,7 +2711,7 @@ public class ParsingPackageUtils { try { ParseResult result = getSigningDetails( input, - pkg.getBaseCodePath(), + pkg.getBaseApkPath(), skipVerify, pkg.isStaticSharedLibrary(), signingDetails, @@ -2857,7 +2857,7 @@ public class ParsingPackageUtils { boolean hasFeature(String feature); ParsingPackage startParsingPackage(@NonNull String packageName, - @NonNull String baseCodePath, @NonNull String codePath, + @NonNull String baseApkPath, @NonNull String path, @NonNull TypedArray manifestArray, boolean isCoreApp); } } diff --git a/core/java/android/content/pm/parsing/ParsingUtils.java b/core/java/android/content/pm/parsing/ParsingUtils.java index 17cd101d60fc3..5da5fbf4d8a7b 100644 --- a/core/java/android/content/pm/parsing/ParsingUtils.java +++ b/core/java/android/content/pm/parsing/ParsingUtils.java @@ -61,7 +61,7 @@ public class ParsingUtils { return input.error("Bad element under " + parentTag + ": " + parser.getName()); } Slog.w(TAG, "Unknown element under " + parentTag + ": " - + parser.getName() + " at " + pkg.getBaseCodePath() + " " + + parser.getName() + " at " + pkg.getBaseApkPath() + " " + parser.getPositionDescription()); XmlUtils.skipCurrentTag(parser); return input.success(null); // Type doesn't matter diff --git a/core/java/android/content/pm/parsing/component/ParsedMainComponentUtils.java b/core/java/android/content/pm/parsing/component/ParsedMainComponentUtils.java index fac5cd3b12b8a..f70d62b56d496 100644 --- a/core/java/android/content/pm/parsing/component/ParsedMainComponentUtils.java +++ b/core/java/android/content/pm/parsing/component/ParsedMainComponentUtils.java @@ -113,7 +113,7 @@ class ParsedMainComponentUtils { ParsedIntentInfo intent = intentResult.getResult(); int actionCount = intent.countActions(); if (actionCount == 0 && failOnNoActions) { - Slog.w(TAG, "No actions in " + parser.getName() + " at " + pkg.getBaseCodePath() + " " + Slog.w(TAG, "No actions in " + parser.getName() + " at " + pkg.getBaseApkPath() + " " + parser.getPositionDescription()); // Backward-compat, do not actually fail return input.success(null); diff --git a/core/java/android/content/pm/parsing/component/ParsedProviderUtils.java b/core/java/android/content/pm/parsing/component/ParsedProviderUtils.java index d8137208a835d..37cbeca1d23a6 100644 --- a/core/java/android/content/pm/parsing/component/ParsedProviderUtils.java +++ b/core/java/android/content/pm/parsing/component/ParsedProviderUtils.java @@ -246,7 +246,7 @@ public class ParsedProviderUtils { } Slog.w(TAG, "Unknown element under : " + name + " at " - + pkg.getBaseCodePath() + " " + parser.getPositionDescription()); + + pkg.getBaseApkPath() + " " + parser.getPositionDescription()); } return input.success(provider); @@ -292,7 +292,8 @@ public class ParsedProviderUtils { "No readPermission or writePermission for "); } Slog.w(TAG, "No readPermission or writePermission for : " - + name + " at " + pkg.getBaseCodePath() + " " + parser.getPositionDescription()); + + name + " at " + pkg.getBaseApkPath() + " " + + parser.getPositionDescription()); return input.success(provider); } @@ -341,7 +342,7 @@ public class ParsedProviderUtils { } Slog.w(TAG, "No path, pathPrefix, or pathPattern for : " - + name + " at " + pkg.getBaseCodePath() + + name + " at " + pkg.getBaseApkPath() + " " + parser.getPositionDescription()); } diff --git a/core/java/com/android/internal/content/om/OverlayConfig.java b/core/java/com/android/internal/content/om/OverlayConfig.java index 3b5cf487c8da3..b38f623e3a6de 100644 --- a/core/java/com/android/internal/content/om/OverlayConfig.java +++ b/core/java/com/android/internal/content/om/OverlayConfig.java @@ -296,7 +296,7 @@ public class OverlayConfig { if (p.getOverlayTarget() != null && isSystem) { overlays.add(new ParsedOverlayInfo(p.getPackageName(), p.getOverlayTarget(), p.getTargetSdkVersion(), p.isOverlayIsStatic(), p.getOverlayPriority(), - new File(p.getBaseCodePath()))); + new File(p.getBaseApkPath()))); } }); return overlays; diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java index 04906788f4cb9..88faa0a49c9cd 100644 --- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java +++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java @@ -574,16 +574,16 @@ public class PackageManagerTests extends AndroidTestCase { InstallParams(String outFileName, int rawResId) throws PackageParserException { this.pkg = getParsedPackage(outFileName, rawResId); - this.packageURI = Uri.fromFile(new File(pkg.getCodePath())); + this.packageURI = Uri.fromFile(new File(pkg.getPath())); } InstallParams(ParsingPackage pkg) { - this.packageURI = Uri.fromFile(new File(pkg.getCodePath())); + this.packageURI = Uri.fromFile(new File(pkg.getPath())); this.pkg = pkg; } long getApkSize() { - File file = new File(pkg.getCodePath()); + File file = new File(pkg.getPath()); return file.length(); } } @@ -1003,7 +1003,7 @@ public class PackageManagerTests extends AndroidTestCase { try { cleanUpInstall(ip.pkg.getPackageName()); } finally { - File outFile = new File(ip.pkg.getCodePath()); + File outFile = new File(ip.pkg.getPath()); if (outFile != null && outFile.exists()) { outFile.delete(); } diff --git a/core/tests/coretests/src/com/android/internal/content/OverlayConfigIterationRule.java b/core/tests/coretests/src/com/android/internal/content/OverlayConfigIterationRule.java index fbf75dfb4979a..a01459f20f6b3 100644 --- a/core/tests/coretests/src/com/android/internal/content/OverlayConfigIterationRule.java +++ b/core/tests/coretests/src/com/android/internal/content/OverlayConfigIterationRule.java @@ -146,7 +146,7 @@ public class OverlayConfigIterationRule implements TestRule { when(a.getTargetSdkVersion()).thenReturn(info.targetSdkVersion); when(a.isOverlayIsStatic()).thenReturn(info.isStatic); when(a.getOverlayPriority()).thenReturn(info.priority); - when(a.getBaseCodePath()).thenReturn(info.path.getPath()); + when(a.getBaseApkPath()).thenReturn(info.path.getPath()); f.accept(a, !info.path.getPath().contains("data/overlay")); } return null; diff --git a/services/core/java/com/android/server/pm/ApexManager.java b/services/core/java/com/android/server/pm/ApexManager.java index 07527c2a15d8e..5b5ec42210936 100644 --- a/services/core/java/com/android/server/pm/ApexManager.java +++ b/services/core/java/com/android/server/pm/ApexManager.java @@ -778,7 +778,7 @@ public abstract class ApexManager { void registerApkInApex(AndroidPackage pkg) { synchronized (mLock) { for (ActiveApexInfo aai : mActiveApexInfosCache) { - if (pkg.getBaseCodePath().startsWith(aai.apexDirectory.getAbsolutePath())) { + if (pkg.getBaseApkPath().startsWith(aai.apexDirectory.getAbsolutePath())) { List apks = mApksInApex.get(aai.apexModuleName); if (apks == null) { apks = Lists.newArrayList(); diff --git a/services/core/java/com/android/server/pm/OtaDexoptService.java b/services/core/java/com/android/server/pm/OtaDexoptService.java index eddab76de5ee7..7db2319b51649 100644 --- a/services/core/java/com/android/server/pm/OtaDexoptService.java +++ b/services/core/java/com/android/server/pm/OtaDexoptService.java @@ -384,17 +384,17 @@ public class OtaDexoptService extends IOtaDexopt.Stub { if (!PackageDexOptimizer.canOptimizePackage(pkg)) { continue; } - if (pkg.getCodePath() == null) { + if (pkg.getPath() == null) { Slog.w(TAG, "Package " + pkg + " can be optimized but has null codePath"); continue; } // If the path is in /system, /vendor, /product or /system_ext, ignore. It will // have been ota-dexopted into /data/ota and moved into the dalvik-cache already. - if (pkg.getCodePath().startsWith("/system") - || pkg.getCodePath().startsWith("/vendor") - || pkg.getCodePath().startsWith("/product") - || pkg.getCodePath().startsWith("/system_ext")) { + if (pkg.getPath().startsWith("/system") + || pkg.getPath().startsWith("/vendor") + || pkg.getPath().startsWith("/product") + || pkg.getPath().startsWith("/system_ext")) { continue; } @@ -408,7 +408,7 @@ public class OtaDexoptService extends IOtaDexopt.Stub { for (String dexCodeInstructionSet : dexCodeInstructionSets) { for (String path : paths) { String oatDir = PackageDexOptimizer.getOatDir( - new File(pkg.getCodePath())).getAbsolutePath(); + new File(pkg.getPath())).getAbsolutePath(); // TODO: Check first whether there is an artifact, to save the roundtrip time. diff --git a/services/core/java/com/android/server/pm/PackageAbiHelperImpl.java b/services/core/java/com/android/server/pm/PackageAbiHelperImpl.java index 8af7e1f4f6d1e..da4ea16d0bfd9 100644 --- a/services/core/java/com/android/server/pm/PackageAbiHelperImpl.java +++ b/services/core/java/com/android/server/pm/PackageAbiHelperImpl.java @@ -136,7 +136,7 @@ final class PackageAbiHelperImpl implements PackageAbiHelper { // Trying to derive the paths, thus need the raw ABI info from the parsed package, and the // current state in PackageSetting is irrelevant. return deriveNativeLibraryPaths(new Abis(pkg.getPrimaryCpuAbi(), pkg.getSecondaryCpuAbi()), - appLib32InstallDir, pkg.getCodePath(), pkg.getBaseCodePath(), pkg.isSystem(), + appLib32InstallDir, pkg.getPath(), pkg.getBaseApkPath(), pkg.isSystem(), isUpdatedSystemApp); } @@ -205,11 +205,11 @@ final class PackageAbiHelperImpl implements PackageAbiHelper { @Override public Abis getBundledAppAbis(AndroidPackage pkg) { - final String apkName = deriveCodePathName(pkg.getCodePath()); + final String apkName = deriveCodePathName(pkg.getPath()); // If "/system/lib64/apkname" exists, assume that is the per-package // native library directory to use; otherwise use "/system/lib/apkname". - final String apkRoot = calculateBundledApkRoot(pkg.getBaseCodePath()); + final String apkRoot = calculateBundledApkRoot(pkg.getBaseApkPath()); final Abis abis = getBundledAppAbi(pkg, apkRoot, apkName); return abis; } @@ -223,7 +223,7 @@ final class PackageAbiHelperImpl implements PackageAbiHelper { * @param apkName the name of the installed package. */ private Abis getBundledAppAbi(AndroidPackage pkg, String apkRoot, String apkName) { - final File codeFile = new File(pkg.getCodePath()); + final File codeFile = new File(pkg.getPath()); final boolean has64BitLibs; final boolean has32BitLibs; @@ -304,15 +304,15 @@ final class PackageAbiHelperImpl implements PackageAbiHelper { String pkgRawSecondaryCpuAbi = AndroidPackageUtils.getRawSecondaryCpuAbi(pkg); final NativeLibraryPaths initialLibraryPaths = deriveNativeLibraryPaths( new Abis(pkgRawPrimaryCpuAbi, pkgRawSecondaryCpuAbi), - PackageManagerService.sAppLib32InstallDir, pkg.getCodePath(), - pkg.getBaseCodePath(), pkg.isSystem(), + PackageManagerService.sAppLib32InstallDir, pkg.getPath(), + pkg.getBaseApkPath(), pkg.isSystem(), isUpdatedSystemApp); final boolean extractLibs = shouldExtractLibs(pkg, isUpdatedSystemApp); final String nativeLibraryRootStr = initialLibraryPaths.nativeLibraryRootDir; final boolean useIsaSpecificSubdirs = initialLibraryPaths.nativeLibraryRootRequiresIsa; - final boolean onIncremental = isIncrementalPath(pkg.getCodePath()); + final boolean onIncremental = isIncrementalPath(pkg.getPath()); String primaryCpuAbi = null; String secondaryCpuAbi = null; @@ -453,7 +453,7 @@ final class PackageAbiHelperImpl implements PackageAbiHelper { final Abis abis = new Abis(primaryCpuAbi, secondaryCpuAbi); return new Pair<>(abis, deriveNativeLibraryPaths(abis, PackageManagerService.sAppLib32InstallDir, - pkg.getCodePath(), pkg.getBaseCodePath(), pkg.isSystem(), + pkg.getPath(), pkg.getBaseApkPath(), pkg.isSystem(), isUpdatedSystemApp)); } diff --git a/services/core/java/com/android/server/pm/PackageDexOptimizer.java b/services/core/java/com/android/server/pm/PackageDexOptimizer.java index 0d8ba3e548014..42e6d8f0bf830 100644 --- a/services/core/java/com/android/server/pm/PackageDexOptimizer.java +++ b/services/core/java/com/android/server/pm/PackageDexOptimizer.java @@ -199,7 +199,7 @@ public class PackageDexOptimizer { throw new IllegalStateException("Inconsistent information " + "between PackageParser.Package and its ApplicationInfo. " + "pkg.getAllCodePaths=" + paths - + " pkg.getBaseCodePath=" + pkg.getBaseCodePath() + + " pkg.getBaseCodePath=" + pkg.getBaseApkPath() + " pkg.getSplitCodePaths=" + (splitCodePaths == null ? "null" : Arrays.toString(splitCodePaths))); } @@ -772,7 +772,7 @@ public class PackageDexOptimizer { if (!AndroidPackageUtils.canHaveOatDir(pkg, isUpdatedSystemApp)) { return null; } - File codePath = new File(pkg.getCodePath()); + File codePath = new File(pkg.getPath()); if (!codePath.isDirectory()) { return null; } diff --git a/services/core/java/com/android/server/pm/PackageInstallerSession.java b/services/core/java/com/android/server/pm/PackageInstallerSession.java index ca125320bbf2a..17cd8f58c3a39 100644 --- a/services/core/java/com/android/server/pm/PackageInstallerSession.java +++ b/services/core/java/com/android/server/pm/PackageInstallerSession.java @@ -2083,7 +2083,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { if (ps == null) { return 0; } - final File apkDirOrPath = ps.getCodePath(); + final File apkDirOrPath = ps.getPath(); if (apkDirOrPath == null) { return 0; } diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 7945d84933345..b219c174a2f63 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -2220,7 +2220,7 @@ public class PackageManagerService extends IPackageManager.Stub // Send installed broadcasts if the package is not a static shared lib. if (res.pkg.getStaticSharedLibName() == null) { mProcessLoggingHandler.invalidateProcessLoggingBaseApkHash( - res.pkg.getBaseCodePath()); + res.pkg.getBaseApkPath()); // Send added for users that see the package for the first time // sendPackageAddedForNewUsers also deals with system apps @@ -3101,7 +3101,7 @@ public class PackageManagerService extends IPackageManager.Stub final int packageSettingCount = mSettings.mPackages.size(); for (int i = packageSettingCount - 1; i >= 0; i--) { PackageSetting ps = mSettings.mPackages.valueAt(i); - if (!isExternal(ps) && (ps.getCodePath() == null || !ps.getCodePath().exists()) + if (!isExternal(ps) && (ps.getPath() == null || !ps.getPath().exists()) && mSettings.getDisabledSystemPkgLPr(ps.name) != null) { mSettings.mPackages.removeAt(i); mSettings.enableSystemPackageLPw(ps.name); @@ -3266,11 +3266,11 @@ public class PackageManagerService extends IPackageManager.Stub logCriticalInfo(Log.WARN, "Expecting better updated system app for " + ps.name + "; removing system app. Last known" - + " codePath=" + ps.getCodePathString() + + " codePath=" + ps.getPathString() + ", versionCode=" + ps.versionCode + "; scanned versionCode=" + scannedPkg.getLongVersionCode()); removePackageLI(scannedPkg, true); - mExpectingBetter.put(ps.name, ps.getCodePath()); + mExpectingBetter.put(ps.name, ps.getPath()); } continue; @@ -3293,14 +3293,14 @@ public class PackageManagerService extends IPackageManager.Stub // code path, but, changes the package name. final PackageSetting disabledPs = mSettings.getDisabledSystemPkgLPr(ps.name); - if (disabledPs.getCodePath() == null || !disabledPs.getCodePath().exists() + if (disabledPs.getPath() == null || !disabledPs.getPath().exists() || disabledPs.pkg == null) { possiblyDeletedUpdatedSystemApps.add(ps.name); } else { // We're expecting that the system app should remain disabled, but add // it to expecting better to recover in case the data version cannot // be scanned. - mExpectingBetter.put(disabledPs.name, disabledPs.getCodePath()); + mExpectingBetter.put(disabledPs.name, disabledPs.getPath()); } } } @@ -3373,7 +3373,7 @@ public class PackageManagerService extends IPackageManager.Stub // special privileges removePackageLI(pkg, true); try { - final File codePath = new File(pkg.getCodePath()); + final File codePath = new File(pkg.getPath()); scanPackageTracedLI(codePath, 0, scanFlags, 0, null); } catch (PackageManagerException e) { Slog.e(TAG, "Failed to parse updated, ex-system package: " @@ -3854,7 +3854,7 @@ public class PackageManagerService extends IPackageManager.Stub // If we don't, installing the system package fails during scan enableSystemPackageLPw(stubPkg); } - installPackageFromSystemLIF(stubPkg.getCodePath(), + installPackageFromSystemLIF(stubPkg.getPath(), mUserManager.getUserIds() /*allUserHandles*/, null /*origUserHandles*/, true /*writeSettings*/); } catch (PackageManagerException pme) { @@ -3878,7 +3878,7 @@ public class PackageManagerService extends IPackageManager.Stub clearAppDataLIF(pkg, UserHandle.USER_ALL, FLAG_STORAGE_DE | FLAG_STORAGE_CE | FLAG_STORAGE_EXTERNAL | Installer.FLAG_CLEAR_CODE_CACHE_ONLY); mDexManager.notifyPackageUpdated(pkg.getPackageName(), - pkg.getBaseCodePath(), pkg.getSplitCodePaths()); + pkg.getBaseApkPath(), pkg.getSplitCodePaths()); } return true; } @@ -3890,10 +3890,10 @@ public class PackageManagerService extends IPackageManager.Stub Slog.i(TAG, "Uncompressing system stub; pkg: " + stubPkg.getPackageName()); } // uncompress the binary to its eventual destination on /data - final File scanFile = decompressPackage(stubPkg.getPackageName(), stubPkg.getCodePath()); + final File scanFile = decompressPackage(stubPkg.getPackageName(), stubPkg.getPath()); if (scanFile == null) { throw new PackageManagerException( - "Unable to decompress stub at " + stubPkg.getCodePath()); + "Unable to decompress stub at " + stubPkg.getPath()); } synchronized (mLock) { mSettings.disableSystemPackageLPw(stubPkg.getPackageName(), true /*replaced*/); @@ -9261,11 +9261,11 @@ public class PackageManagerService extends IPackageManager.Stub // When upgrading from pre-N MR1, verify the package time stamp using the package // directory and not the APK file. final long lastModifiedTime = mIsPreNMR1Upgrade - ? new File(parsedPackage.getCodePath()).lastModified() + ? new File(parsedPackage.getPath()).lastModified() : getLastModifiedTime(parsedPackage); final VersionInfo settingsVersionForPackage = getSettingsVersionForPackage(parsedPackage); if (ps != null && !forceCollect - && ps.getCodePathString().equals(parsedPackage.getCodePath()) + && ps.getPathString().equals(parsedPackage.getPath()) && ps.timeStamp == lastModifiedTime && !isCompatSignatureUpdateNeeded(settingsVersionForPackage) && !isRecoverSignatureUpdateNeeded(settingsVersionForPackage)) { @@ -9283,8 +9283,8 @@ public class PackageManagerService extends IPackageManager.Stub Slog.w(TAG, "PackageSetting for " + ps.name + " is missing signatures. Collecting certs again to recover them."); } else { - Slog.i(TAG, parsedPackage.getCodePath() + " changed; collecting certs" + - (forceCollect ? " (forced)" : "")); + Slog.i(TAG, parsedPackage.getPath() + " changed; collecting certs" + + (forceCollect ? " (forced)" : "")); } try { @@ -9368,7 +9368,7 @@ public class PackageManagerService extends IPackageManager.Stub * Returns if forced apk verification can be skipped for the whole package, including splits. */ private boolean canSkipForcedPackageVerification(AndroidPackage pkg) { - if (!canSkipForcedApkVerification(pkg.getBaseCodePath())) { + if (!canSkipForcedApkVerification(pkg.getBaseApkPath())) { return false; } // TODO: Allow base and splits to be verified individually. @@ -9499,7 +9499,7 @@ public class PackageManagerService extends IPackageManager.Stub } final boolean newPkgChangedPaths = pkgAlreadyExists - && !pkgSetting.getCodePathString().equals(parsedPackage.getCodePath()); + && !pkgSetting.getPathString().equals(parsedPackage.getPath()); final boolean newPkgVersionGreater = pkgAlreadyExists && parsedPackage.getLongVersionCode() > pkgSetting.versionCode; final boolean isSystemPkgBetter = scanSystemPartition && isSystemPkgUpdated @@ -9518,11 +9518,11 @@ public class PackageManagerService extends IPackageManager.Stub "System package updated;" + " name: " + pkgSetting.name + "; " + pkgSetting.versionCode + " --> " + parsedPackage.getLongVersionCode() - + "; " + pkgSetting.getCodePathString() - + " --> " + parsedPackage.getCodePath()); + + "; " + pkgSetting.getPathString() + + " --> " + parsedPackage.getPath()); final InstallArgs args = createInstallArgsForExisting( - pkgSetting.getCodePathString(), getAppDexInstructionSets( + pkgSetting.getPathString(), getAppDexInstructionSets( pkgSetting.primaryCpuAbiString, pkgSetting.secondaryCpuAbiString)); args.cleanUpResourcesLI(); synchronized (mLock) { @@ -9535,7 +9535,7 @@ public class PackageManagerService extends IPackageManager.Stub // equal to the version on the /data partition. Throw an exception and use // the application already installed on the /data partition. throw new PackageManagerException(Log.WARN, "Package " + parsedPackage.getPackageName() - + " at " + parsedPackage.getCodePath() + " ignored: updated version " + + " at " + parsedPackage.getPath() + " ignored: updated version " + pkgSetting.versionCode + " better than this " + parsedPackage.getLongVersionCode()); } @@ -9597,10 +9597,10 @@ public class PackageManagerService extends IPackageManager.Stub + " name: " + pkgSetting.name + "; " + pkgSetting.versionCode + " --> " + parsedPackage.getLongVersionCode() - + "; " + pkgSetting.getCodePathString() + " --> " - + parsedPackage.getCodePath()); + + "; " + pkgSetting.getPathString() + " --> " + + parsedPackage.getPath()); InstallArgs args = createInstallArgsForExisting( - pkgSetting.getCodePathString(), getAppDexInstructionSets( + pkgSetting.getPathString(), getAppDexInstructionSets( pkgSetting.primaryCpuAbiString, pkgSetting.secondaryCpuAbiString)); synchronized (mInstallLock) { args.cleanUpResourcesLI(); @@ -9613,10 +9613,10 @@ public class PackageManagerService extends IPackageManager.Stub logCriticalInfo(Log.INFO, "System package disabled;" + " name: " + pkgSetting.name - + "; old: " + pkgSetting.getCodePathString() + " @ " + + "; old: " + pkgSetting.getPathString() + " @ " + pkgSetting.versionCode - + "; new: " + parsedPackage.getCodePath() + " @ " - + parsedPackage.getCodePath()); + + "; new: " + parsedPackage.getPath() + " @ " + + parsedPackage.getPath()); } } @@ -9797,7 +9797,7 @@ public class PackageManagerService extends IPackageManager.Stub * Return the prebuilt profile path given a package base code path. */ private static String getPrebuildProfilePath(AndroidPackage pkg) { - return pkg.getBaseCodePath() + ".prof"; + return pkg.getBaseApkPath() + ".prof"; } /** @@ -11450,7 +11450,7 @@ public class PackageManagerService extends IPackageManager.Stub if (changedAbiCodePath == null) { changedAbiCodePath = new ArrayList<>(); } - changedAbiCodePath.add(ps.getCodePathString()); + changedAbiCodePath.add(ps.getPathString()); } } } @@ -11545,7 +11545,7 @@ public class PackageManagerService extends IPackageManager.Stub } // Initialize package source and resource directories - final File destCodeFile = new File(parsedPackage.getCodePath()); + final File destCodeFile = new File(parsedPackage.getPath()); // We keep references to the derived CPU Abis from settings in oder to reuse // them in the case where we're not upgrading or booting for the first time. @@ -11883,9 +11883,9 @@ public class PackageManagerService extends IPackageManager.Stub private static void assertCodePolicy(AndroidPackage pkg) throws PackageManagerException { final boolean shouldHaveCode = pkg.isHasCode(); - if (shouldHaveCode && !apkHasCode(pkg.getBaseCodePath())) { + if (shouldHaveCode && !apkHasCode(pkg.getBaseApkPath())) { throw new PackageManagerException(INSTALL_FAILED_INVALID_APK, - "Package " + pkg.getBaseCodePath() + " code is missing"); + "Package " + pkg.getBaseApkPath() + " code is missing"); } if (!ArrayUtils.isEmpty(pkg.getSplitCodePaths())) { @@ -11917,7 +11917,7 @@ public class PackageManagerService extends IPackageManager.Stub if (parsedPackage.isDirectBootAware()) { parsedPackage.setAllComponentsDirectBootAware(true); } - if (compressedFileExists(parsedPackage.getCodePath())) { + if (compressedFileExists(parsedPackage.getPath())) { parsedPackage.setStub(true); } } else { @@ -12008,7 +12008,7 @@ public class PackageManagerService extends IPackageManager.Stub assertCodePolicy(pkg); } - if (pkg.getCodePath() == null) { + if (pkg.getPath() == null) { // Bail out. The resource and code paths haven't been set. throw new PackageManagerException(INSTALL_FAILED_INVALID_APK, "Code and resource paths haven't been set correctly"); @@ -12035,7 +12035,7 @@ public class PackageManagerService extends IPackageManager.Stub if (mAndroidApplication != null) { Slog.w(TAG, "*************************************************"); Slog.w(TAG, "Core android package being redefined. Skipping."); - Slog.w(TAG, " codePath=" + pkg.getCodePath()); + Slog.w(TAG, " codePath=" + pkg.getPath()); Slog.w(TAG, "*************************************************"); throw new PackageManagerException(INSTALL_FAILED_DUPLICATE_PACKAGE, "Core android package being redefined. Skipping."); @@ -12191,14 +12191,14 @@ public class PackageManagerService extends IPackageManager.Stub PackageSetting known = mSettings.getPackageLPr(pkg.getPackageName()); if (known != null) { if (DEBUG_PACKAGE_SCANNING) { - Log.d(TAG, "Examining " + pkg.getCodePath() - + " and requiring known path " + known.getCodePathString()); + Log.d(TAG, "Examining " + pkg.getPath() + + " and requiring known path " + known.getPathString()); } - if (!pkg.getCodePath().equals(known.getCodePathString())) { + if (!pkg.getPath().equals(known.getPathString())) { throw new PackageManagerException(INSTALL_FAILED_PACKAGE_CHANGED, "Application package " + pkg.getPackageName() - + " found at " + pkg.getCodePath() - + " but expected at " + known.getCodePathString() + + " found at " + pkg.getPath() + + " but expected at " + known.getPathString() + "; ignoring."); } } else { @@ -15787,7 +15787,7 @@ public class PackageManagerService extends IPackageManager.Stub abstract boolean doRename(int status, ParsedPackage parsedPackage); abstract int doPostInstall(int status, int uid); - /** @see PackageSettingBase#getCodePath() */ + /** @see PackageSettingBase#getPath() */ abstract String getCodePath(); // Need installer lock especially for dex file removal. @@ -15968,7 +15968,7 @@ public class PackageManagerService extends IPackageManager.Stub return false; } parsedPackage.setBaseCodePath(FileUtils.rewriteAfterRename(beforeCodeFile, - afterCodeFile, parsedPackage.getBaseCodePath())); + afterCodeFile, parsedPackage.getBaseApkPath())); parsedPackage.setSplitCodePaths(FileUtils.rewriteAfterRename(beforeCodeFile, afterCodeFile, parsedPackage.getSplitCodePaths())); @@ -16235,7 +16235,7 @@ public class PackageManagerService extends IPackageManager.Stub InstallSource installSource = installArgs.installSource; final String installerPackageName = installSource.installerPackageName; - if (DEBUG_INSTALL) Slog.d(TAG, "New package installed in " + pkg.getCodePath()); + if (DEBUG_INSTALL) Slog.d(TAG, "New package installed in " + pkg.getPath()); synchronized (mLock) { // NOTE: This changes slightly to include UPDATE_PERMISSIONS_ALL regardless of the size of pkg.permissions mPermissionManager.updatePermissions(pkgName, pkg); @@ -16874,7 +16874,7 @@ public class PackageManagerService extends IPackageManager.Stub // which means we are replacing another update that is already // installed. We need to make sure to delete the older one's .apk. res.removedInfo.args = createInstallArgsForExisting( - oldPackage.getCodePath(), + oldPackage.getPath(), getAppDexInstructionSets( AndroidPackageUtils.getPrimaryCpuAbi(oldPackage, deletedPkgSetting), @@ -16917,7 +16917,7 @@ public class PackageManagerService extends IPackageManager.Stub if (ps1.mOldCodePaths == null) { ps1.mOldCodePaths = new ArraySet<>(); } - Collections.addAll(ps1.mOldCodePaths, oldPackage.getBaseCodePath()); + Collections.addAll(ps1.mOldCodePaths, oldPackage.getBaseApkPath()); if (oldPackage.getSplitCodePaths() != null) { Collections.addAll(ps1.mOldCodePaths, oldPackage.getSplitCodePaths()); } @@ -17082,7 +17082,7 @@ public class PackageManagerService extends IPackageManager.Stub // For incremental installs, we bypass the verifier prior to install. Now // that we know the package is valid, send a notice to the verifier with // the root hash of the base.apk. - final String baseCodePath = request.installResult.pkg.getBaseCodePath(); + final String baseCodePath = request.installResult.pkg.getBaseApkPath(); final String[] splitCodePaths = request.installResult.pkg.getSplitCodePaths(); final Uri originUri = Uri.fromFile(args.origin.resolvedFile); final int verificationId = mPendingVerificationToken++; @@ -17127,9 +17127,9 @@ public class PackageManagerService extends IPackageManager.Stub final AndroidPackage pkg = reconciledPkg.pkgSetting.pkg; final String packageName = pkg.getPackageName(); final boolean onIncremental = mIncrementalManager != null - && isIncrementalPath(pkg.getCodePath()); + && isIncrementalPath(pkg.getPath()); if (onIncremental) { - IncrementalStorage storage = mIncrementalManager.openStorage(pkg.getCodePath()); + IncrementalStorage storage = mIncrementalManager.openStorage(pkg.getPath()); if (storage == null) { throw new IllegalArgumentException( "Install: null storage for incremental package " + packageName); @@ -17143,7 +17143,7 @@ public class PackageManagerService extends IPackageManager.Stub } if (reconciledPkg.prepareResult.replace) { mDexManager.notifyPackageUpdated(pkg.getPackageName(), - pkg.getBaseCodePath(), pkg.getSplitCodePaths()); + pkg.getBaseApkPath(), pkg.getSplitCodePaths()); } // Prepare the application profiles for the new code paths. @@ -17796,7 +17796,7 @@ public class PackageManagerService extends IPackageManager.Stub final byte[] digestBytes; try { final MessageDigest digest = MessageDigest.getInstance("SHA-512"); - updateDigest(digest, new File(parsedPackage.getBaseCodePath())); + updateDigest(digest, new File(parsedPackage.getBaseApkPath())); if (!ArrayUtils.isEmpty(parsedPackage.getSplitCodePaths())) { for (String path : parsedPackage.getSplitCodePaths()) { updateDigest(digest, new File(path)); @@ -17976,7 +17976,7 @@ public class PackageManagerService extends IPackageManager.Stub synchronized (mLock) { final PackageSetting ps = mSettings.mPackages.get(pkg.getPackageName()); if (ps != null && ps.isPrivileged()) { - fsverityCandidates.put(pkg.getBaseCodePath(), null); + fsverityCandidates.put(pkg.getBaseApkPath(), null); if (pkg.getSplitCodePaths() != null) { for (String splitPath : pkg.getSplitCodePaths()) { fsverityCandidates.put(splitPath, null); @@ -17987,11 +17987,11 @@ public class PackageManagerService extends IPackageManager.Stub } else { // NB: These files will become only accessible if the signing key is loaded in kernel's // .fs-verity keyring. - fsverityCandidates.put(pkg.getBaseCodePath(), - VerityUtils.getFsveritySignatureFilePath(pkg.getBaseCodePath())); + fsverityCandidates.put(pkg.getBaseApkPath(), + VerityUtils.getFsveritySignatureFilePath(pkg.getBaseApkPath())); final String dmPath = DexMetadataHelper.buildDexMetadataPathForApk( - pkg.getBaseCodePath()); + pkg.getBaseApkPath()); if (new File(dmPath).exists()) { fsverityCandidates.put(dmPath, VerityUtils.getFsveritySignatureFilePath(dmPath)); } @@ -19102,7 +19102,7 @@ public class PackageManagerService extends IPackageManager.Stub // Install the system package if (DEBUG_REMOVE) Slog.d(TAG, "Re-installing system package: " + disabledPs); try { - installPackageFromSystemLIF(disabledPs.getCodePathString(), allUserHandles, + installPackageFromSystemLIF(disabledPs.getPathString(), allUserHandles, outInfo == null ? null : outInfo.origUsers, writeSettings); } catch (PackageManagerException e) { Slog.w(TAG, "Failed to restore system package:" + deletedPkg.getPackageName() + ": " @@ -19227,7 +19227,7 @@ public class PackageManagerService extends IPackageManager.Stub // Delete application code and resources only for parent packages if (deleteCodeAndResources && (outInfo != null)) { outInfo.args = createInstallArgsForExisting( - ps.getCodePathString(), getAppDexInstructionSets( + ps.getPathString(), getAppDexInstructionSets( ps.primaryCpuAbiString, ps.secondaryCpuAbiString)); if (DEBUG_SD_INSTALL) Slog.i(TAG, "args=" + outInfo.args); } @@ -19769,7 +19769,7 @@ public class PackageManagerService extends IPackageManager.Stub final String[] packageNames = { packageName }; final long[] ceDataInodes = { ps.getCeDataInode(userId) }; - final String[] codePaths = { ps.getCodePathString() }; + final String[] codePaths = { ps.getPathString() }; try { mInstaller.getAppSize(ps.volumeUuid, packageNames, userId, 0, @@ -22696,11 +22696,11 @@ public class PackageManagerService extends IPackageManager.Stub synchronized (mInstallLock) { final AndroidPackage pkg; try { - pkg = scanPackageTracedLI(ps.getCodePath(), parseFlags, SCAN_INITIAL, 0, null); + pkg = scanPackageTracedLI(ps.getPath(), parseFlags, SCAN_INITIAL, 0, null); loaded.add(pkg); } catch (PackageManagerException e) { - Slog.w(TAG, "Failed to scan " + ps.getCodePath() + ": " + e.getMessage()); + Slog.w(TAG, "Failed to scan " + ps.getPath() + ": " + e.getMessage()); } if (!Build.FINGERPRINT.equals(ver.fingerprint)) { @@ -22787,7 +22787,7 @@ public class PackageManagerService extends IPackageManager.Stub false, null)) { unloaded.add(pkg); } else { - Slog.w(TAG, "Failed to unload " + ps.getCodePath()); + Slog.w(TAG, "Failed to unload " + ps.getPath()); } } @@ -22841,7 +22841,7 @@ public class PackageManagerService extends IPackageManager.Stub final int packageCount = mSettings.mPackages.size(); for (int i = 0; i < packageCount; i++) { final PackageSetting ps = mSettings.mPackages.valueAt(i); - codePaths.add(ps.getCodePath().getAbsolutePath()); + codePaths.add(ps.getPath().getAbsolutePath()); } return codePaths; } @@ -23417,7 +23417,7 @@ public class PackageManagerService extends IPackageManager.Stub currentVolumeUuid = ps.volumeUuid; - final File probe = new File(pkg.getCodePath()); + final File probe = new File(pkg.getPath()); final File probeOat = new File(probe, "oat"); if (!probe.isDirectory() || !probeOat.isDirectory()) { throw new PackageManagerException(MOVE_FAILED_INTERNAL_ERROR, @@ -23439,7 +23439,7 @@ public class PackageManagerService extends IPackageManager.Stub } isCurrentLocationExternal = pkg.isExternalStorage(); - codeFile = new File(pkg.getCodePath()); + codeFile = new File(pkg.getPath()); installSource = ps.installSource; packageAbiOverride = ps.cpuAbiOverrideString; appId = UserHandle.getAppId(pkg.getUid()); @@ -24870,7 +24870,7 @@ public class PackageManagerService extends IPackageManager.Stub mApexManager.getApksInApex(apexPackages.get(i).packageName); for (int j = 0, apksInApex = apkNames.size(); j < apksInApex; j++) { final AndroidPackage pkg = getPackage(apkNames.get(j)); - cacher.cleanCachedResult(new File(pkg.getCodePath())); + cacher.cleanCachedResult(new File(pkg.getPath())); } } } @@ -24946,7 +24946,7 @@ public class PackageManagerService extends IPackageManager.Stub Slog.e(TAG, "failed to find package " + packageName); return false; } - overlayPaths.add(pkg.getBaseCodePath()); + overlayPaths.add(pkg.getBaseApkPath()); } } @@ -25662,7 +25662,7 @@ public class PackageManagerService extends IPackageManager.Stub pkgSetting.getPkgState().isUpdatedSystemApp())) { return null; } - File codePath = new File(pkg.getCodePath()); + File codePath = new File(pkg.getPath()); if (codePath.isDirectory()) { return PackageDexOptimizer.getOatDir(codePath).getAbsolutePath(); } diff --git a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java index 5553cd0e2fb84..e5dad85702541 100644 --- a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java +++ b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java @@ -326,11 +326,11 @@ public class PackageManagerServiceUtils { } public static long getLastModifiedTime(AndroidPackage pkg) { - final File srcFile = new File(pkg.getCodePath()); + final File srcFile = new File(pkg.getPath()); if (!srcFile.isDirectory()) { return srcFile.lastModified(); } - final File baseFile = new File(pkg.getBaseCodePath()); + final File baseFile = new File(pkg.getBaseApkPath()); long maxModifiedTime = baseFile.lastModified(); if (pkg.getSplitCodePaths() != null) { for (int i = pkg.getSplitCodePaths().length - 1; i >=0; --i) { diff --git a/services/core/java/com/android/server/pm/PackageSetting.java b/services/core/java/com/android/server/pm/PackageSetting.java index 009c5d78d4c91..4476e8ac8d90b 100644 --- a/services/core/java/com/android/server/pm/PackageSetting.java +++ b/services/core/java/com/android/server/pm/PackageSetting.java @@ -44,8 +44,33 @@ import java.util.Set; public class PackageSetting extends PackageSettingBase { int appId; + /** + * This can be null whenever a physical APK on device is missing. This can be the result of + * removing an external storage device where the APK resides. + * + * This will result in the system reading the {@link PackageSetting} from disk, but without + * being able to parse the base APK's AndroidManifest.xml to read all of its metadata. The data + * that is written and read in {@link Settings} includes a minimal set of metadata needed to + * perform other checks in the system. + * + * This is important in order to enforce uniqueness within the system, as the package, even if + * on a removed storage device, is still considered installed. Another package of the same + * application ID or declaring the same permissions or similar cannot be installed. + * + * Re-attaching the storage device to make the APK available should allow the user to use the + * app once the device reboots or otherwise re-scans it. + * + * It is expected that all code that uses a {@link PackageSetting} understands this inner field + * may be null. Note that this relationship only works one way. It should not be possible to + * have an entry inside {@link PackageManagerService#mPackages} without a corresponding + * {@link PackageSetting} inside {@link Settings#mPackages}. + * + * @deprecated Use {@link #getPkg()}. The setter is favored to avoid unintended mutation. + */ @Nullable + @Deprecated public AndroidPackage pkg; + /** * WARNING. The object reference is important. We perform integer equality and NOT * object equality to check whether shared user settings are the same. @@ -104,6 +129,12 @@ public class PackageSetting extends PackageSettingBase { doCopy(orig); } + /** @see #pkg **/ + @Nullable + public AndroidPackage getPkg() { + return pkg; + } + public int getSharedUserId() { if (sharedUser != null) { return sharedUser.userId; diff --git a/services/core/java/com/android/server/pm/PackageSettingBase.java b/services/core/java/com/android/server/pm/PackageSettingBase.java index 6010344b8c65d..a7bbf8d66aac0 100644 --- a/services/core/java/com/android/server/pm/PackageSettingBase.java +++ b/services/core/java/com/android/server/pm/PackageSettingBase.java @@ -40,6 +40,7 @@ import android.util.SparseArray; import android.util.proto.ProtoOutputStream; import com.android.internal.annotations.VisibleForTesting; +import com.android.server.pm.parsing.pkg.AndroidPackage; import java.io.File; import java.util.Arrays; @@ -59,13 +60,9 @@ public abstract class PackageSettingBase extends SettingBase { public final String name; final String realName; - /** - * Path where this package was found on disk. For monolithic packages - * this is path to single base APK file; for cluster packages this is - * path to the cluster directory. - */ - private File mCodePath; - private String mCodePathString; + /** @see AndroidPackage#getPath() */ + private File mPath; + private String mPathString; String[] usesStaticLibraries; long[] usesStaticLibrariesVersions; @@ -136,7 +133,7 @@ public abstract class PackageSettingBase extends SettingBase { boolean forceQueryableOverride; - PackageSettingBase(String name, String realName, @NonNull File codePath, + PackageSettingBase(String name, String realName, @NonNull File path, String legacyNativeLibraryPathString, String primaryCpuAbiString, String secondaryCpuAbiString, String cpuAbiOverrideString, long pVersionCode, int pkgFlags, int pkgPrivateFlags, @@ -146,7 +143,7 @@ public abstract class PackageSettingBase extends SettingBase { this.realName = realName; this.usesStaticLibraries = usesStaticLibraries; this.usesStaticLibrariesVersions = usesStaticLibrariesVersions; - setCodePath(codePath); + setPath(path); this.legacyNativeLibraryPathString = legacyNativeLibraryPathString; this.primaryCpuAbiString = primaryCpuAbiString; this.secondaryCpuAbiString = secondaryCpuAbiString; @@ -230,7 +227,7 @@ public abstract class PackageSettingBase extends SettingBase { } private void doCopy(PackageSettingBase orig) { - setCodePath(orig.getCodePath()); + setPath(orig.getPath()); cpuAbiOverrideString = orig.cpuAbiOverrideString; firstInstallTime = orig.firstInstallTime; installPermissionsFixed = orig.installPermissionsFixed; @@ -697,18 +694,23 @@ public abstract class PackageSettingBase extends SettingBase { return userState.harmfulAppWarning; } - PackageSettingBase setCodePath(@NonNull File codePath) { - this.mCodePath = codePath; - this.mCodePathString = codePath.toString(); + /** + * @see #mPath + */ + PackageSettingBase setPath(@NonNull File path) { + this.mPath = path; + this.mPathString = path.toString(); return this; } - File getCodePath() { - return mCodePath; + /** @see #mPath */ + File getPath() { + return mPath; } - String getCodePathString() { - return mCodePathString; + /** @see #mPath */ + String getPathString() { + return mPathString; } /** @@ -733,7 +735,7 @@ public abstract class PackageSettingBase extends SettingBase { protected PackageSettingBase updateFrom(PackageSettingBase other) { super.copyFrom(other); - setCodePath(other.getCodePath()); + setPath(other.getPath()); this.usesStaticLibraries = other.usesStaticLibraries; this.usesStaticLibrariesVersions = other.usesStaticLibrariesVersions; this.legacyNativeLibraryPathString = other.legacyNativeLibraryPathString; diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java index 5a8dd9763e2a4..6246f324de46f 100644 --- a/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java @@ -538,7 +538,7 @@ public final class Settings { return null; } p.getPkgState().setUpdatedSystemApp(false); - PackageSetting ret = addPackageLPw(name, p.realName, p.getCodePath(), + PackageSetting ret = addPackageLPw(name, p.realName, p.getPath(), p.legacyNativeLibraryPathString, p.primaryCpuAbiString, p.secondaryCpuAbiString, p.cpuAbiOverrideString, p.appId, p.versionCode, p.pkgFlags, p.pkgPrivateFlags, @@ -645,7 +645,7 @@ public final class Settings { if (PackageManagerService.DEBUG_UPGRADE) Log.v(PackageManagerService.TAG, "Package " + pkgName + " is adopting original package " + originalPkg.name); pkgSetting = new PackageSetting(originalPkg, pkgName /*realPkgName*/); - pkgSetting.setCodePath(codePath); + pkgSetting.setPath(codePath); pkgSetting.legacyNativeLibraryPathString = legacyNativeLibraryPath; pkgSetting.pkgFlags = pkgFlags; pkgSetting.pkgPrivateFlags = pkgPrivateFlags; @@ -770,12 +770,12 @@ public final class Settings { "Updating application package " + pkgName + " failed"); } - if (!pkgSetting.getCodePath().equals(codePath)) { + if (!pkgSetting.getPath().equals(codePath)) { final boolean isSystem = pkgSetting.isSystem(); Slog.i(PackageManagerService.TAG, "Update" + (isSystem ? " system" : "") + " package " + pkgName - + " code path from " + pkgSetting.getCodePathString() + + " code path from " + pkgSetting.getPathString() + " to " + codePath.toString() + "; Retain data and using new"); if (!isSystem) { @@ -797,7 +797,7 @@ public final class Settings { // internal to external storage or vice versa. pkgSetting.legacyNativeLibraryPathString = legacyNativeLibraryPath; } - pkgSetting.setCodePath(codePath); + pkgSetting.setPath(codePath); } // If what we are scanning is a system (and possibly privileged) package, // then make it so, regardless of whether it was previously installed only @@ -2710,7 +2710,7 @@ public final class Settings { if (pkg.realName != null) { serializer.attribute(null, "realName", pkg.realName); } - serializer.attribute(null, "codePath", pkg.getCodePathString()); + serializer.attribute(null, "codePath", pkg.getPathString()); serializer.attribute(null, "ft", Long.toHexString(pkg.timeStamp)); serializer.attribute(null, "it", Long.toHexString(pkg.firstInstallTime)); serializer.attribute(null, "ut", Long.toHexString(pkg.lastUpdateTime)); @@ -2752,7 +2752,7 @@ public final class Settings { if (pkg.realName != null) { serializer.attribute(null, "realName", pkg.realName); } - serializer.attribute(null, "codePath", pkg.getCodePathString()); + serializer.attribute(null, "codePath", pkg.getPathString()); if (pkg.legacyNativeLibraryPathString != null) { serializer.attribute(null, "nativeLibraryPath", pkg.legacyNativeLibraryPathString); @@ -4561,9 +4561,9 @@ public final class Settings { pw.print(prefix); pw.print(" sharedUser="); pw.println(ps.sharedUser); } pw.print(prefix); pw.print(" pkg="); pw.println(pkg); - pw.print(prefix); pw.print(" codePath="); pw.println(ps.getCodePathString()); + pw.print(prefix); pw.print(" codePath="); pw.println(ps.getPathString()); if (permissionNames == null) { - pw.print(prefix); pw.print(" resourcePath="); pw.println(ps.getCodePathString()); + pw.print(prefix); pw.print(" resourcePath="); pw.println(ps.getPathString()); pw.print(prefix); pw.print(" legacyNativeLibraryDir="); pw.println(ps.legacyNativeLibraryPathString); pw.print(prefix); pw.print(" extractNativeLibs="); diff --git a/services/core/java/com/android/server/pm/dex/ArtManagerService.java b/services/core/java/com/android/server/pm/dex/ArtManagerService.java index 8000c639139f9..587cb825fbb0d 100644 --- a/services/core/java/com/android/server/pm/dex/ArtManagerService.java +++ b/services/core/java/com/android/server/pm/dex/ArtManagerService.java @@ -486,7 +486,7 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub { public boolean compileLayouts(AndroidPackage pkg) { try { final String packageName = pkg.getPackageName(); - final String apkPath = pkg.getBaseCodePath(); + final String apkPath = pkg.getBaseApkPath(); // TODO(b/143971007): Use a cross-user directory File dataDir = PackageInfoWithoutStateUtils.getDataDir(pkg, UserHandle.myUserId()); final String outDexFile = dataDir.getAbsolutePath() + "/code_cache/compiled_view.dex"; @@ -524,7 +524,7 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub { private ArrayMap getPackageProfileNames(AndroidPackage pkg) { ArrayMap result = new ArrayMap<>(); if (pkg.isHasCode()) { - result.put(pkg.getBaseCodePath(), ArtManager.getProfileName(null)); + result.put(pkg.getBaseApkPath(), ArtManager.getProfileName(null)); } String[] splitCodePaths = pkg.getSplitCodePaths(); diff --git a/services/core/java/com/android/server/pm/dex/DexoptUtils.java b/services/core/java/com/android/server/pm/dex/DexoptUtils.java index 6807388fa2b2d..fa0183642f94b 100644 --- a/services/core/java/com/android/server/pm/dex/DexoptUtils.java +++ b/services/core/java/com/android/server/pm/dex/DexoptUtils.java @@ -18,12 +18,12 @@ package com.android.server.pm.dex; import android.content.pm.ApplicationInfo; import android.content.pm.SharedLibraryInfo; -import com.android.server.pm.parsing.pkg.AndroidPackage; import android.util.Slog; import android.util.SparseArray; import com.android.internal.os.ClassLoaderFactory; import com.android.internal.util.ArrayUtils; +import com.android.server.pm.parsing.pkg.AndroidPackage; import java.io.File; import java.util.List; @@ -90,7 +90,7 @@ public final class DexoptUtils { // The splits have an implicit dependency on the base apk. // This means that we have to add the base apk file in addition to the shared libraries. - String baseApkName = new File(pkg.getBaseCodePath()).getName(); + String baseApkName = new File(pkg.getBaseApkPath()).getName(); String baseClassPath = baseApkName; // The result is stored in classLoaderContexts. @@ -401,7 +401,7 @@ public final class DexoptUtils { * Assumes that the application declares a non-null array of splits. */ private static String[] getSplitRelativeCodePaths(AndroidPackage pkg) { - String baseCodePath = new File(pkg.getBaseCodePath()).getParent(); + String baseCodePath = new File(pkg.getBaseApkPath()).getParent(); String[] splitCodePaths = pkg.getSplitCodePaths(); String[] splitRelativeCodePaths = new String[ArrayUtils.size(splitCodePaths)]; for (int i = 0; i < splitRelativeCodePaths.length; i++) { diff --git a/services/core/java/com/android/server/pm/dex/ViewCompiler.java b/services/core/java/com/android/server/pm/dex/ViewCompiler.java index 5506a523cd60d..a5672664f6fd1 100644 --- a/services/core/java/com/android/server/pm/dex/ViewCompiler.java +++ b/services/core/java/com/android/server/pm/dex/ViewCompiler.java @@ -40,7 +40,7 @@ public class ViewCompiler { public boolean compileLayouts(AndroidPackage pkg) { try { final String packageName = pkg.getPackageName(); - final String apkPath = pkg.getBaseCodePath(); + final String apkPath = pkg.getBaseApkPath(); // TODO(b/143971007): Use a cross-user directory File dataDir = PackageInfoWithoutStateUtils.getDataDir(pkg, UserHandle.myUserId()); final String outDexFile = dataDir.getAbsolutePath() + "/code_cache/compiled_view.dex"; diff --git a/services/core/java/com/android/server/pm/parsing/pkg/AndroidPackage.java b/services/core/java/com/android/server/pm/parsing/pkg/AndroidPackage.java index 39784cf32cea8..a13680ad32afa 100644 --- a/services/core/java/com/android/server/pm/parsing/pkg/AndroidPackage.java +++ b/services/core/java/com/android/server/pm/parsing/pkg/AndroidPackage.java @@ -23,7 +23,6 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageParser; import android.content.pm.PermissionGroupInfo; -import android.content.pm.SharedLibraryInfo; import android.content.pm.parsing.ParsingPackageRead; import android.content.pm.parsing.component.ParsedAttribution; import android.content.pm.parsing.component.ParsedIntentInfo; @@ -65,18 +64,16 @@ public interface AndroidPackage extends PkgAppInfo, PkgPackageInfo, ParsingPacka /** Path of base APK */ @NonNull - String getBaseCodePath(); + String getBaseApkPath(); /** Revision code of base APK */ int getBaseRevisionCode(); /** - * Path where this package was found on disk. For monolithic packages - * this is path to single base APK file; for cluster packages this is - * path to the cluster directory. + * The path to the folder containing the base APK and any installed splits. */ @NonNull - String getCodePath(); + String getPath(); /** * Permissions requested but not in the manifest. These may have been split or migrated from diff --git a/services/core/java/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java b/services/core/java/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java index a6f02e7842d38..0a56e13434189 100644 --- a/services/core/java/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java +++ b/services/core/java/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java @@ -58,7 +58,7 @@ public class AndroidPackageUtils { PackageImpl pkg = (PackageImpl) aPkg; ArrayList paths = new ArrayList<>(); if (pkg.isHasCode()) { - paths.add(pkg.getBaseCodePath()); + paths.add(pkg.getBaseApkPath()); } String[] splitCodePaths = pkg.getSplitCodePaths(); if (!ArrayUtils.isEmpty(splitCodePaths)) { @@ -77,7 +77,7 @@ public class AndroidPackageUtils { public static List getAllCodePaths(AndroidPackage aPkg) { PackageImpl pkg = (PackageImpl) aPkg; ArrayList paths = new ArrayList<>(); - paths.add(pkg.getBaseCodePath()); + paths.add(pkg.getBaseApkPath()); String[] splitCodePaths = pkg.getSplitCodePaths(); if (!ArrayUtils.isEmpty(splitCodePaths)) { @@ -147,7 +147,7 @@ public class AndroidPackageUtils { if (pkg.isSystem() && !isUpdatedSystemApp) { return false; } - if (IncrementalManager.isIncrementalPath(pkg.getCodePath())) { + if (IncrementalManager.isIncrementalPath(pkg.getPath())) { return false; } return true; diff --git a/services/core/java/com/android/server/pm/parsing/pkg/PackageImpl.java b/services/core/java/com/android/server/pm/parsing/pkg/PackageImpl.java index 33fb8be4457bd..0e3e110bdc567 100644 --- a/services/core/java/com/android/server/pm/parsing/pkg/PackageImpl.java +++ b/services/core/java/com/android/server/pm/parsing/pkg/PackageImpl.java @@ -136,9 +136,9 @@ public final class PackageImpl extends ParsingPackageImpl implements ParsedPacka private int uid = -1; @VisibleForTesting - public PackageImpl(@NonNull String packageName, @NonNull String baseCodePath, - @NonNull String codePath, @Nullable TypedArray manifestArray, boolean isCoreApp) { - super(packageName, baseCodePath, codePath, manifestArray); + public PackageImpl(@NonNull String packageName, @NonNull String baseApkPath, + @NonNull String path, @Nullable TypedArray manifestArray, boolean isCoreApp) { + super(packageName, baseApkPath, path, manifestArray); this.manifestPackageName = this.packageName; this.coreApp = isCoreApp; } @@ -247,7 +247,7 @@ public final class PackageImpl extends ParsingPackageImpl implements ParsedPacka @Override public PackageImpl setCodePath(@NonNull String value) { - this.codePath = value; + this.mPath = value; return this; } @@ -322,7 +322,7 @@ public final class PackageImpl extends ParsingPackageImpl implements ParsedPacka @Override public PackageImpl setBaseCodePath(@NonNull String baseCodePath) { - this.baseCodePath = TextUtils.safeIntern(baseCodePath); + this.mBaseApkPath = TextUtils.safeIntern(baseCodePath); return this; } diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java index ffdcc227b7f12..1cfc5b135cfae 100644 --- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java +++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java @@ -3526,7 +3526,7 @@ public class PermissionManagerService extends IPermissionManager.Stub { deniedPermissions == null || !deniedPermissions.contains(perm); if (permissionViolation) { Slog.w(TAG, "Privileged permission " + perm + " for package " - + pkg.getPackageName() + " (" + pkg.getCodePath() + + pkg.getPackageName() + " (" + pkg.getPath() + ") not in privapp-permissions whitelist"); if (RoSystemProperties.CONTROL_PRIVAPP_PERMISSIONS_ENFORCE) { @@ -3534,7 +3534,7 @@ public class PermissionManagerService extends IPermissionManager.Stub { mPrivappPermissionsViolations = new ArraySet<>(); } mPrivappPermissionsViolations.add( - pkg.getPackageName() + " (" + pkg.getCodePath() + "): " + pkg.getPackageName() + " (" + pkg.getPath() + "): " + perm); } } else { diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java b/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java index 0bf06bb4dda7a..0f609092a664d 100644 --- a/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java +++ b/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java @@ -617,7 +617,7 @@ public class PackageManagerSettingsTests { null /*usesStaticLibraries*/, null /*usesStaticLibrariesVersions*/, null /*mimeGroups*/); - assertThat(testPkgSetting01.getCodePath(), is(UPDATED_CODE_PATH)); + assertThat(testPkgSetting01.getPath(), is(UPDATED_CODE_PATH)); assertThat(testPkgSetting01.name, is(PACKAGE_NAME)); assertThat(testPkgSetting01.pkgFlags, is(ApplicationInfo.FLAG_SYSTEM)); assertThat(testPkgSetting01.pkgPrivateFlags, is(ApplicationInfo.PRIVATE_FLAG_PRIVILEGED)); @@ -656,7 +656,7 @@ public class PackageManagerSettingsTests { null /*usesStaticLibrariesVersions*/, null /*mimeGroups*/); assertThat(testPkgSetting01.appId, is(0)); - assertThat(testPkgSetting01.getCodePath(), is(INITIAL_CODE_PATH)); + assertThat(testPkgSetting01.getPath(), is(INITIAL_CODE_PATH)); assertThat(testPkgSetting01.name, is(PACKAGE_NAME)); assertThat(testPkgSetting01.pkgFlags, is(0)); assertThat(testPkgSetting01.pkgPrivateFlags, is(0)); @@ -700,7 +700,7 @@ public class PackageManagerSettingsTests { null /*usesStaticLibrariesVersions*/, null /*mimeGroups*/); assertThat(testPkgSetting01.appId, is(10064)); - assertThat(testPkgSetting01.getCodePath(), is(INITIAL_CODE_PATH)); + assertThat(testPkgSetting01.getPath(), is(INITIAL_CODE_PATH)); assertThat(testPkgSetting01.name, is(PACKAGE_NAME)); assertThat(testPkgSetting01.pkgFlags, is(0)); assertThat(testPkgSetting01.pkgPrivateFlags, is(0)); @@ -741,7 +741,7 @@ public class PackageManagerSettingsTests { null /*usesStaticLibrariesVersions*/, null /*mimeGroups*/); assertThat(testPkgSetting01.appId, is(10064)); - assertThat(testPkgSetting01.getCodePath(), is(UPDATED_CODE_PATH)); + assertThat(testPkgSetting01.getPath(), is(UPDATED_CODE_PATH)); assertThat(testPkgSetting01.name, is(PACKAGE_NAME)); assertThat(testPkgSetting01.pkgFlags, is(0)); assertThat(testPkgSetting01.pkgPrivateFlags, is(0)); @@ -792,10 +792,10 @@ public class PackageManagerSettingsTests { private void verifySettingCopy(PackageSetting origPkgSetting, PackageSetting testPkgSetting) { assertThat(origPkgSetting, is(not(testPkgSetting))); assertThat(origPkgSetting.appId, is(testPkgSetting.appId)); - assertSame(origPkgSetting.getCodePath(), testPkgSetting.getCodePath()); - assertThat(origPkgSetting.getCodePath(), is(testPkgSetting.getCodePath())); - assertSame(origPkgSetting.getCodePathString(), testPkgSetting.getCodePathString()); - assertThat(origPkgSetting.getCodePathString(), is(testPkgSetting.getCodePathString())); + assertSame(origPkgSetting.getPath(), testPkgSetting.getPath()); + assertThat(origPkgSetting.getPath(), is(testPkgSetting.getPath())); + assertSame(origPkgSetting.getPathString(), testPkgSetting.getPathString()); + assertThat(origPkgSetting.getPathString(), is(testPkgSetting.getPathString())); assertSame(origPkgSetting.cpuAbiOverrideString, testPkgSetting.cpuAbiOverrideString); assertThat(origPkgSetting.cpuAbiOverrideString, is(testPkgSetting.cpuAbiOverrideString)); assertThat(origPkgSetting.firstInstallTime, is(testPkgSetting.firstInstallTime)); diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java b/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java index 2651cfa5449b4..1d384e961dc33 100644 --- a/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java @@ -312,7 +312,7 @@ public class PackageParserTest { private static PackageSetting mockPkgSetting(AndroidPackage pkg) { return new PackageSetting(pkg.getPackageName(), pkg.getRealPackage(), - new File(pkg.getCodePath()), null, pkg.getPrimaryCpuAbi(), pkg.getSecondaryCpuAbi(), + new File(pkg.getPath()), null, pkg.getPrimaryCpuAbi(), pkg.getSecondaryCpuAbi(), null, pkg.getVersionCode(), PackageInfoUtils.appInfoFlags(pkg, null), PackageInfoUtils.appInfoPrivateFlags(pkg, null), @@ -335,8 +335,8 @@ public class PackageParserTest { assertEquals(a.getPackageName(), b.getPackageName()); assertArrayEquals(a.getSplitNames(), b.getSplitNames()); assertEquals(a.getVolumeUuid(), b.getVolumeUuid()); - assertEquals(a.getCodePath(), b.getCodePath()); - assertEquals(a.getBaseCodePath(), b.getBaseCodePath()); + assertEquals(a.getPath(), b.getPath()); + assertEquals(a.getBaseApkPath(), b.getBaseApkPath()); assertArrayEquals(a.getSplitCodePaths(), b.getSplitCodePaths()); assertArrayEquals(a.getSplitRevisionCodes(), b.getSplitRevisionCodes()); assertArrayEquals(a.getSplitFlags(), b.getSplitFlags()); diff --git a/services/tests/servicestests/src/com/android/server/pm/ScanTests.java b/services/tests/servicestests/src/com/android/server/pm/ScanTests.java index 56dddb0a81121..4d8cc46472711 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ScanTests.java +++ b/services/tests/servicestests/src/com/android/server/pm/ScanTests.java @@ -533,7 +533,7 @@ public class ScanTests { arrayContaining("some.static.library", "some.other.static.library")); assertThat(pkgSetting.usesStaticLibrariesVersions, is(new long[]{234L, 456L})); assertThat(pkgSetting.pkg, is(scanResult.request.parsedPackage)); - assertThat(pkgSetting.getCodePath(), is(new File(createCodePath(packageName)))); + assertThat(pkgSetting.getPath(), is(new File(createCodePath(packageName)))); assertThat(pkgSetting.versionCode, is(PackageInfo.composeLongVersionCode(1, 2345))); } diff --git a/services/tests/servicestests/src/com/android/server/pm/dex/DexMetadataHelperTest.java b/services/tests/servicestests/src/com/android/server/pm/dex/DexMetadataHelperTest.java index caa8ae5e0e39d..3ce7a7d73d4a3 100644 --- a/services/tests/servicestests/src/com/android/server/pm/dex/DexMetadataHelperTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/dex/DexMetadataHelperTest.java @@ -29,12 +29,10 @@ import android.content.pm.PackageParser.PackageLite; import android.content.pm.PackageParser.PackageParserException; import android.content.pm.dex.DexMetadataHelper; import android.content.pm.parsing.ApkLiteParseUtils; -import android.content.pm.parsing.result.ParseInput; import android.content.pm.parsing.result.ParseResult; import android.content.pm.parsing.result.ParseTypeImpl; import android.os.FileUtils; -import androidx.annotation.NonNull; import androidx.test.InstrumentationRegistry; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; @@ -106,9 +104,9 @@ public class DexMetadataHelperTest { Map packageDexMetadata = AndroidPackageUtils.getPackageDexMetadata(pkg); assertEquals(1, packageDexMetadata.size()); - String baseDexMetadata = packageDexMetadata.get(pkg.getBaseCodePath()); + String baseDexMetadata = packageDexMetadata.get(pkg.getBaseApkPath()); assertNotNull(baseDexMetadata); - assertTrue(isDexMetadataForApk(baseDexMetadata, pkg.getBaseCodePath())); + assertTrue(isDexMetadataForApk(baseDexMetadata, pkg.getBaseApkPath())); } @Test @@ -122,9 +120,9 @@ public class DexMetadataHelperTest { Map packageDexMetadata = AndroidPackageUtils.getPackageDexMetadata(pkg); assertEquals(2, packageDexMetadata.size()); - String baseDexMetadata = packageDexMetadata.get(pkg.getBaseCodePath()); + String baseDexMetadata = packageDexMetadata.get(pkg.getBaseApkPath()); assertNotNull(baseDexMetadata); - assertTrue(isDexMetadataForApk(baseDexMetadata, pkg.getBaseCodePath())); + assertTrue(isDexMetadataForApk(baseDexMetadata, pkg.getBaseApkPath())); String splitDexMetadata = packageDexMetadata.get(pkg.getSplitCodePaths()[0]); assertNotNull(splitDexMetadata);