Skip to content

Commit

Permalink
Flag to resolve dependencies or not for UnpackingSoSources
Browse files Browse the repository at this point in the history
Reviewed By: michalgr

Differential Revision: D59752625

fbshipit-source-id: 2497fb9ac1c6813c5fefcf0b3bd0ad6267de38a9
  • Loading branch information
adicatana authored and facebook-github-bot committed Jul 22, 2024
1 parent e2c4af4 commit 1bfa749
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions java/com/facebook/soloader/SoLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ public class SoLoader {
/** Experiment ONLY: skip DSONotFound error recovery for back up so source */
public static final int SOLOADER_ENABLE_BACKUP_SOSOURCE_DSONOTFOUND_ERROR_RECOVERY = (1 << 11);

public static final int SOLOADER_IMPLICIT_DEPENDENCIES_TEST = (1 << 12);

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

Expand Down Expand Up @@ -389,7 +391,11 @@ private static void initSoSources(Context context, int flags) throws IOException
addDirectApkSoSource(context, soSources);
}
addApplicationSoSource(soSources, getApplicationSoSourceFlags());
addBackupSoSource(context, soSources);
addBackupSoSource(
context,
soSources,
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
&& (flags & SOLOADER_IMPLICIT_DEPENDENCIES_TEST) != 0);
}
}
}
Expand Down Expand Up @@ -472,13 +478,15 @@ private static void addApplicationSoSource(ArrayList<SoSource> soSources, int fl

/** Add the SoSources for recovering the dso if the file is corrupted or missed */
@SuppressLint("CatchGeneralException")
private static void addBackupSoSource(Context context, ArrayList<SoSource> soSources)
private static void addBackupSoSource(
Context context, ArrayList<SoSource> soSources, boolean implicitDependencies)
throws IOException {
if ((sFlags & SOLOADER_DISABLE_BACKUP_SOSOURCE) != 0) {
return;
}

BackupSoSource backupSoSource = new BackupSoSource(context, SO_STORE_NAME_MAIN);
BackupSoSource backupSoSource =
new BackupSoSource(context, SO_STORE_NAME_MAIN, !implicitDependencies);
soSources.add(0, backupSoSource);
}

Expand Down

0 comments on commit 1bfa749

Please sign in to comment.