summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2010-06-03 14:37:42 -0700
committerandroid-build SharedAccount <android-build@sekiwake.mtv.corp.google.com>2010-08-17 23:21:56 -0700
commit24a03083ca5cf33342debb9a230a591f098f7fd8 (patch)
tree159653c3fb88adfdb9d78ea7a5b5ddfc80c21cc6 /services
parent3b70e159a8168c1154d31d7b0552bb3b0c099334 (diff)
downloadframeworks_base-24a03083ca5cf33342debb9a230a591f098f7fd8.zip
frameworks_base-24a03083ca5cf33342debb9a230a591f098f7fd8.tar.gz
frameworks_base-24a03083ca5cf33342debb9a230a591f098f7fd8.tar.bz2
PackageManagerService: always install native binaries from .apk
The previous implementation fails to work properly when the .apk and installed versions of the binaries have the same size and date. Change-Id: I063817a935da9ad459858d7eec8bb3d940607850
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/PackageManagerService.java50
1 files changed, 28 insertions, 22 deletions
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 0b84c8d..b70d69b 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -3623,21 +3623,19 @@ class PackageManagerService extends IPackageManager.Stub {
installedNativeLibraries = true;
+ // Always extract the shared library
String sharedLibraryFilePath = sharedLibraryDir.getPath() +
File.separator + libFileName;
File sharedLibraryFile = new File(sharedLibraryFilePath);
- if (! sharedLibraryFile.exists() ||
- sharedLibraryFile.length() != entry.getSize() ||
- sharedLibraryFile.lastModified() != entry.getTime()) {
- if (Config.LOGD) {
- Log.d(TAG, "Caching shared lib " + entry.getName());
- }
- if (mInstaller == null) {
- sharedLibraryDir.mkdir();
- }
- cacheNativeBinaryLI(pkg, zipFile, entry, sharedLibraryDir,
- sharedLibraryFile);
+
+ if (Config.LOGD) {
+ Log.d(TAG, "Caching shared lib " + entry.getName());
}
+ if (mInstaller == null) {
+ sharedLibraryDir.mkdir();
+ }
+ cacheNativeBinaryLI(pkg, zipFile, entry, sharedLibraryDir,
+ sharedLibraryFile);
}
if (!hasNativeLibraries)
return PACKAGE_INSTALL_NATIVE_NO_LIBRARIES;
@@ -3679,18 +3677,16 @@ class PackageManagerService extends IPackageManager.Stub {
String installGdbServerPath = installGdbServerDir.getPath() +
"/" + GDBSERVER;
File installGdbServerFile = new File(installGdbServerPath);
- if (! installGdbServerFile.exists() ||
- installGdbServerFile.length() != entry.getSize() ||
- installGdbServerFile.lastModified() != entry.getTime()) {
- if (Config.LOGD) {
- Log.d(TAG, "Caching gdbserver " + entry.getName());
- }
- if (mInstaller == null) {
- installGdbServerDir.mkdir();
- }
- cacheNativeBinaryLI(pkg, zipFile, entry, installGdbServerDir,
- installGdbServerFile);
+
+ if (Config.LOGD) {
+ Log.d(TAG, "Caching gdbserver " + entry.getName());
+ }
+ if (mInstaller == null) {
+ installGdbServerDir.mkdir();
}
+ cacheNativeBinaryLI(pkg, zipFile, entry, installGdbServerDir,
+ installGdbServerFile);
+
return PACKAGE_INSTALL_NATIVE_FOUND_LIBRARIES;
}
return PACKAGE_INSTALL_NATIVE_NO_LIBRARIES;
@@ -3704,6 +3700,16 @@ class PackageManagerService extends IPackageManager.Stub {
// one if ro.product.cpu.abi2 is defined.
//
private int cachePackageSharedLibsLI(PackageParser.Package pkg, File scanFile) {
+ // Remove all native binaries from a directory. This is used when upgrading
+ // a package: in case the new .apk doesn't contain a native binary that was
+ // in the old one (and thus installed), we need to remove it from
+ // /data/data/<appname>/lib
+ //
+ // The simplest way to do that is to remove all files in this directory,
+ // since it is owned by "system", applications are not supposed to write
+ // anything there.
+ removeNativeBinariesLI(pkg);
+
String cpuAbi = Build.CPU_ABI;
try {
int result = cachePackageSharedLibsForAbiLI(pkg, scanFile, cpuAbi);