Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Fixed Issue 197. #203

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ android:

# Specify at least one system image,
# if you need to run emulator(s) during your tests
- sys-img-x86_64-android-19
- sys-img-x86-android-23
# - sys-img-armeabi-v7a-android-19
# - sys-img-x86-android-17
# TODO: Configure travis to run in more than one emulator
Expand All @@ -40,7 +40,7 @@ before_install:
# Building .AAR, needed for instrumentation tests (they depend on the prebuilt_aar)
- ./gradlew build --no-daemon
# Emulator Management: Create, Start and Wait
- echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
- echo no | android create avd --force -n test -t android-23 --abi armeabi-v7a
- emulator -avd test -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ if (!project.hasProperty('sonatypeRepo') ||
apply plugin: 'maven'
apply plugin: 'signing'

version = "2.0.2"
version = "2.0.3"
group = "com.facebook.conceal"

signing {
Expand Down
29 changes: 20 additions & 9 deletions first-party/soloader/SoLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,21 +257,26 @@ private static synchronized void initSoLoader(@Nullable SoFileLoader soFileLoade
sSoFileLoader = new SoFileLoader() {
@Override
public void load(final String pathToSoFile, final int loadFlags) {
String error = null;
if (hasNativeLoadMethod) {
final boolean inZip = (loadFlags & SOLOADER_LOOK_IN_ZIP) == SOLOADER_LOOK_IN_ZIP;
final String path = inZip ? localLdLibraryPath : localLdLibraryPathNoZips;
try {
synchronized (runtime) {
String error = (String)nativeLoadRuntimeMethod.invoke(
runtime,
pathToSoFile,
SoLoader.class.getClassLoader(),
path);
error =
// the third argument of nativeLoad method was removed in Android P API
Build.VERSION.SDK_INT <= 27
? (String)
nativeLoadRuntimeMethod.invoke(
runtime, pathToSoFile, SoLoader.class.getClassLoader(), path)
: (String)
nativeLoadRuntimeMethod.invoke(
runtime, pathToSoFile, SoLoader.class.getClassLoader());
if (error != null) {
throw new UnsatisfiedLinkError(error);
}
}
} catch (IllegalAccessException
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException e) {
final String errMsg = "Error: Cannot load " + pathToSoFile;
Expand All @@ -292,9 +297,15 @@ private static Method getNativeLoadRuntimeMethod() {
}

try {
final Method method =
Runtime.class
.getDeclaredMethod("nativeLoad", String.class, ClassLoader.class, String.class);
final Method method;
if (Build.VERSION.SDK_INT <= 27) {
method =
Runtime.class.getDeclaredMethod(
"nativeLoad", String.class, ClassLoader.class, String.class);
} else {
method = Runtime.class.getDeclaredMethod("nativeLoad", String.class, ClassLoader.class);
}

method.setAccessible(true);
return method;
} catch (final NoSuchMethodException | SecurityException e) {
Expand Down