MCPcopy Create free account
hub / github.com/facebook/SoLoader / initEnableConfig

Method initEnableConfig

java/com/facebook/soloader/SoLoader.java:347–377  ·  view source on GitHub ↗

Determine whether to enable soloader. @param context application context @return Whether SoLoader is enabled

(Context context)

Source from the content-addressed store, hash-verified

345 * @return Whether SoLoader is enabled
346 */
347 private static boolean initEnableConfig(Context context) {
348 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
349 return true;
350 }
351
352 if (SoLoader.externalSoMapping != null) {
353 // This case is used by React Native apps that use SoMerging in OSS.
354 // if the externalSoMapping has been provided, we don't need to check inside the Manifest
355 // if SoLoader is enabled or not.
356 return true;
357 }
358
359 final String name = "com.facebook.soloader.enabled";
360 Bundle metaData = null;
361 String packageName = null;
362 try {
363 packageName = context.getPackageName();
364 // Check whether manifest explicitly enables/disables SoLoader for its package
365 metaData =
366 context
367 .getPackageManager()
368 .getApplicationInfo(packageName, PackageManager.GET_META_DATA)
369 .metaData;
370 } catch (Exception e) {
371 // cannot happen, our package exists while app is running
372 LogUtil.w(TAG, "Unexpected issue with package manager (" + packageName + ")", e);
373 }
374
375 // Keep the fallback value as true for backward compatibility.
376 return (null == metaData || metaData.getBoolean(name, true));
377 }
378
379 private static void initSoSources(@Nullable Context context, int flags) throws IOException {
380 if (sSoSources != null) {

Callers 1

initMethod · 0.95

Calls 1

wMethod · 0.95

Tested by

no test coverage detected