From 41a17c2e72d61be0a060bf43b669623462a23f13 Mon Sep 17 00:00:00 2001 From: Johan Redestig Date: Thu, 30 Jan 2014 09:39:00 +0100 Subject: [PATCH] Use canonical path for /vendor/app It wasn't possible to start apps installed in /vendor/app on a device where /vendor was a symbolic link to /system/vendor. This is currently the default configuration for android (see init.rc) During installation a dex file is created at: /data/dalvik-cache/vendor@app@blah.blah.apk@classes.dex But dalvik would fail to start this app with the following error: I/dalvikvm( 3453): Unable to open or create cache for /system/vendor/app/blah.apk \ (/data/dalvik-cache/system@vendor@app@blah.blah.apk@classes.dex) Note that dalvik were trying to start /system/vendor/app while the app was installed in /vendor. There was a conflict between the package manager and dalvik on how to interpret paths. This change makes the package manager consistent with dalvik. Change-Id: I1c7e3c3ae45f97dd742cbf06f7965a7405c821a7 --- .../java/com/android/server/pm/PackageManagerService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index 7e244b96b0208..7ea1fce79facf 100755 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -1301,6 +1301,11 @@ public class PackageManagerService extends IPackageManager.Stub { // Collect all vendor packages. File vendorAppDir = new File("/vendor/app"); + try { + vendorAppDir = vendorAppDir.getCanonicalFile(); + } catch (IOException e) { + // failed to look up canonical path, continue with original one + } mVendorInstallObserver = new AppDirObserver( vendorAppDir.getPath(), OBSERVER_EVENTS, true, false); mVendorInstallObserver.startWatching();