in java/com/facebook/soloader/SoLoader.java [274:329]
private static void initSoSources(Context context, int flags, String[] denyList)
throws IOException {
if (sSoSources != null) {
return;
}
sSoSourcesLock.writeLock().lock();
try {
sFlags = flags;
ArrayList<SoSource> soSources = new ArrayList<>();
AddSystemLibSoSource(soSources, denyList);
//
// We can only proceed forward if we have a Context. The prominent case
// where we don't have a Context is barebones dalvikvm instantiations. In
// that case, the caller is responsible for providing a correct LD_LIBRARY_PATH.
//
if (context != null) {
//
// Prepend our own SoSource for our own DSOs.
//
if ((flags & SOLOADER_ENABLE_EXOPACKAGE) != 0) {
sBackupSoSources = null;
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "adding exo package source: " + SO_STORE_NAME_MAIN);
}
soSources.add(0, new ExoSoSource(context, SO_STORE_NAME_MAIN));
} else {
if ((flags & SOLOADER_ENABLE_DIRECT_SOSOURCE) != 0) {
addDirectApkSoSource(context, soSources);
}
addApplicationSoSource(context, soSources, getApplicationSoSourceFlags());
AddBackupSoSource(context, soSources, ApkSoSource.PREFER_ANDROID_LIBS_DIRECTORY);
}
}
SoSource[] finalSoSources = soSources.toArray(new SoSource[soSources.size()]);
int prepareFlags = makePrepareFlags();
for (int i = finalSoSources.length; i-- > 0; ) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Preparing SO source: " + finalSoSources[i]);
}
finalSoSources[i].prepare(prepareFlags);
}
sSoSources = finalSoSources;
sSoSourcesVersion.getAndIncrement();
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "init finish: " + sSoSources.length + " SO sources prepared");
}
} finally {
sSoSourcesLock.writeLock().unlock();
}
}