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

Commit a1adde77 authored by Jiyong Park's avatar Jiyong Park Committed by Android (Google) Code Review
Browse files

Merge "NativeActivity (hasCode="false") can use native shared libs" into main

parents 1484e08b a326a5d2
Loading
Loading
Loading
Loading
+17 −13
Original line number Diff line number Diff line
@@ -969,6 +969,15 @@ public final class LoadedApk {
            }
        }

        List<String> nativeSharedLibraries = new ArrayList<>();
        if (mApplicationInfo.sharedLibraryInfos != null) {
            for (SharedLibraryInfo info : mApplicationInfo.sharedLibraryInfos) {
                if (info.isNative()) {
                    nativeSharedLibraries.add(info.getName());
                }
            }
        }

        // If we're not asked to include code, we construct a classloader that has
        // no code path included. We still need to set up the library search paths
        // and permitted path because NativeActivity relies on it (it attempts to
@@ -977,10 +986,14 @@ public final class LoadedApk {
        if (!mIncludeCode) {
            if (mDefaultClassLoader == null) {
                StrictMode.ThreadPolicy oldPolicy = allowThreadDiskReads();
                mDefaultClassLoader = ApplicationLoaders.getDefault().getClassLoader(
                mDefaultClassLoader = ApplicationLoaders.getDefault()
                        .getClassLoaderWithSharedLibraries(
                                "" /* codePath */, mApplicationInfo.targetSdkVersion, isBundledApp,
                                librarySearchPath, libraryPermittedPath, mBaseClassLoader,
                        null /* classLoaderName */);
                                null /* classLoaderName */,
                                null /* sharedLibraries */,
                                nativeSharedLibraries,
                                null /* sharedLibrariesLoadedAfterApp */);
                setThreadPolicy(oldPolicy);
                mAppComponentFactory = AppComponentFactory.DEFAULT;
            }
@@ -1030,15 +1043,6 @@ public final class LoadedApk {
                    createSharedLibrariesLoaders(mApplicationInfo.sharedLibraryInfos, isBundledApp,
                            librarySearchPath, libraryPermittedPath);

            List<String> nativeSharedLibraries = new ArrayList<>();
            if (mApplicationInfo.sharedLibraryInfos != null) {
                for (SharedLibraryInfo info : mApplicationInfo.sharedLibraryInfos) {
                    if (info.isNative()) {
                        nativeSharedLibraries.add(info.getName());
                    }
                }
            }

            mDefaultClassLoader = ApplicationLoaders.getDefault().getClassLoaderWithSharedLibraries(
                    zip, mApplicationInfo.targetSdkVersion, isBundledApp, librarySearchPath,
                    libraryPermittedPath, mBaseClassLoader,