diff options
| author | 2016-12-22 18:47:05 +0200 | |
|---|---|---|
| committer | 2017-01-10 16:53:41 -0800 | |
| commit | b96dba9badc18f1c831c0c83ff7934f6aaf4f51c (patch) | |
| tree | 115be9b7b06e64f7652fe3e70a02fed12fafc4f1 | |
| parent | 271bacbf5c524bbe33a7f0551b33f7a21cb64f17 (diff) | |
Do not try to resolve realpath in DexManager.
PM should already provide the real path of the application directory.
Test: runtest -x .../DexManagerTests.java
Bug: 33807524
Bug: 32871170
(cherry picked from commit c066205cea051c6d9f386188b9cb426c03dbee2d)
Change-Id: Ie6b5f5e61d08710e7ef7d3149b7b13cc7d03a242
| -rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 28 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/dex/DexManager.java | 27 |
2 files changed, 29 insertions, 26 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index a87204254dfc..daa217e00330 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -2550,19 +2550,6 @@ public class PackageManagerService extends IPackageManager.Stub { mPackageUsage.read(mPackages); mCompilerStats.read(); - // Read and update the usage of dex files. - // At this point we know the code paths of the packages, so we can validate - // the disk file and build the internal cache. - // The usage file is expected to be small so loading and verifying it - // should take a fairly small time compare to the other activities (e.g. package - // scanning). - final Map<Integer, List<PackageInfo>> userPackages = new HashMap<>(); - final int[] currentUserIds = UserManagerService.getInstance().getUserIds(); - for (int userId : currentUserIds) { - userPackages.put(userId, getInstalledPackages(/*flags*/ 0, userId).getList()); - } - mDexManager.load(userPackages); - EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_SCAN_END, SystemClock.uptimeMillis()); Slog.i(TAG, "Time to scan packages: " @@ -2728,6 +2715,21 @@ public class PackageManagerService extends IPackageManager.Stub { } mEphemeralApplicationRegistry = new EphemeralApplicationRegistry(this); + + // Read and update the usage of dex files. + // Do this at the end of PM init so that all the packages have their + // data directory reconciled. + // At this point we know the code paths of the packages, so we can validate + // the disk file and build the internal cache. + // The usage file is expected to be small so loading and verifying it + // should take a fairly small time compare to the other activities (e.g. package + // scanning). + final Map<Integer, List<PackageInfo>> userPackages = new HashMap<>(); + final int[] currentUserIds = UserManagerService.getInstance().getUserIds(); + for (int userId : currentUserIds) { + userPackages.put(userId, getInstalledPackages(/*flags*/ 0, userId).getList()); + } + mDexManager.load(userPackages); } // synchronized (mPackages) } // synchronized (mInstallLock) diff --git a/services/core/java/com/android/server/pm/dex/DexManager.java b/services/core/java/com/android/server/pm/dex/DexManager.java index a1060dcb6eff..6d06838cd24f 100644 --- a/services/core/java/com/android/server/pm/dex/DexManager.java +++ b/services/core/java/com/android/server/pm/dex/DexManager.java @@ -265,19 +265,6 @@ public class DexManager { public void mergeAppDataDirs(ApplicationInfo ai, int userId) { Set<String> dataDirs = putIfAbsent(mAppDataDirs, userId, new HashSet<>()); dataDirs.add(ai.dataDir); - - // Compute and cache the real path as well since data dir may be a symlink. - // e.g. /data/data/ -> /data/user/0/ - try { - dataDirs.add(PackageManagerServiceUtils.realpath(new File(ai.dataDir))); - } catch (IOException e) { - if (DEBUG) { - // Verify why we're getting spam at boot for some devices. - // b/33807524 - Slog.w(TAG, "Error to get realpath of " + ai.dataDir, e); - } - } - } public int searchDex(String dexPath, int userId) { @@ -302,6 +289,20 @@ public class DexManager { return DEX_SEARCH_FOUND_SECONDARY; } } + + // TODO(calin): What if we get a symlink? e.g. data dir may be a symlink, + // /data/data/ -> /data/user/0/. + if (DEBUG) { + try { + String dexPathReal = PackageManagerServiceUtils.realpath(new File(dexPath)); + if (dexPathReal != dexPath) { + Slog.d(TAG, "Dex loaded with symlink. dexPath=" + + dexPath + " dexPathReal=" + dexPathReal); + } + } catch (IOException e) { + // Ignore + } + } return DEX_SEARCH_NOT_FOUND; } } |