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

Commit 6e44c30f authored by dimitry's avatar dimitry
Browse files

Respect extractNativeLibs in natively bridged environments

The extractNativeLibs property was ignored by the package installer
for environments with native bridge. This is not neccessary since
native bridge implementations are required to support
open-directly-from-apk feature and in this respect are not different
from environments without native bridge.

Bug: http://b/116854266
Test: cts-tradefed run singleCommand cts --skip-preconditions -m CtsJniTestCases
Change-Id: I9ea7397183d7ebe2c00e461b95d188b15b51eca2
parent e35965e8
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -171,8 +171,7 @@ public class NativeLibraryHelper {
            boolean debuggable);

    private native static int nativeCopyNativeBinaries(long handle, String sharedLibraryPath,
            String abiToCopy, boolean extractNativeLibs, boolean hasNativeBridge,
            boolean debuggable);
            String abiToCopy, boolean extractNativeLibs, boolean debuggable);

    private static long sumNativeBinaries(Handle handle, String abi) {
        long sum = 0;
@@ -193,7 +192,7 @@ public class NativeLibraryHelper {
    public static int copyNativeBinaries(Handle handle, File sharedLibraryDir, String abi) {
        for (long apkHandle : handle.apkHandles) {
            int res = nativeCopyNativeBinaries(apkHandle, sharedLibraryDir.getPath(), abi,
                    handle.extractNativeLibs, HAS_NATIVE_BRIDGE, handle.debuggable);
                    handle.extractNativeLibs, handle.debuggable);
            if (res != INSTALL_SUCCEEDED) {
                return res;
            }
@@ -448,9 +447,6 @@ public class NativeLibraryHelper {
    // We don't care about the other return values for now.
    private static final int BITCODE_PRESENT = 1;

    private static final boolean HAS_NATIVE_BRIDGE =
            !"0".equals(SystemProperties.get("ro.dalvik.vm.native.bridge", "0"));

    private static native int hasRenderscriptBitcode(long apkHandle);

    public static boolean hasRenderscriptBitcode(Handle handle) throws IOException {
+4 −7
Original line number Diff line number Diff line
@@ -176,7 +176,6 @@ copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntr
    void** args = reinterpret_cast<void**>(arg);
    jstring* javaNativeLibPath = (jstring*) args[0];
    jboolean extractNativeLibs = *(jboolean*) args[1];
    jboolean hasNativeBridge = *(jboolean*) args[2];

    ScopedUtfChars nativeLibPath(env, *javaNativeLibPath);

@@ -206,10 +205,8 @@ copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntr
            return INSTALL_FAILED_INVALID_APK;
        }

        if (!hasNativeBridge) {
        return INSTALL_SUCCEEDED;
    }
    }

    // Build local file path
    const size_t fileNameLen = strlen(fileName);
@@ -489,9 +486,9 @@ static int findSupportedAbi(JNIEnv *env, jlong apkHandle, jobjectArray supported
static jint
com_android_internal_content_NativeLibraryHelper_copyNativeBinaries(JNIEnv *env, jclass clazz,
        jlong apkHandle, jstring javaNativeLibPath, jstring javaCpuAbi,
        jboolean extractNativeLibs, jboolean hasNativeBridge, jboolean debuggable)
        jboolean extractNativeLibs, jboolean debuggable)
{
    void* args[] = { &javaNativeLibPath, &extractNativeLibs, &hasNativeBridge };
    void* args[] = { &javaNativeLibPath, &extractNativeLibs };
    return (jint) iterateOverNativeFiles(env, apkHandle, javaCpuAbi, debuggable,
            copyFileIfChanged, reinterpret_cast<void*>(args));
}
@@ -597,7 +594,7 @@ static const JNINativeMethod gMethods[] = {
            "(J)V",
            (void *)com_android_internal_content_NativeLibraryHelper_close},
    {"nativeCopyNativeBinaries",
            "(JLjava/lang/String;Ljava/lang/String;ZZZ)I",
            "(JLjava/lang/String;Ljava/lang/String;ZZ)I",
            (void *)com_android_internal_content_NativeLibraryHelper_copyNativeBinaries},
    {"nativeSumNativeBinaries",
            "(JLjava/lang/String;Z)J",