Skip to content

Commit

Permalink
Do not load libraries from base.apk implicitly
Browse files Browse the repository at this point in the history
Summary: Implicit dependency loading needs more work.

Reviewed By: adicatana

Differential Revision: D56475101

fbshipit-source-id: 5b76a4c1a6bcdff3d4f9c6715377e342755192ca
  • Loading branch information
michalgr authored and facebook-github-bot committed Apr 24, 2024
1 parent e9905f6 commit d9bd759
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,26 @@
import android.annotation.SuppressLint;
import android.content.Context;

public class DirectSplitSoSourceWithImplicitLoads extends DirectSplitSoSource
public class DirectSplitSoSourceLoadByName extends DirectSplitSoSource
implements RecoverableSoSource {
public DirectSplitSoSourceWithImplicitLoads(String splitName) {
public DirectSplitSoSourceLoadByName(String splitName) {
super(splitName);
}

@Override
@SuppressLint("MissingSoLoaderLibrary")
protected int loadLibraryImpl(String soName, int loadFlags) {
if ((loadFlags & LOAD_FLAG_ALLOW_IMPLICIT_PROVISION) != 0) {
return LOAD_RESULT_IMPLICITLY_PROVIDED;
}

System.loadLibrary(soName.substring(3, soName.length() - 3));
return LOAD_RESULT_LOADED;
}

@Override
public String getName() {
return "DirectSplitSoSourceWithImplicitLoads";
return "DirectSplitSoSourceLoadByName";
}

@Override
public SoSource recover(Context context) {
return new DirectSplitSoSourceWithStrictPathControl(mSplitName, mManifest, mLibs);
return new DirectSplitSoSourceLoadByPath(mSplitName, mManifest, mLibs);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import java.util.Set;
import javax.annotation.Nullable;

public class DirectSplitSoSourceWithStrictPathControl extends DirectSplitSoSource {
public DirectSplitSoSourceWithStrictPathControl(
public class DirectSplitSoSourceLoadByPath extends DirectSplitSoSource {
public DirectSplitSoSourceLoadByPath(
String splitName, @Nullable Manifest manifest, @Nullable Set<String> libs) {
super(splitName, manifest, libs);
}
Expand All @@ -35,6 +35,6 @@ protected int loadLibraryImpl(String soName, int loadFlags) {

@Override
public String getName() {
return "DirectSplitSoSourceWithStrictPathControl";
return "DirectSplitSoSourceLoadByPath";
}
}
2 changes: 1 addition & 1 deletion java/com/facebook/soloader/SoLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ private static void initSoSources(Context context, int flags) throws IOException
addSystemLoadWrapperSoSource(context, soSources);
} else if (isEnabledBaseApkSplitSource) {
addSystemLibSoSource(soSources);
soSources.add(0, new DirectSplitSoSourceWithImplicitLoads("base"));
soSources.add(0, new DirectSplitSoSourceLoadByName("base"));
} else {
addSystemLibSoSource(soSources);

Expand Down

0 comments on commit d9bd759

Please sign in to comment.