Merge "Basedir of a bundled app is added to the permitted paths" into pi-dev

This commit is contained in:
Jiyong Park
2018-05-09 14:48:45 +00:00
committed by Android (Google) Code Review

View File

@@ -64,6 +64,7 @@ import java.lang.ref.WeakReference;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.URL; import java.net.URL;
import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@@ -668,7 +669,17 @@ public final class LoadedApk {
makePaths(mActivityThread, isBundledApp, mApplicationInfo, zipPaths, libPaths); makePaths(mActivityThread, isBundledApp, mApplicationInfo, zipPaths, libPaths);
String libraryPermittedPath = mDataDir; String libraryPermittedPath = mDataDir;
if (isBundledApp) { if (isBundledApp) {
// For bundled apps, add the base directory of the app (e.g.,
// /system/app/Foo/) to the permitted paths so that it can load libraries
// embedded in module apks under the directory. For now, GmsCore is relying
// on this, but this isn't specific to the app. Also note that, we don't
// need to do this for unbundled apps as entire /data is already set to
// the permitted paths for them.
libraryPermittedPath += File.pathSeparator
+ Paths.get(getAppDir()).getParent().toString();
// This is necessary to grant bundled apps access to // This is necessary to grant bundled apps access to
// libraries located in subdirectories of /system/lib // libraries located in subdirectories of /system/lib
libraryPermittedPath += File.pathSeparator + defaultSearchPaths; libraryPermittedPath += File.pathSeparator + defaultSearchPaths;