From 20200849d1dd6ac5e52b3d18ced2d9becb5ff229 Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Mon, 11 Aug 2014 11:45:24 +0100 Subject: [PATCH] Fix a couple of PM warnings. - "Could not delete native binary" : This one is a bit of a WTF. git history tells us this code has been around for a very long time (the warning's new though). It's a no-op because codePath always contains the *current* codePath and trying to remove native libs from the current codePath will do nothing for bundled apps. This code sounds like it wants to delete dangling native binaries for system apps that were upgraded during an OTA. This sounds like a wrong place to do that, though. - "Unrecognized code path" : This one's harmless and removed by moving this call closer to where it's used. bug: 16823001 Change-Id: I9b40ae507b2c80ff3fdd45d5699df62bfc86514f --- .../server/pm/PackageManagerService.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 24ddfa6bb9cc0..f3519af7841d0 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -5436,13 +5436,6 @@ public class PackageManagerService extends IPackageManager.Stub { final String path = scanFile.getPath(); final String codePath = pkg.applicationInfo.getCodePath(); if (isSystemApp(pkg) && !isUpdatedSystemApp(pkg)) { - // For the case where we had previously uninstalled an update, get rid - // of any native binaries we might have unpackaged. Note that this assumes - // that system app updates were not installed via ASEC. - // - // TODO(multiArch): Is this cleanup really necessary ? - NativeLibraryHelper.removeNativeBinariesFromDirLI( - new File(codePath, LIB_DIR_NAME), false /* delete dirs */); setBundledAppAbisAndRoots(pkg, pkgSetting); // If we haven't found any native libraries for the app, check if it has @@ -6241,7 +6234,7 @@ public class PackageManagerService extends IPackageManager.Stub { } } - private static String calculateApkRoot(final String codePathString) { + private static String calculateBundledApkRoot(final String codePathString) { final File codePath = new File(codePathString); final File codeRoot; if (FileUtils.contains(Environment.getRootDirectory(), codePath)) { @@ -6281,14 +6274,9 @@ public class PackageManagerService extends IPackageManager.Stub { final ApplicationInfo info = pkg.applicationInfo; final String codePath = pkg.codePath; final File codeFile = new File(codePath); - // If "/system/lib64/apkname" exists, assume that is the per-package - // native library directory to use; otherwise use "/system/lib/apkname". - final String apkRoot = calculateApkRoot(info.sourceDir); - final boolean bundledApp = isSystemApp(info) && !isUpdatedSystemApp(info); final boolean asecApp = isForwardLocked(info) || isExternal(info); - info.nativeLibraryRootDir = null; info.nativeLibraryRootRequiresIsa = false; info.nativeLibraryDir = null; @@ -6297,6 +6285,9 @@ public class PackageManagerService extends IPackageManager.Stub { if (isApkFile(codeFile)) { // Monolithic install if (bundledApp) { + // 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(info.sourceDir); final boolean is64Bit = VMRuntime.is64BitInstructionSet( getPrimaryInstructionSet(info)); @@ -6352,7 +6343,7 @@ public class PackageManagerService extends IPackageManager.Stub { // If "/system/lib64/apkname" exists, assume that is the per-package // native library directory to use; otherwise use "/system/lib/apkname". - final String apkRoot = calculateApkRoot(pkg.applicationInfo.sourceDir); + final String apkRoot = calculateBundledApkRoot(pkg.applicationInfo.sourceDir); setBundledAppAbi(pkg, apkRoot, apkName); // pkgSetting might be null during rescan following uninstall of updates // to a bundled app, so accommodate that possibility. The settings in