Introduce ApplicationInfo.getAllApkPaths().

Add an internal method to ApplicationInfo to get all APK files that may
be required by an application. This moves assumptions about how apps are
constructed out of Zygote.allowAppFilesAcrossFork and into a more
appropriate place where it can be shared.

Bug: 124116212
Test: atest android.webkit.cts.WebViewTest
Change-Id: I79add98c4922c4f97263bff78cf808bc38274755
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index 2bba3c9..70d8b45 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -369,17 +369,8 @@
      * @param appInfo ApplicationInfo of the application
      */
     protected static void allowAppFilesAcrossFork(ApplicationInfo appInfo) {
-        Zygote.nativeAllowFileAcrossFork(appInfo.sourceDir);
-        if (appInfo.splitSourceDirs != null) {
-            for (String path : appInfo.splitSourceDirs) {
-                Zygote.nativeAllowFileAcrossFork(path);
-            }
-        }
-        // As well as its shared libs
-        if (appInfo.sharedLibraryFiles != null) {
-            for (String path : appInfo.sharedLibraryFiles) {
-                Zygote.nativeAllowFileAcrossFork(path);
-            }
+        for (String path : appInfo.getAllApkPaths()) {
+            Zygote.nativeAllowFileAcrossFork(path);
         }
     }