diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index be70dcd204caf..9e48f9c6ef714 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -5113,7 +5113,7 @@ public final class ActivityThread { LoadedApk apk = ref != null ? ref.get() : null; if (apk != null) { final ArrayList 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 oldPaths = new ArrayList<>(); - LoadedApk.makePaths(this, apk.getApplicationInfo(), oldPaths, null /*outLibPaths*/); + LoadedApk.makePaths(this, apk.getApplicationInfo(), oldPaths); apk.updateApplicationInfo(ai, oldPaths); } diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java index 7ed96af6fa21d..1c33e3865b01c 100644 --- a/core/java/android/app/LoadedApk.java +++ b/core/java/android/app/LoadedApk.java @@ -278,7 +278,7 @@ public final class LoadedApk { setApplicationInfo(aInfo); final List newPaths = new ArrayList<>(); - makePaths(mActivityThread, aInfo, newPaths, null /*libPaths*/); + makePaths(mActivityThread, aInfo, newPaths); final List 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 outZipPaths, List outLibPaths) { + public static void makePaths(ActivityThread activityThread, + ApplicationInfo aInfo, + List outZipPaths) { + makePaths(activityThread, false, aInfo, outZipPaths, null); + } + + public static void makePaths(ActivityThread activityThread, + boolean isBundledApp, + ApplicationInfo aInfo, + List outZipPaths, + List 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 zipPaths = new ArrayList<>(10); final List 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 diff --git a/core/java/android/webkit/WebViewZygote.java b/core/java/android/webkit/WebViewZygote.java index 2d6f44352ba7d..f9d733201e591 100644 --- a/core/java/android/webkit/WebViewZygote.java +++ b/core/java/android/webkit/WebViewZygote.java @@ -176,7 +176,7 @@ public class WebViewZygote { // paths and pass them to the zygote as strings. final List zipPaths = new ArrayList<>(10); final List 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);