Skip to content

Commit

Permalink
conditionally enable DirectSplitSoSource for base apk
Browse files Browse the repository at this point in the history
Summary: Add a new SoLoader.init flag and set it conditionally.

Reviewed By: adicatana

Differential Revision: D53181492

fbshipit-source-id: 29ac20aef14b8ae6067a67ef07691a444b03ca53
  • Loading branch information
michalgr authored and facebook-github-bot committed Jan 31, 2024
1 parent e2891a0 commit 3cb5c85
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions java/com/facebook/soloader/SoLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ public class SoLoader {
*/
public static final int SOLOADER_ENABLE_SYSTEMLOAD_WRAPPER_SOSOURCE = (1 << 9);

/** Experiment ONLY: skip custom SoSources for base.apk and rely on System.loadLibrary calls. */
public static final int SOLOADER_ENABLE_BASE_APK_SPLIT_SOURCE = (1 << 10);

@GuardedBy("sSoSourcesLock")
private static int sFlags;

Expand Down Expand Up @@ -344,8 +347,13 @@ private static void initSoSources(Context context, int flags) throws IOException
ArrayList<SoSource> soSources = new ArrayList<>();
final boolean isEnabledSystemLoadWrapper =
(flags & SOLOADER_ENABLE_SYSTEMLOAD_WRAPPER_SOSOURCE) != 0;
final boolean isEnabledBaseApkSplitSource =
(flags & SOLOADER_ENABLE_BASE_APK_SPLIT_SOURCE) != 0;
if (isEnabledSystemLoadWrapper) {
addSystemLoadWrapperSoSource(context, soSources);
} else if (isEnabledBaseApkSplitSource) {
addSystemLibSoSource(soSources);
soSources.add(0, new DirectSplitSoSource("base"));
} else {
addSystemLibSoSource(soSources);

Expand Down

0 comments on commit 3cb5c85

Please sign in to comment.