summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2019-03-08 16:32:07 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-03-08 16:32:07 +0000
commit30579cd80510da4834c707d437afb8677b3c78ee (patch)
tree49aa2423b0dee514899984fadffd6e848aec60a2
parentd5bd5f47a4b4c13e99fd6756642a22906bf6a6b5 (diff)
parent1aaae10e77b40c452d00a298ba6c0ba0ca54e1cd (diff)
Merge "Introduce ApplicationInfo.getAllApkPaths()."
-rw-r--r--core/java/android/content/pm/ApplicationInfo.java22
-rw-r--r--core/java/com/android/internal/os/Zygote.java13
2 files changed, 24 insertions, 11 deletions
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 4f09d5a21836..706cbbf560c5 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -43,6 +43,7 @@ import com.android.server.SystemConfig;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.text.Collator;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
@@ -2028,6 +2029,27 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
return this;
}
+ /**
+ * Return all the APK paths that may be required to load this application, including all
+ * splits, shared libraries, and resource overlays.
+ * @hide
+ */
+ public String[] getAllApkPaths() {
+ final String[][] inputLists = { splitSourceDirs, sharedLibraryFiles, resourceDirs };
+ final List<String> output = new ArrayList<>(10);
+ if (sourceDir != null) {
+ output.add(sourceDir);
+ }
+ for (String[] inputList : inputLists) {
+ if (inputList != null) {
+ for (String input : inputList) {
+ output.add(input);
+ }
+ }
+ }
+ return output.toArray(new String[output.size()]);
+ }
+
/** {@hide} */ public void setCodePath(String codePath) { scanSourceDir = codePath; }
/** {@hide} */ public void setBaseCodePath(String baseCodePath) { sourceDir = baseCodePath; }
/** {@hide} */ public void setSplitCodePaths(String[] splitCodePaths) { splitSourceDirs = splitCodePaths; }
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index 2bba3c914664..70d8b453f5ae 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -369,17 +369,8 @@ public final class Zygote {
* @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);
}
}