From fece532bbff58db6539c116da3c650c356365301 Mon Sep 17 00:00:00 2001 From: Songchun Fan Date: Tue, 22 Jun 2021 11:16:51 -0700 Subject: [PATCH] [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 --- core/java/android/app/LoadedApk.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java index 62b5ec8723208..d28a4533814fa 100644 --- a/core/java/android/app/LoadedApk.java +++ b/core/java/android/app/LoadedApk.java @@ -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++;