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

Commit 638d8100 authored by Dimitry Ivanov's avatar Dimitry Ivanov
Browse files

Add isBundled argument to LoadedApk.makePaths call

There is a disconnect between the way webview created
classloader and the way makePaths decides if paths are
intended for bundled app.

This change moves decision making out of makePaths method
which allows WebViewZygote to pass correct argument and
have makePath omit java.library.path for libPaths

Bug: http://b/35426785
Test: manual
Change-Id: Iab5a18c0091d0193dafa750498eb00f378411ba0
parent 3aa3a007
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -5113,7 +5113,7 @@ public final class ActivityThread {
            LoadedApk apk = ref != null ? ref.get() : null;
            if (apk != null) {
                final ArrayList<String> oldPaths = new ArrayList<>();
                LoadedApk.makePaths(this, apk.getApplicationInfo(), oldPaths, null /*outLibPaths*/);
                LoadedApk.makePaths(this, apk.getApplicationInfo(), oldPaths);
                apk.updateApplicationInfo(ai, oldPaths);
            }

@@ -5121,7 +5121,7 @@ public final class ActivityThread {
            apk = ref != null ? ref.get() : null;
            if (apk != null) {
                final ArrayList<String> oldPaths = new ArrayList<>();
                LoadedApk.makePaths(this, apk.getApplicationInfo(), oldPaths, null /*outLibPaths*/);
                LoadedApk.makePaths(this, apk.getApplicationInfo(), oldPaths);
                apk.updateApplicationInfo(ai, oldPaths);
            }

+15 −5
Original line number Diff line number Diff line
@@ -278,7 +278,7 @@ public final class LoadedApk {
        setApplicationInfo(aInfo);

        final List<String> newPaths = new ArrayList<>();
        makePaths(mActivityThread, aInfo, newPaths, null /*libPaths*/);
        makePaths(mActivityThread, aInfo, newPaths);
        final List<String> addedPaths = new ArrayList<>(newPaths.size());

        if (oldPaths != null) {
@@ -341,8 +341,17 @@ public final class LoadedApk {
        }
    }

    public static void makePaths(ActivityThread activityThread, ApplicationInfo aInfo,
            List<String> outZipPaths, List<String> outLibPaths) {
    public static void makePaths(ActivityThread activityThread,
                                 ApplicationInfo aInfo,
                                 List<String> outZipPaths) {
        makePaths(activityThread, false, aInfo, outZipPaths, null);
    }

    public static void makePaths(ActivityThread activityThread,
                                 boolean isBundledApp,
                                 ApplicationInfo aInfo,
                                 List<String> outZipPaths,
                                 List<String> outLibPaths) {
        final String appDir = aInfo.sourceDir;
        final String libDir = aInfo.nativeLibraryDir;
        final String[] sharedLibraries = aInfo.sharedLibraryFiles;
@@ -431,7 +440,7 @@ public final class LoadedApk {
                }
            }

            if (aInfo.isSystemApp() && !aInfo.isUpdatedSystemApp()) {
            if (isBundledApp) {
                // Add path to system libraries to libPaths;
                // Access to system libs should be limited
                // to bundled applications; this is why updated
@@ -614,11 +623,12 @@ public final class LoadedApk {
        // space and initialize to a small value (instead of incurring growth code).
        final List<String> zipPaths = new ArrayList<>(10);
        final List<String> libPaths = new ArrayList<>(10);
        makePaths(mActivityThread, mApplicationInfo, zipPaths, libPaths);

        final boolean isBundledApp = mApplicationInfo.isSystemApp()
                && !mApplicationInfo.isUpdatedSystemApp();

        makePaths(mActivityThread, isBundledApp, mApplicationInfo, zipPaths, libPaths);

        String libraryPermittedPath = mDataDir;
        if (isBundledApp) {
            // This is necessary to grant bundled apps access to
+1 −1
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ public class WebViewZygote {
            // paths and pass them to the zygote as strings.
            final List<String> zipPaths = new ArrayList<>(10);
            final List<String> libPaths = new ArrayList<>(10);
            LoadedApk.makePaths(null, sPackage.applicationInfo, zipPaths, libPaths);
            LoadedApk.makePaths(null, false, sPackage.applicationInfo, zipPaths, libPaths);
            final String librarySearchPath = TextUtils.join(File.pathSeparator, libPaths);
            final String zip = (zipPaths.size() == 1) ? zipPaths.get(0) :
                    TextUtils.join(File.pathSeparator, zipPaths);