Fix Android native libs loading on apps deployed with 'mobile-install' #15361
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #13661 by specifying the full list of (parent) native libs location in Bazel's IncrementalClassLoader.
StubApplication (used by Bazel 'mobile-install') fails to load native library defined in incremental APK. Issue is fixed by specifying the full set of native libs pathes (obtained via reflection from parent classloader) directly into IncrementalClassLoader, so that classloader doesn't have to iterate through its parent chain to find the native library. Iterating through parent (which is what #14965 does - thank you to @Bencodes for this and the inspiration for the fix works in most cases, however it doesn't handled cases where native libs needs to load other native lids. In this case, dlopen() will fail since it can only look into IncrementalClassLoader() native libs path, and not parents.
This will crashes for instances with Android applications using flipper when they're deployed via 'mobile-install', in addition to any app that relies on native libs deployed that way.