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

Commit 8056e413 authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Reset class loader after updating instrumentation paths"

parents f31cced1 346296bd
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -4718,7 +4718,13 @@ public final class ActivityThread {
            mInstrumentedSplitAppDirs = data.info.getSplitAppDirs();
            mInstrumentedLibDir = data.info.getLibDir();

            ApplicationInfo instrApp = new ApplicationInfo();
            // The app context's info was created against this thread, but
            // the class loader may have already been loaded and cached with
            // outdated paths. Clear it so we can load it again using the
            // instrumentation paths.
            data.info.clearClassLoader();

            final ApplicationInfo instrApp = new ApplicationInfo();
            instrApp.packageName = ii.packageName;
            instrApp.sourceDir = ii.sourceDir;
            instrApp.publicSourceDir = ii.publicSourceDir;
@@ -4731,6 +4737,7 @@ public final class ActivityThread {
            ContextImpl instrContext = ContextImpl.createAppContext(this, pi);

            try {

                java.lang.ClassLoader cl = instrContext.getClassLoader();
                mInstrumentation = (Instrumentation)
                    cl.loadClass(data.instrumentationName.getClassName()).newInstance();
+7 −0
Original line number Diff line number Diff line
@@ -255,6 +255,13 @@ public final class LoadedApk {
        return ai.sharedLibraryFiles;
    }

    /** @hide */
    public void clearClassLoader() {
        synchronized (this) {
            mClassLoader = null;
        }
    }

    public ClassLoader getClassLoader() {
        synchronized (this) {
            if (mClassLoader != null) {