Frameworks/base: Early init native bridge
Add the app directory to the arguments for starting a process.
Add a check for NeedsNativeBridge and a call to PreInitializeBridge
in the native fork code.
Change-Id: I0b93da93251c6b4638de786bf98cf99df07c3fc2
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 7bedfc1..0bcc20b 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -457,6 +457,7 @@
* @param seInfo null-ok SELinux information for the new process.
* @param abi non-null the ABI this app should be started with.
* @param instructionSet null-ok the instruction set to use.
+ * @param appDataDir null-ok the data directory of the app.
* @param zygoteArgs Additional arguments to supply to the zygote process.
*
* @return An object that describes the result of the attempt to start the process.
@@ -472,11 +473,12 @@
String seInfo,
String abi,
String instructionSet,
+ String appDataDir,
String[] zygoteArgs) {
try {
return startViaZygote(processClass, niceName, uid, gid, gids,
debugFlags, mountExternal, targetSdkVersion, seInfo,
- abi, instructionSet, zygoteArgs);
+ abi, instructionSet, appDataDir, zygoteArgs);
} catch (ZygoteStartFailedEx ex) {
Log.e(LOG_TAG,
"Starting VM process through Zygote failed");
@@ -580,6 +582,7 @@
* @param seInfo null-ok SELinux information for the new process.
* @param abi the ABI the process should use.
* @param instructionSet null-ok the instruction set to use.
+ * @param appDataDir null-ok the data directory of the app.
* @param extraArgs Additional arguments to supply to the zygote process.
* @return An object that describes the result of the attempt to start the process.
* @throws ZygoteStartFailedEx if process start failed for any reason
@@ -593,6 +596,7 @@
String seInfo,
String abi,
String instructionSet,
+ String appDataDir,
String[] extraArgs)
throws ZygoteStartFailedEx {
synchronized(Process.class) {
@@ -656,6 +660,10 @@
argsForZygote.add("--instruction-set=" + instructionSet);
}
+ if (appDataDir != null) {
+ argsForZygote.add("--app-data-dir=" + appDataDir);
+ }
+
argsForZygote.add(processClass);
if (extraArgs != null) {