diff options
author | Narayan Kamath <narayan@google.com> | 2014-05-01 13:52:59 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-05-01 13:52:59 +0000 |
commit | a7b465efc4eede46b8dfc8932c6c30346e8e79de (patch) | |
tree | 874b91c7af4815ba52bea03cae1250b6ea9144db /services/java | |
parent | 9f34234f1c0e39ee43c4a86e23d333ba2a30ec0e (diff) | |
parent | d91358b2b977ef7c3551a486f51475c0441aba6e (diff) | |
download | frameworks_base-a7b465efc4eede46b8dfc8932c6c30346e8e79de.zip frameworks_base-a7b465efc4eede46b8dfc8932c6c30346e8e79de.tar.gz frameworks_base-a7b465efc4eede46b8dfc8932c6c30346e8e79de.tar.bz2 |
am d91358b2: Merge "Support per-package lib dirs for bundled apps"
* commit 'd91358b2b977ef7c3551a486f51475c0441aba6e':
Support per-package lib dirs for bundled apps
Diffstat (limited to 'services/java')
-rwxr-xr-x | services/java/com/android/server/pm/PackageManagerService.java | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index 7df70f1..aae2725 100755 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -258,6 +258,7 @@ public class PackageManagerService extends IPackageManager.Stub { private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive"; private static final String LIB_DIR_NAME = "lib"; + private static final String LIB64_DIR_NAME = "lib64"; private static final String VENDOR_OVERLAY_DIR = "/vendor/overlay"; @@ -4147,6 +4148,14 @@ public class PackageManagerService extends IPackageManager.Stub { private boolean updateSharedLibrariesLPw(PackageParser.Package pkg, PackageParser.Package changingLib) { + // We might be upgrading from a version of the platform that did not + // provide per-package native library directories for system apps. + // Fix that up here. + if (isSystemApp(pkg)) { + PackageSetting ps = mSettings.mPackages.get(pkg.applicationInfo.packageName); + setInternalAppNativeLibraryPath(pkg, ps); + } + if (pkg.usesLibraries != null || pkg.usesOptionalLibraries != null) { if (mTmpSharedLibraries == null || mTmpSharedLibraries.length < mSharedLibraries.size()) { @@ -5239,10 +5248,26 @@ public class PackageManagerService extends IPackageManager.Stub { } } + // This is the initial scan-time determination of how to handle a given + // package for purposes of native library location. private void setInternalAppNativeLibraryPath(PackageParser.Package pkg, PackageSetting pkgSetting) { - final String apkLibPath = getApkName(pkgSetting.codePathString); - final String nativeLibraryPath = new File(mAppLibInstallDir, apkLibPath).getPath(); + // "bundled" here means system-installed with no overriding update + final boolean bundledApk = isSystemApp(pkg) && !isUpdatedSystemApp(pkg); + final String apkName = getApkName(pkgSetting.codePathString); + final File libDir; + if (bundledApk) { + // If "/system/lib64/apkname" exists, assume that is the per-package + // native library directory to use; otherwise use "/system/lib/apkname". + File lib64 = new File(Environment.getRootDirectory(), LIB64_DIR_NAME); + File packLib64 = new File(lib64, apkName); + libDir = (packLib64.exists()) + ? lib64 + : new File(Environment.getRootDirectory(), LIB_DIR_NAME); + } else { + libDir = mAppLibInstallDir; + } + final String nativeLibraryPath = (new File(libDir, apkName)).getPath(); pkg.applicationInfo.nativeLibraryDir = nativeLibraryPath; pkgSetting.nativeLibraryPathString = nativeLibraryPath; } @@ -9649,13 +9674,14 @@ public class PackageManagerService extends IPackageManager.Stub { } // writer synchronized (mPackages) { + PackageSetting ps = mSettings.mPackages.get(newPkg.packageName); + setInternalAppNativeLibraryPath(newPkg, ps); updatePermissionsLPw(newPkg.packageName, newPkg, UPDATE_PERMISSIONS_ALL | UPDATE_PERMISSIONS_REPLACE_PKG); if (applyUserRestrictions) { if (DEBUG_REMOVE) { Slog.d(TAG, "Propagating install state across reinstall"); } - PackageSetting ps = mSettings.mPackages.get(newPkg.packageName); for (int i = 0; i < allUserHandles.length; i++) { if (DEBUG_REMOVE) { Slog.d(TAG, " user " + allUserHandles[i] |