Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8f31d8a authored by Calin Juravle's avatar Calin Juravle Committed by android-build-merger
Browse files

Do not try to resolve realpath in DexManager.

am: b96dba9b

Change-Id: I67aba48784bca9a51f63e47b54c211ba535dd0e4
parents 42c7fc7f b96dba9b
Loading
Loading
Loading
Loading
+15 −13
Original line number Diff line number Diff line
@@ -2544,19 +2544,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: "
@@ -2722,6 +2709,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)
+14 −13
Original line number Diff line number Diff line
@@ -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;
        }
    }