From 686aaa0db8cdc58b6025fedfad2c46c7a83fd2c7 Mon Sep 17 00:00:00 2001 From: YOUNG CHA Date: Tue, 5 Mar 2019 17:26:15 +0900 Subject: [PATCH] Add workaround for houdini Bionic linker for houdini(ARM translation layer for Intel SoC) has same issue that cannot resolve dependencies of so files. So add DirectorySoSource.RESOLVE_DEPENDENCIES flag when create ApplicationSoSource instance Signed-off-by: YOUNG CHA --- java/com/facebook/soloader/SoLoader.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/java/com/facebook/soloader/SoLoader.java b/java/com/facebook/soloader/SoLoader.java index 9936997..87e09f1 100644 --- a/java/com/facebook/soloader/SoLoader.java +++ b/java/com/facebook/soloader/SoLoader.java @@ -23,9 +23,11 @@ import android.text.TextUtils; import android.util.Log; import dalvik.system.BaseDexClassLoader; +import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; @@ -257,6 +259,8 @@ private static void initSoSources(Context context, int flags, @Nullable SoFileLo if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1) { ourSoSourceFlags |= DirectorySoSource.RESOLVE_DEPENDENCIES; + } else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT && isHoudiniLoaded()) { + ourSoSourceFlags |= DirectorySoSource.RESOLVE_DEPENDENCIES; } sApplicationSoSource = new ApplicationSoSource(context, ourSoSourceFlags); @@ -864,6 +868,22 @@ public static boolean areSoSourcesAbisSupported() { } } + private static boolean isHoudiniLoaded() { + try { + BufferedReader br = new BufferedReader(new FileReader("/proc/" + + android.os.Process.myPid() + "/maps")); + String line = ""; + while ((line = br.readLine()) != null) { + if (line.contains("/system/lib/libhoudini.so")) { + return true; + } + } + } catch (Exception e) { + // ignore silently + } + return false; + } + @DoNotOptimize @TargetApi(14) private static class Api14Utils {