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

Commit e09089d8 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Use canonical paths to compare library directory with data directory."

parents 607e379e 0f3f29b1
Loading
Loading
Loading
Loading
+36 −30
Original line number Diff line number Diff line
@@ -2855,8 +2855,8 @@ public class PackageManagerService extends IPackageManager.Stub {
    }

    private File getDataPathForPackage(String packageName, int userId) {
        return new File(mUserAppDataDir.getAbsolutePath() + File.separator
                    + userId + File.separator + packageName);
        return new File(mUserAppDataDir.getAbsolutePath() + File.separator + userId
                + File.separator + packageName);
    }

    private PackageParser.Package scanPackageLI(PackageParser.Package pkg,
@@ -3319,8 +3319,9 @@ public class PackageManagerService extends IPackageManager.Stub {
             *        only for non-system apps and system app upgrades.
             */
            if (pkg.applicationInfo.nativeLibraryDir != null) {
                try {
                    final File nativeLibraryDir = new File(pkg.applicationInfo.nativeLibraryDir);
                final String dataPathString = dataPath.getPath();
                    final String dataPathString = dataPath.getCanonicalFile().getPath();

                    if (isSystemApp(pkg) && !isUpdatedSystemApp(pkg)) {
                        /*
@@ -3331,9 +3332,11 @@ public class PackageManagerService extends IPackageManager.Stub {
                         * necessitates we remove those to match previous behavior.
                         */
                        if (NativeLibraryHelper.removeNativeBinariesFromDirLI(nativeLibraryDir)) {
                        Log.i(TAG, "removed obsolete native libraries for system package " + path);
                            Log.i(TAG, "removed obsolete native libraries for system package "
                                    + path);
                        }
                } else if (nativeLibraryDir.getParent().equals(dataPathString)) {
                    } else if (nativeLibraryDir.getCanonicalFile().getParent()
                            .equals(dataPathString)) {
                        /*
                         * If this is an internal application or our
                         * nativeLibraryPath points to our data directory, unpack
@@ -3350,6 +3353,9 @@ public class PackageManagerService extends IPackageManager.Stub {
                        mInstaller.linkNativeLibraryDirectory(dataPathString,
                                pkg.applicationInfo.nativeLibraryDir);
                    }
                } catch (IOException ioe) {
                    Log.e(TAG, "Unable to get canonical file " + ioe.toString());
                }
            }
            pkg.mScanPath = path;