Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: xueqiushi <[email protected]>
  • Loading branch information
alhah committed Mar 19, 2019
1 parent 4a0ad08 commit a1c0e59
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.getkeepsafe.relinker;

import android.content.Context;
import android.os.Build;
import android.util.Log;

import com.getkeepsafe.relinker.elf.ElfParser;
Expand All @@ -30,6 +31,7 @@

public class ReLinkerInstance {
private static final String LIB_DIR = "lib";
private static final boolean DISABLE_VERSION = Build.VERSION.SDK_INT < Build.VERSION_CODES.M;

protected final Set<String> loadedLibraries = new HashSet<String>();
protected final ReLinker.LibraryLoader libraryLoader;
Expand Down Expand Up @@ -131,15 +133,21 @@ public void loadLibrary(final Context context,
throw new IllegalArgumentException("Given library is either null or empty");
}

String adaptiveVersion = version;
if (DISABLE_VERSION) {
force = true;
adaptiveVersion = null;
}

log("Beginning load of %s...", library);
if (listener == null) {
loadLibraryInternal(context, library, version);
loadLibraryInternal(context, library, adaptiveVersion);
} else {
new Thread(new Runnable() {
@Override
public void run() {
try {
loadLibraryInternal(context, library, version);
loadLibraryInternal(context, library, adaptiveVersion);
listener.success();
} catch (UnsatisfiedLinkError e) {
listener.failure(e);
Expand Down

0 comments on commit a1c0e59

Please sign in to comment.