[pm] drop non-APK paths from LoadedApk makePath

After the introduction of the uses-native-library tag,
sharedLibraryFiles might contain native library names such as
"lib_aion_buffer.so". The old method makePath in the LoadedApk class was
looking for APK paths under the assumption that all the paths in
sharedLibraryFiles are APK paths. Parsing on the results of makePaths
could lead to app crashes because the results are not valid APK paths.
This CL fixes that.

BUG: 190787130
Test: manual
Change-Id: I2b3d439f8edda7ef27e1106046cf8c0b88d755d9
This commit is contained in:
Songchun Fan
2021-06-22 11:16:51 -07:00
parent bea8152724
commit fece532bbf

View File

@@ -546,6 +546,10 @@ public final class LoadedApk {
if (aInfo.sharedLibraryFiles != null) {
int index = 0;
for (String lib : aInfo.sharedLibraryFiles) {
// sharedLibraryFiles might contain native shared libraries that are not APK paths.
if (!lib.endsWith(".apk")) {
continue;
}
if (!outSeenPaths.contains(lib) && !outZipPaths.contains(lib)) {
outZipPaths.add(index, lib);
index++;