Frameworks/base: Add native bridge post-fork initialization

Change-Id: I5a20de1cb68dd1802937b369b14c50c9c1031c67
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 0cdddba..bfbeca1 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -402,7 +402,8 @@
                                      jlong permittedCapabilities, jlong effectiveCapabilities,
                                      jint mount_external,
                                      jstring java_se_info, jstring java_se_name,
-                                     bool is_system_server, jintArray fdsToClose) {
+                                     bool is_system_server, jintArray fdsToClose,
+                                     jstring instructionSet) {
   SetSigChldHandler();
 
   pid_t pid = fork();
@@ -505,7 +506,8 @@
 
     UnsetSigChldHandler();
 
-    env->CallStaticVoidMethod(gZygoteClass, gCallPostForkChildHooks, debug_flags);
+    env->CallStaticVoidMethod(gZygoteClass, gCallPostForkChildHooks, debug_flags,
+                              is_system_server ? NULL : instructionSet);
     if (env->ExceptionCheck()) {
       ALOGE("Error calling post fork hooks.");
       RuntimeAbort(env);
@@ -523,9 +525,9 @@
         JNIEnv* env, jclass, jint uid, jint gid, jintArray gids,
         jint debug_flags, jobjectArray rlimits,
         jint mount_external, jstring se_info, jstring se_name,
-        jintArray fdsToClose) {
+        jintArray fdsToClose, jstring instructionSet) {
     return ForkAndSpecializeCommon(env, uid, gid, gids, debug_flags,
-            rlimits, 0, 0, mount_external, se_info, se_name, false, fdsToClose);
+            rlimits, 0, 0, mount_external, se_info, se_name, false, fdsToClose, instructionSet);
 }
 
 static jint com_android_internal_os_Zygote_nativeForkSystemServer(
@@ -535,7 +537,7 @@
   pid_t pid = ForkAndSpecializeCommon(env, uid, gid, gids,
                                       debug_flags, rlimits,
                                       permittedCapabilities, effectiveCapabilities,
-                                      MOUNT_EXTERNAL_NONE, NULL, NULL, true, NULL);
+                                      MOUNT_EXTERNAL_NONE, NULL, NULL, true, NULL, NULL);
   if (pid > 0) {
       // The zygote process checks whether the child process has died or not.
       ALOGI("System server process %d has been created", pid);
@@ -553,7 +555,8 @@
 }
 
 static JNINativeMethod gMethods[] = {
-    { "nativeForkAndSpecialize", "(II[II[[IILjava/lang/String;Ljava/lang/String;[I)I",
+    { "nativeForkAndSpecialize",
+      "(II[II[[IILjava/lang/String;Ljava/lang/String;[ILjava/lang/String;)I",
       (void *) com_android_internal_os_Zygote_nativeForkAndSpecialize },
     { "nativeForkSystemServer", "(II[II[[IJJ)I",
       (void *) com_android_internal_os_Zygote_nativeForkSystemServer }
@@ -564,7 +567,8 @@
   if (gZygoteClass == NULL) {
     RuntimeAbort(env);
   }
-  gCallPostForkChildHooks = env->GetStaticMethodID(gZygoteClass, "callPostForkChildHooks", "(I)V");
+  gCallPostForkChildHooks = env->GetStaticMethodID(gZygoteClass, "callPostForkChildHooks",
+                                                   "(ILjava/lang/String;)V");
 
   return AndroidRuntime::registerNativeMethods(env, "com/android/internal/os/Zygote",
       gMethods, NELEM(gMethods));