Skip to content

Commit

Permalink
implement getLibraryPath on SystemLoadWrapperSoSource
Browse files Browse the repository at this point in the history
Summary: implement `getLibraryPath` on `SystemLoadWrapperSoSource` instead of return null.

Reviewed By: michalgr

Differential Revision: D59571452

fbshipit-source-id: 0c2916e7518a02a1905d4acc3bdc3f3409623f66
  • Loading branch information
simpleton authored and facebook-github-bot committed Jul 10, 2024
1 parent ac267a5 commit 06a9199
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions java/com/facebook/soloader/SystemLoadWrapperSoSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import android.annotation.SuppressLint;
import android.os.StrictMode;
import android.text.TextUtils;
import java.io.File;
import java.io.IOException;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -46,6 +47,28 @@ public File unpackLibrary(String soName) throws IOException {
return null;
}

@Override
@Nullable
public String getLibraryPath(String soName) throws IOException {
final String ldPaths = SysUtil.getClassLoaderLdLoadLibrary();
if (TextUtils.isEmpty(ldPaths)) {
return null;
}

for (String ldPath : ldPaths.split(":")) {
if (SysUtil.isDisabledExtractNativeLibs(SoLoader.sApplicationContext)
&& ldPath.contains(".apk!")) {
return ldPath + File.separator + soName;
} else {
File file = new File(ldPath, soName);
if (file.exists()) {
return file.getCanonicalPath();
}
}
}
return null;
}

@Override
public String getName() {
return "SystemLoadWrapperSoSource";
Expand Down

0 comments on commit 06a9199

Please sign in to comment.