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

Commit 7046bd92 authored by Kenny Root's avatar Kenny Root Committed by Android (Google) Code Review
Browse files

Merge "Allow native shared libraries in ASEC containers" into gingerbread

parents 15665bb6 85387d7b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3181,6 +3181,7 @@ public final class ActivityThread {
            instrApp.sourceDir = ii.sourceDir;
            instrApp.publicSourceDir = ii.publicSourceDir;
            instrApp.dataDir = ii.dataDir;
            instrApp.nativeLibraryDir = ii.nativeLibraryDir;
            LoadedApk pi = getPackageInfo(instrApp,
                    appContext.getClassLoader(), false, true);
            ContextImpl instrContext = new ContextImpl();
+5 −5
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.app;
import dalvik.system.PathClassLoader;

import java.util.HashMap;
import java.util.Map;

class ApplicationLoaders
{
@@ -27,8 +28,7 @@ class ApplicationLoaders
        return gApplicationLoaders;
    }

    public ClassLoader getClassLoader(String zip, String appDataDir,
            ClassLoader parent)
    public ClassLoader getClassLoader(String zip, String libPath, ClassLoader parent)
    {
        /*
         * This is the parent we use if they pass "null" in.  In theory
@@ -49,13 +49,13 @@ class ApplicationLoaders
             * new ClassLoader for the zip archive.
             */
            if (parent == baseParent) {
                ClassLoader loader = (ClassLoader)mLoaders.get(zip);
                ClassLoader loader = mLoaders.get(zip);
                if (loader != null) {
                    return loader;
                }
    
                PathClassLoader pathClassloader =
                    new PathClassLoader(zip, appDataDir + "/lib", parent);
                    new PathClassLoader(zip, libPath, parent);
                
                mLoaders.put(zip, pathClassloader);
                return pathClassloader;
@@ -65,7 +65,7 @@ class ApplicationLoaders
        }
    }

    private final HashMap mLoaders = new HashMap();
    private final Map<String, ClassLoader> mLoaders = new HashMap<String, ClassLoader>();

    private static final ApplicationLoaders gApplicationLoaders
        = new ApplicationLoaders();
+6 −2
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ final class LoadedApk {
    private final String mResDir;
    private final String[] mSharedLibraries;
    private final String mDataDir;
    private final String mLibDir;
    private final File mDataDirFile;
    private final ClassLoader mBaseClassLoader;
    private final boolean mSecurityViolation;
@@ -108,6 +109,7 @@ final class LoadedApk {
        mSharedLibraries = aInfo.sharedLibraryFiles;
        mDataDir = aInfo.dataDir;
        mDataDirFile = mDataDir != null ? new File(mDataDir) : null;
        mLibDir = aInfo.nativeLibraryDir;
        mBaseClassLoader = baseLoader;
        mSecurityViolation = securityViolation;
        mIncludeCode = includeCode;
@@ -140,6 +142,7 @@ final class LoadedApk {
        mSharedLibraries = null;
        mDataDir = null;
        mDataDirFile = null;
        mLibDir = null;
        mBaseClassLoader = null;
        mSecurityViolation = false;
        mIncludeCode = true;
@@ -279,11 +282,12 @@ final class LoadedApk {
                 * create the class loader.
                 */

                if (ActivityThread.localLOGV) Slog.v(ActivityThread.TAG, "Class path: " + zip);
                if (ActivityThread.localLOGV)
                    Slog.v(ActivityThread.TAG, "Class path: " + zip + ", JNI path: " + mLibDir);

                mClassLoader =
                    ApplicationLoaders.getDefault().getClassLoader(
                        zip, mDataDir, mBaseClassLoader);
                        zip, mLibDir, mBaseClassLoader);
                initializeJavaContextClassLoader();
            } else {
                if (mBaseClassLoader == null) {
+11 −9
Original line number Diff line number Diff line
@@ -290,14 +290,6 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     */
    public static final int FLAG_FORWARD_LOCK = 1<<29;

    /**
     * Value for {@link #flags}: Set to true if the application is
     * native-debuggable, i.e. embeds a gdbserver binary in its .apk
     *
     * {@hide}
     */
    public static final int FLAG_NATIVE_DEBUGGABLE = 1<<28;

    /**
     * Value for {@link #flags}: set to <code>true</code> if the application
     * has reported that it is heavy-weight, and thus can not participate in
@@ -360,6 +352,13 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     */
    public String dataDir;

    /**
     * Full path to the directory where native JNI libraries are stored.
     * 
     * {@hide}
     */
    public String nativeLibraryDir;

    /**
     * The kernel user-ID that has been assigned to this application;
     * currently this is not a unique ID (multiple applications can have
@@ -452,6 +451,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        flags = orig.flags;
        sourceDir = orig.sourceDir;
        publicSourceDir = orig.publicSourceDir;
        nativeLibraryDir = orig.nativeLibraryDir;
        resourceDirs = orig.resourceDirs;
        sharedLibraryFiles = orig.sharedLibraryFiles;
        dataDir = orig.dataDir;
@@ -483,6 +483,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        dest.writeInt(flags);
        dest.writeString(sourceDir);
        dest.writeString(publicSourceDir);
        dest.writeString(nativeLibraryDir);
        dest.writeStringArray(resourceDirs);
        dest.writeStringArray(sharedLibraryFiles);
        dest.writeString(dataDir);
@@ -514,6 +515,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        flags = source.readInt();
        sourceDir = source.readString();
        publicSourceDir = source.readString();
        nativeLibraryDir = source.readString();
        resourceDirs = source.readStringArray();
        sharedLibraryFiles = source.readStringArray();
        dataDir = source.readString();
+11 −1
Original line number Diff line number Diff line
@@ -51,6 +51,13 @@ public class InstrumentationInfo extends PackageItemInfo implements Parcelable {
     */
    public String dataDir;

    /**
     * Full path to the directory where the native JNI libraries are stored.
     * 
     * {@hide}
     */
    public String nativeLibraryDir;

    /**
     * Specifies whether or not this instrumentation will handle profiling.
     */
@@ -68,6 +75,7 @@ public class InstrumentationInfo extends PackageItemInfo implements Parcelable {
        sourceDir = orig.sourceDir;
        publicSourceDir = orig.publicSourceDir;
        dataDir = orig.dataDir;
        nativeLibraryDir = orig.nativeLibraryDir;
        handleProfiling = orig.handleProfiling;
        functionalTest = orig.functionalTest;
    }
@@ -88,6 +96,7 @@ public class InstrumentationInfo extends PackageItemInfo implements Parcelable {
        dest.writeString(sourceDir);
        dest.writeString(publicSourceDir);
        dest.writeString(dataDir);
        dest.writeString(nativeLibraryDir);
        dest.writeInt((handleProfiling == false) ? 0 : 1);
        dest.writeInt((functionalTest == false) ? 0 : 1);
    }
@@ -108,6 +117,7 @@ public class InstrumentationInfo extends PackageItemInfo implements Parcelable {
        sourceDir = source.readString();
        publicSourceDir = source.readString();
        dataDir = source.readString();
        nativeLibraryDir = source.readString();
        handleProfiling = source.readInt() != 0;
        functionalTest = source.readInt() != 0;
    }
Loading