Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions java/com/facebook/soloader/SoLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down