summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2010-09-12 18:02:47 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-12 18:02:47 -0700
commit1361a5bd1eba1cae16c301622324153c3d50b84c (patch)
tree183820a7caf518fb1f6bfe1e4b9405ac17fc6e13 /core/java/com
parente740dd0c8fde910066f9ddf83b4ab094ed95eaf9 (diff)
parent07a9e8d39f818e54f0feccff10c99b9629007a64 (diff)
downloadframeworks_base-1361a5bd1eba1cae16c301622324153c3d50b84c.zip
frameworks_base-1361a5bd1eba1cae16c301622324153c3d50b84c.tar.gz
frameworks_base-1361a5bd1eba1cae16c301622324153c3d50b84c.tar.bz2
am 07a9e8d3: Merge changes Ie3648509,I53db73c3 into gingerbread
Merge commit '07a9e8d39f818e54f0feccff10c99b9629007a64' into gingerbread-plus-aosp * commit '07a9e8d39f818e54f0feccff10c99b9629007a64': Move native library removal function to helper Initialize native library path in PackageSetting
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/content/NativeLibraryHelper.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/core/java/com/android/internal/content/NativeLibraryHelper.java b/core/java/com/android/internal/content/NativeLibraryHelper.java
index 8b618c7..6e11cff 100644
--- a/core/java/com/android/internal/content/NativeLibraryHelper.java
+++ b/core/java/com/android/internal/content/NativeLibraryHelper.java
@@ -293,4 +293,34 @@ public class NativeLibraryHelper {
inputStream.close();
}
}
+
+ // Remove the native binaries of a given package. This simply
+ // gets rid of the files in the 'lib' sub-directory.
+ public static void removeNativeBinariesLI(String nativeLibraryPath) {
+ if (DEBUG_NATIVE) {
+ Slog.w(TAG, "Deleting native binaries from: " + nativeLibraryPath);
+ }
+
+ /*
+ * Just remove any file in the directory. Since the directory is owned
+ * by the 'system' UID, the application is not supposed to have written
+ * anything there.
+ */
+ File binaryDir = new File(nativeLibraryPath);
+ if (binaryDir.exists()) {
+ File[] binaries = binaryDir.listFiles();
+ if (binaries != null) {
+ for (int nn = 0; nn < binaries.length; nn++) {
+ if (DEBUG_NATIVE) {
+ Slog.d(TAG, " Deleting " + binaries[nn].getName());
+ }
+ if (!binaries[nn].delete()) {
+ Slog.w(TAG, "Could not delete native binary: " + binaries[nn].getPath());
+ }
+ }
+ }
+ // Do not delete 'lib' directory itself, or this will prevent
+ // installation of future updates.
+ }
+ }
}