History log of /frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
634fb404d3e4a92c2ef669a3b14b234c7968cdfd 28-Mar-2018 Victor Hsieh <victorhsieh@google.com> Fix seccomp filter set up in zygote

This needs to land with extra syscalls whitelisted, including capset and
setresuid. These privileged syscalls are used in the setup after the
filter is initialized.

Test: system starts, different apps run
Bug: 63944145
Bug: 76461821
Change-Id: I49e6b292805f35baffb3530461c8741e75aceb32
Merged-In: I49e6b292805f35baffb3530461c8741e75aceb32
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
9d66fa0460a29800ef8d273e84b2510df03c55b6 19-Mar-2018 Torne (Richard Coles) <torne@google.com> Don't try to create a process group when not root.

The WebView zygote doesn't run with uid 0 and so can't create a process
group, since the directory in the cgroupfs is only writable by root.
Skip this when the zygote isn't running with uid 0 to avoid the error
being printed, as this causes misattribution of bugs.

Bug: 62435375
Test: use WebView, check log
Change-Id: I50164bba5ac7587933d58ca0595336ba4fe33728
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
c362a44c679fc19ea55765b317269a51f67deb42 12-Mar-2018 Andreas Gampe <agampe@google.com> Frameworks: Refactor FileDescriptorTable errors

Surface error messages to the caller.

(cherry picked from commit 183a5d3cfa6bcdc817dfe6e5512fb6912bb44583)

Bug: 74531335
Test: m
Test: Device boots
Merged-In: I14df050feb7f5417bb08d190492c3050cdbb1c1d
Change-Id: I14df050feb7f5417bb08d190492c3050cdbb1c1d
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
5f35c4e2149800a2c1bdf2288b7c462428989edb 12-Mar-2018 Andreas Gampe <agampe@google.com> Frameworks: Add app name to zygote abort

If possible, add the target process name to the zygote abort.

(cherry picked from commit bf94c2c1d789cbe0be77a70536dc08d6f0bd7e5c)

Bug: 74531335
Test: m
Test: Device boots
Test: Manual - fake a failure
Merged-In: I55c30f78246876fdc1b822056351dbbb14c1247e
Change-Id: I55c30f78246876fdc1b822056351dbbb14c1247e
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
d5758f63f1e9ae38cbb488b94c2825c874c11f1f 12-Mar-2018 Andreas Gampe <agampe@google.com> Frameworks: Refactor zygote abort code

Fail in the main fork function. This will simplify follow-ups that
will include more data in the abort.

(cherry picked from commit b8aae1969c6b8f9ac420745166edcd6c9fe59717)

Bug: 74531335
Test: m
Test: Device boots
Merged-In: I269eae0fb15e96fb27d02d4b7c6fdf7e9e8e3346
Change-Id: I269eae0fb15e96fb27d02d4b7c6fdf7e9e8e3346
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
041483acea898088c4ff30e32d21f4e9d57b40a0 05-Mar-2018 Andreas Gampe <agampe@google.com> Zygote: Set libbase default tag on fork

When forking, set the default tag to the process name, so that
non-tagged logging (like ART's) get tagged accordingly.

(cherry picked from commit 396139749c42ee486c9c55e62eb75f340a9a0e90)

Bug: 34867873
Test: m
Merged-In: I81d526c8f5af0fde488cdf8efd1835298ff501fc
Change-Id: I81d526c8f5af0fde488cdf8efd1835298ff501fc
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
c0276a54ec20d83d0aa662c610ff5d24bc75fd33 17-Feb-2018 Robert Sesek <rsesek@google.com> Merge "Add Zygote.startChildZygote() to fork a new process that itself is a zygote." am: 554cfd1f1d am: 5b9410c74b
am: 4523bf284a

Change-Id: Ib714e447f06323d38c98de683f5547e66749856e
d0a190df8a04e10a6705148c02c5c4859ad75b70 13-Feb-2018 Robert Sesek <rsesek@google.com> Add Zygote.startChildZygote() to fork a new process that itself is a zygote.

This adds a new --start-child-zygote argument that instructs the main
zygote to create a new child process that will also be a zygote. The
system_server generates a random name in the abstract socket namespace
for it and the child-zygote to communicate over, and that is passed as
an argument to the new process.

A child-zygote bypasses the normal post-fork-child of the zygote process
in order to preserve itself as a zygote. This means not starting the
Binder threadpool nor launching into ActivityThread. Instead, a
child-zygote calls into its own main function. The main function runs a
ZygoteServer select loop, listening on the socket name specified by the
system_server when it was forked.

Unlike the system zygotes, a child-zygote can be killed without bringing
down the system. Killing a child-zygote will not terminate its child
processes, which will be reparented to init for reaping when they
eventually exit.

Bug: 63749735
Test: m (with multi-project commits landed)
Change-Id: I3e7ebbdba498f8fec1d84cdf927dc43a92be4b68
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
4878292b1b57edb69820e487c6a62a1095be4855 31-Jan-2018 hansson <hansson@google.com> Merge "Fix "zygote is killed by signal 1"" am: 2372af9cd8 am: 476b746360
am: ebadd8ac5a

Change-Id: I7840838d85406da4ba0dcff336d2a8647d71e4a8
435e84b9fcaf129dbd0d9f8c86c3ead5c51e9405 15-Jan-2018 yuanhao <yuanhao@xiaomi.com> Fix "zygote is killed by signal 1"

Ignore the signal SIGHUP in Zygote and all its forks.

Bug:71965619
Test: manual

Change-Id: I7987bb044d97ae21ec27beca6e9aefcbe77197f5
Signed-off-by: yuanhao <yuanhao@xiaomi.com>
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
217682248b25b375891bb55ca058a09b57c3417c 18-Jan-2018 Victor Hsieh <victorhsieh@google.com> Merge "Reland: Move zygote's seccomp setup to post-fork" am: 7839672e22 am: 4249466562
am: dec688691d

Change-Id: Ibcf5eeef74b69112f568ebb1f146c2990ffed30a
c8176efe2e2dc3aadc69c32b6aa9180751778e8f 08-Jan-2018 Victor Hsieh <victorhsieh@google.com> Reland: Move zygote's seccomp setup to post-fork

Before this change, seccomp filter setup is as early as in zygote's main
function. To make it possible to split app and system server's filter,
this postpone the setup to after fork. It also starts to call app
specific and system server specific setup function.

The filter setup is done in Zygote's ForkAndSpecializeCommon. This is
because adding a seccomp filter must be done when either the caller has
CAP_SYS_ADMIN or after the PR_SET_NO_NEW_PRIVS bit is set. Given that
setting PR_SET_NO_NEW_PRIVS breaks SELinux domain transition
(b/71859146), this must be done after Zygote forks but before
CAP_SYS_ADMIN is droppped.

Test: (cts) -m CtsSecurityTestCases -t android.security.cts.SeccompTest
Test: no selinux denial flood in dmesg with selinux enforced
Test: debuggerd -b `pidof com.android.phone` # logcat shows tombstoned
received crash request
Bug: 63944145
Bug: 71859146

Change-Id: I8215c8530d3d0de504a270488f8e29635805e8b0
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
6bdc3a28e75bdb936e7c172bc8d305b2c30c9f06 23-Nov-2017 Jeff Vander Stoep <jeffv@google.com> Check for /dev/memcg/system/tasks before writing to it

Fixes the following errors in the logs on devices without /dev/memcg
mounted:

09-08 10:07:22.991 732 732 E Zygote : couldn't write 1124 to
/dev/memcg/system/tasks
09-08 10:07:22.986 732 732 W main : type=1400 audit(0.0:8):
avc: denied { create } for name="tasks" scontext=u:r:zygote:s0
tcontext=u:object_r:cgroup:s0 tclass=file permissive=0

Bug: 67860826
Test: boot Taimen, no more error/denial in the logs.
Change-Id: I37f481fa4e9e9116688cca4f090aa26f96f602c9
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
8f4eab2fccbc333604f1d248dac9a736db96bc6b 14-Sep-2017 Andreas Gampe <agampe@google.com> resolve merge conflicts of eb8a4ef5d344 to oc-mr1-dev-plus-aosp

Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ia29e31d704982985264b40a78578a4c93d11bf3a
81edac40374b1d3203f7adac32e299147db7eba2 07-Sep-2017 Nicolas Geoffray <ngeoffray@google.com> Rename debugFlags to runtimeFlags.

Also now pass the flags to the forked process through --runtime-flags instead
of converting to command line arguments and converting back to an integer.

bug: 30972906
bug: 63920015

Test: builds

Change-Id: I7f10c43dd916ca2d3b9b5141f17261eb7b64f49a
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
e154c72e85decf02cba41fcbf9fba5fa79d46517 30-Aug-2017 Carmen Jackson <carmenjackson@google.com> Merge "Added system_server to system group" into oc-mr1-dev
am: 22d055566a

Change-Id: I0b6deacd471b2a6c082cb2cc916e8ee577045c9e
dd401253bc924d28099e1454e20d76f701aa8a45 24-Feb-2017 Carmen Jackson <carmenjackson@google.com> Added system_server to system group

Test: on gobo
pidof system_server appears in the correct file:
$ adb shell pidof system_server
859
$ adb shell cat /dev/memcg/system/tasks | grep '859'
859

Bug: 65130832
Change-Id: Id63abd473a7f2001688b0be06bfec6472c7f8648
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
586fd52b3411edb97fa1a468103d7cb2b38d6be9 16-Aug-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "Improve container capability bounding in containers"
72042c99a65b91fb701f1b13a0ba4b225769eece 12-Jul-2017 Luis Hector Chavez <lhchavez@google.com> Improve container capability bounding in containers

This change stops relying on the ro.boot.container property for dropping
a subset of capabilities and instead relies on the effective capability
mask of the Zygote process, prior to forking.

When Android is running in a pid/mount/net/user namespace, even if a
particular capability is present, some operations that require that
capability check whether it is allowed in the init namespace (instead of
in the current namespace), so they would fail even with the capability
granted within the namespace. So, explicitly dropping the capabilities
from the beginning allows for clearer signalling of which operations can
be expected to work instead of failing silently for mysterious reasons.

Bug: 63579953
Test: aosp_bullhead-eng still boots
Test: Running Zygote without CAP_SYS_MODULE makes it such that
system_server does not request it.

Change-Id: I1d18d13341bcc04e701fd14092e7e94961728620
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
b14694b043e3a6fbc342bc0a2d99437365cd290b 02-Aug-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "zygote: always log process exit reason."
6d747cacae4f3c39d9360b62aca4ecf01b180727 02-Aug-2017 Josh Gao <jmgao@google.com> zygote: always log process exit reason.

Multiple people have run into problems where apps disappear without a
trace. Always log process exit, so that it's clear when a process is
intentionally exiting. (The amount of extraneous logging this generates
is probably minimal.)

Test: none
Change-Id: I77169da4d0f05dabfe38490757975ad7ad0247b2
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
2279b2534272282a5b5152723235da397e49195c 19-Jul-2017 Steven Moreland <smoreland@google.com> frameworks/base: use proper nativehelper headers

libnativehelper exports headers under nativehelper. These were
available before incorrectly as global headers in order to give
access to jni.h.

Test: modules using frameworks/base find headers
Bug: 63762847
Change-Id: I0f9f231acdebe460f279135462f43d3e32eff64d
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
76de39e5eb158cdc62e6f4a4800ce7f9bc2f2a25 21-Jun-2017 Christopher Ferris <cferris@google.com> Add a common call when wrapping an app.

When an application is wrapped using setprop wrap.<application>, it
doesn't set the special zygote flag, or make the mallopt call. This
means that a wrapped application will behave differently, and not
be able to track zygote native allocations versus app native allocations.

This CL adds a nativePreApplicationInit call that is used after the
Zygote is forked, and when a wrapped application is called.

Bug: 62068500

Test: Booted sailfish system. Verified that the zygote has not called
Test: the new function. Verified the function is called when a wrapper
Test: is used. Verified the function is called when the Zygote forks
Test: a process.
Change-Id: I392e1b5429be77def63f7815b072d68e9408cc7f
(cherry picked from commit 2980de4a59db048851fbbac9cd847a96a12fa4ec)
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
ab16dd10f148e1bd49e62ffd88d95bf6d39d5201 16-May-2017 Christopher Ferris <cferris@google.com> Set the decay timer for all forked apps.

This will cause native memory frees to be less expensive, but it will cost
a bit of PSS that might hang around.

Bug: 36401135

Test: Built and booted bullhead.
Test: Ran jemalloc unit tests.
Test: Ran bionic unit tests.
Test: Ran a test that allocated and free'd a large piece of memory,
Test: and verified that after changing the parameter, the PSS
Test: sticks around (decay timer set to 1), the PSS is purged (decay
Test: timer set to 0).
Change-Id: I140b26986f3f81fddd5b9ed9c9e4f2d4977b819b
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
0fabba396fe2ff0be864ea6c6a1ed8030ce5de7d 26-Apr-2017 Philip Cuadra <philipcuadra@google.com> Allow Bluetooth CAP_SYS_NICE

Bluetooth needs CAP_SYS_NICE in order to make important threads use RT
scheduling policy.

Bug 37518404

Test: Play Bluetooth audio, confirm RT priority in systrace
Change-Id: I388ef78d1aaf3f5fe1aa901b48d76c5c992acacc
Merged-In: I0ee55a2f2cfd80cbb066d9c034bb85d8d85ba470
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
8bafcfe81c1022fa9e54335cd810cefd8c3dcc55 01-Apr-2017 Robert Sesek <rsesek@google.com> Merge "In MountEmulatedStorage() do not try to mount for mode MOUNT_EXTERNAL_NONE."
am: c04b06dc81

Change-Id: I781b676d273738101a6aaf27d523c7b5d7d06596
06f393067772f613e938f794444dc90e90c40fc0 20-Mar-2017 Robert Sesek <rsesek@google.com> In MountEmulatedStorage() do not try to mount for mode MOUNT_EXTERNAL_NONE.

When creating an isolatedProcess=true service and when the native bridge
is in use, MountEmulatedStorage() is called with force_mount_namespace=true
and MOUNT_EXTERNAL_NONE. This led to an abort crash, since the process
would attempt to mount an empty path string.

Test: android.externalservice.cts.ExternalServiceTest built for ARM, run on Fugu
Bug: 36072260
Change-Id: I9441bcbd30167971ad486726bbeae57f3c4aebe9
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
55310df6bce616514d5958895c778f1c258b9b73 13-Mar-2017 Hiroshi Yamauchi <yamauchi@google.com> Merge "Fix the reset of boosted zygote thread priority."
am: 83aceea07d

Change-Id: I6ebd30a631ae10ada65b3279ec66c41d3f50fb1f
04ed6500833373b8a544f161113871e5dc5c867c 02-Mar-2017 Hiroshi Yamauchi <yamauchi@google.com> Fix the reset of boosted zygote thread priority.

This fixes the unexpected priority 112 of the daemon threads
(eg. HeapTaskDaemon). The problem was that when the zygote main
thread's priority is reset, it directly calls setpriority() and fails
to update the priority value in java.lang.Thread, which in turn causes
any threads created by the thread to unexpectedly inherit the boosted
priority. Calling java.lang.Thread.setPriority instead fixes.

(cherry picked from commit 1e3db871e52e59c69edb1843df7f4aecb030bc6f)

Bug: 35801778
Bug: 28866384
Test: angler master userdebug boots and thread priorities checked.

Change-Id: I68a6ed7244a9067acc2749feca7f88422bf44b02
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
6f372daa9d31fb6843a24fe12669a1f73e7ca8ab 06-Feb-2017 Josh Gao <jmgao@google.com> zygote: make all capabilities inheritable. am: 45dab78e98
am: 0f2a0b9908

Change-Id: I864b02533e461c332ad8c8e6c5b931a5dfa9485f
dc3f66c3bed62d4b7077372c78a08b7f39224a9f 06-Feb-2017 Josh Gao <jmgao@google.com> Revert "zygote: don't drop CAP_SYS_PTRACE from the bounding set." am: 0a2d61505a
am: c75e4153cf

Change-Id: Id936d8fde31c69ed04df81486f441244339a2065
45dab78e989a8e3f3cabb71ebc753e5a8fdcbcd6 01-Feb-2017 Josh Gao <jmgao@google.com> zygote: make all capabilities inheritable.

Set CapInh to the full set of permitted capabilities, so that the crash
handler can raise ambient capabilities to allow crash_dump to ptrace
zygote-descended children without needing CAP_SYS_PTRACE. CapInh is
restricted by filesystem capabilities if the ambient capability set
hasn't been raised, so this should only have an effect when ambient
capabilities are modified.

Bug: http://b/34853272
Test: debuggerd -b `pidof system_server`
Change-Id: I27d2aa4ab4fc47a183ce2b254be178de4d58840c
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
0a2d61505a26e4ce0ae6a12d32ba383a85a239e2 01-Feb-2017 Josh Gao <jmgao@google.com> Revert "zygote: don't drop CAP_SYS_PTRACE from the bounding set."

This reverts commit 59972218f8c0d397fc50400a2b8b9be92ceeaf93.

Bug: http://b/34853272
Test: debuggerd -b `pidof system_server`
Change-Id: I440932210b6e84647c2848bab2e082a58338fb1e
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
a07e5312ccc21dffbfeecee17e5c859e0cb952d1 25-Jan-2017 Josh Gao <jmgao@google.com> Merge "zygote: don't drop CAP_SYS_PTRACE from the bounding set." am: 273b886c49
am: e801810553

Change-Id: I636c0f021c6ffae4518d889b1e7c4c3c29c6e864
59972218f8c0d397fc50400a2b8b9be92ceeaf93 25-Jan-2017 Josh Gao <jmgao@google.com> zygote: don't drop CAP_SYS_PTRACE from the bounding set.

crash_dump needs to acquire CAP_SYS_PTRACE to be able to ptrace
processes with capabilities. selinux should hopefully be sufficient for
restricting ptrace to processes that should do it.

Bug: http://b/34694637
Test: debuggerd `pidof system_server`
Change-Id: If46f0b9baa54529780f7767f309f76b102a42ab4
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
e4cff360995579639d952576e8db137a6fe6d085 11-Jan-2017 Andreas Gampe <agampe@google.com> Merge "Zygote: Add fdsToIgnore" am: 5b22a826d5
am: 140b9b65a1

Change-Id: Ib4c46887ed5d87ef143bd866320d77b75d8711a3
8dfa178efbbb155657639bd526e9a8579fce3886 05-Jan-2017 Andreas Gampe <agampe@google.com> Zygote: Add fdsToIgnore

Add file descriptors that should be ignored in the file descriptor
table check.

Use this to ignore the pipe file descriptors when starting an app
with invoke-with (wrapper).

Bug: 32607405
Test: m
Test: Device boots
Test: Apps start
Test: adb root && adb shell setprop wrap.com.android.calculator2 logwrapper && adb shell am start -S -n com.android.calculator2/.Calculator
Change-Id: I4a30dfc9382d3172cc815bd41b17a123799354f6
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
df781cc5147c07f1d28b78806b3578a2ff571497 11-Jan-2017 Robert Sesek <rsesek@google.com> Dynamically add the webview_zygote's preloaded APK to the zygote FD whitelist. am: 54e387ddbe
am: 839a185b2e

Change-Id: I1e761ea737447b347f2542419d18d1f42b1b50db
024793713f9c0a715502e828ec4da3377ede3ac5 11-Jan-2017 Robert Sesek <rsesek@google.com> Split core/jni/fd_utils-inl.h into a .h/.cpp pair. am: 8225b7c951
am: 63a7fe6de8

Change-Id: I9148523bae8466e56cf00d7624c53c22318215f7
54e387ddbe6a0462bc8e9e15c7c7b3463adfcb24 02-Dec-2016 Robert Sesek <rsesek@google.com> Dynamically add the webview_zygote's preloaded APK to the zygote FD whitelist.

This refactors the whitelist to be a class, rather than just a static C array.
The whitelist can then be augmented dynamically when the package path is known
in the webview_zygote.

Test: m
Test: sailfish boots
Test: Enable Multi-process WebView in developer options, perform a search in GSA.

Bug: 21643067
Change-Id: Ia1f2535c7275b42b309631b4fe7859c30cbf7309
(cherry picked from commit 061ee3088a79ab0e07d37d1c0897d51422f29c4e)
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
8225b7c95185dfbfe67da105df4402430784393c 16-Dec-2016 Robert Sesek <rsesek@google.com> Split core/jni/fd_utils-inl.h into a .h/.cpp pair.

(cherry picked from commit 44afe8be8f654192dc436a9c4238a925c22b14bf)

Test: m
Test: sailfish boots

Change-Id: I9ca93f31f6c20b702b2207333a9d56f6592630b0
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
80fb0b0a4466c7b5d7eacd337b99a5ca53a840ac 07-Sep-2016 Todd Kjos <tkjos@google.com> Revert "Add boost to increase the load on newly-forked zygote processes."

This reverts commit 6d43a861d01ef48f37c69f96346a13d23164a585.

(cherry picked from commit 0f2ded62ae3d88ddb732df182c3bfee3e2729018)

Test: m
Test: Device boots
Change-Id: I627e47c6ead4ce2d2bffa923a32a56d06c022df7
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
5cbce85fd3e4796674f5e7b75face9f9bd8b66b1 19-May-2016 Vitalii Tomkiv <vitalit@google.com> Make sure Zygote is running at process priority 0 after VM has started.

Boosting up zygote priority before VM startup, saves ~450ms of boot time
for N9, 180ms for Nexus 5X.

(cherry picked from commit 5d551a5ac3d13706f62a86842ff6851e1d25213b)

Bug: 28866384
Test: m
Test: Device boots
Change-Id: Ic85892b408e15bbc1de7ce706f113f23974fe478
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
1e52ce48a6f2d98485d18585eb3452cab050ffb7 19-May-2016 Vitalii Tomkiv <vitalit@google.com> Make sure Zygote is running at process priority 0 after VM has started.

Boosting up zygote priority before VM startup, saves ~450ms of boot time
for N9, 180ms for Nexus 5X.

(cherry picked from commit 5d551a5ac3d13706f62a86842ff6851e1d25213b)

Bug: 28866384
Test: m
Test: Device boots
Change-Id: Ic85892b408e15bbc1de7ce706f113f23974fe478
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
8175f0955aed5bd7a3aa80ac6348bdecb46db915 07-Sep-2016 Todd Kjos <tkjos@google.com> Revert "Add boost to increase the load on newly-forked zygote processes."

This reverts commit 6d43a861d01ef48f37c69f96346a13d23164a585.

(cherry picked from commit 0f2ded62ae3d88ddb732df182c3bfee3e2729018)

Test: m
Test: Device boots
Change-Id: I627e47c6ead4ce2d2bffa923a32a56d06c022df7
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
b1df48d32632d0ba5a2389fb9fad2943dcb55562 23-Nov-2016 Baligh Uddin <baligh@google.com> Merge remote-tracking branch 'goog/cw-f-dev' into fix_merger

Bug: 32849428

* goog/cw-f-dev: (98 commits)
Revert "Catch KeyStoreException for setting profile lock"
Fix createConfirmDeviceCredentialIntent for wear for CTS.
Fix default dialog background colour for watch devices.
Catch KeyStoreException for setting profile lock
Add cross-links between FINE and COARSE location permissions. bug: 25371600
Fixed a bug with the emergency affordance in multi user
Zygote: Additional whitelists for runtime overlay / other static resources.
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Zygote : Block SIGCHLD during fork.
colors: add missing accent_material_{700,50} resources.
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Zygote : Block SIGCHLD during fork.
DO NOT MERGE ANYWHERE Revert "DO NOT MERGE ANYWHERE libhwui: make setSurface asynchronous"
...

Change-Id: I63468da5bfa21ed9ac5985bbdbf3a61d4c389aa0
a0d2e6f4b7c9f3375d89b11532cb8e6e09b5c13b 12-Nov-2016 Robert Sesek <rsesek@google.com> Merge "Respect force_mount_namespace in MountEmulatedStorage()."
am: b828b6bf6c

Change-Id: I9b4d0000c29d5e404f333d8e8c89af2425452a17
06af1c0ede225d269e0e2753cdb7a709120b9358 11-Nov-2016 Robert Sesek <rsesek@google.com> Respect force_mount_namespace in MountEmulatedStorage().

In Ieb75cc3009ed26b7366213409d5fad836f597084, the unshare step was
skipped if no storage is required. But the change failed to take the force
parameter into account

Test: m
Test: angler boots
Test: fugu boots

Bug: 21643067
Change-Id: I52447f02fd25f553628564733fd6bf2523c07f7c
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
ae06fba67ab03ffa7238a474680c8ee49a3d0551 11-Nov-2016 Robert Sesek <rsesek@google.com> Merge "In MountEmulatedStorage() don't create a mount namespace unless actually mounting."
am: c0aacbe513

Change-Id: I7199d687e2e67dd4672bcb388053c33db6b693f5
720fcbc1f78d21e42a263781ae36ef78e0a40e0d 10-Nov-2016 Narayan Kamath <narayan@google.com> Zygote : Block SIGCHLD during fork.
am: dfcc79ee8e

Change-Id: I64b380e54d73c777898ece33ba62b838b556921b
dfcc79ee8ecd4166cba19be7493c6175cb0c65a9 07-Nov-2016 Narayan Kamath <narayan@google.com> Zygote : Block SIGCHLD during fork.

We close the android logging related sockets prior as late as possible
before every fork to avoid having to whitelist them. If one of the
zygote's children dies after this point (but prior to the fork), we can
end up reopening the logging sockets from the SIGCHLD signal handler.

To prevent this from happening, block SIGCHLD during this critical
section.

Bug: 32693692
Test: Manual

(cherry picked from commit e9a525829a354c92983a35455ccab16d1b0d3892)

Zygote: Unblock SIGCHLD in the parent after fork.

Follow up to change e9a525829a354c92983a. Allows the zygote to
receive SIGCHLD again and prevents the zygote from getting into a
zombie state if it's killed.

Contributed-By: rhed_jao <rhed_jao@htc.com>
Bug: 32693692
Test: manual

(cherry picked from commit c7161f756e86b98f2244a04d9207b47149965fd7)

Change-Id: If89903a29c84dfc9b056f9e19618046874bba689
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
8a3a6ffa865ab21b0575eda782700c8920faf566 31-Oct-2016 Robert Sesek <rsesek@google.com> In MountEmulatedStorage() don't create a mount namespace unless actually mounting.

When the zygote starts, it creates its own mount namespace in
nativeUnmountStorageOnInit(). When the zygote forks a new process, unless the
new process actually has permission to access emulated storage (and thus it
needs to be mounted), there is no reason to create another new mount namespace
in the child.

This supports the WebView zygote, which does not have CAP_SYS_ADMIN to perform
mount operations. But since it only forks isolated_app processes, which do not
have access to storage, it does not need to handle mounting.

Test: m checkbuild
Test: angler boots

Bug: 21643067
Change-Id: Ieb75cc3009ed26b7366213409d5fad836f597084
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
1201509679cd65bfb5550c9a29cfb806a0b4e978 16-Sep-2016 Robert Sesek <rsesek@google.com> Move art::Runtime::InitZygote logic from art into frameworks/base. am: e4f8d69c58 am: c1b32fc3ea
am: 5189f86a36

Change-Id: I495848744c205295d18211c977b64f3a437ec27a
5189f86a36fea36352b7d407093b3c5e92a7aeb5 16-Sep-2016 Robert Sesek <rsesek@google.com> Move art::Runtime::InitZygote logic from art into frameworks/base. am: e4f8d69c58
am: c1b32fc3ea

Change-Id: Ifae90057835b576ca001a141cb56aa4e4f9ba321
e4f8d69c58e3e0a54b1434d64217d30e8d448864 14-Sep-2016 Robert Sesek <rsesek@google.com> Move art::Runtime::InitZygote logic from art into frameworks/base.

Test: m
Test: aosp_angler-eng boots
Change-Id: I964c70576136e7424797140b2f7d179e70298c44
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
abd5b05190e00660ecb88dc551aac1af613b2921 08-Sep-2016 Narayan Kamath <narayan@google.com> Backport changes to whitelist sockets opened by the zygote.
am: a1252ccbdb

Change-Id: Idd41ba2068102de067a66080da0563cf75b1e433
a1252ccbdbae686cb41e7efba769c4935f664220 19-Aug-2016 Narayan Kamath <narayan@google.com> Backport changes to whitelist sockets opened by the zygote.

This is the backport of the following commits :

Reopen whitelisted zygote file descriptors after a fork.

We don't want these descriptors to be shared post-fork, so we'll
have to close and reopen them when the zygote forks. The set of
open descriptors is checked against a whitelist and it is a fatal
error if a non whitelisted FD is opened. It is also a fatal error
if anything other than a regular file / character device or socket
is opened at the time of forking.

This work is done in two stages :
- An initial list of FDs is constructed and cached prior to the
first zygote fork.

- On each subsequent fork, we check whether the list of open FDs
has changed. We are currently tolerant of changes, but in the
longer term, it should be a fatal error if the set of open file
descriptors in the zygote changes.

- Post fork, we traverse the list of open descriptors and reopen
them if necessary.

bug: 30963384

(cherry picked from commit c5f27a7cb2ec816f483a65255034a1b57a8aa221)

Fix clang build breakage (-Werror -Wformat).

Use %zd for size_t. Note that this will break only on (-plus-)aosp because
clang is disabled on the N development branches.

bug: 30963384

(cherry picked from commit b334c33d65894f5ca9833fa55c3a1cf75e01c497)

Add a whitelist of sockets on fork.

Maintain a whitelist of AF_UNIX sockets that are permitted
to exist at the time of forking. If an open socket does not belong
to the whitelist (or is not AF_UNIX), the process will abort. If an
open socket is whitelisted, it will be redirected to /dev/null after
a sucessful fork. This allows us to unify our handling of the special
zygote sockets (/dev/socket/zygote[_secondary]) with the existing
whitelist of non socket file descriptors.

This change also removes non-fatal ALOGW messages since they have the
side effect of reopening the logging socket.

bug: 30963384

(cherry picked from commit 3764a260f0c90dcb323caeda14baf903cc108759)

fd_utils: Remove whitelist for "/dev/pmsg0".

We're now calling __android_log_close prior to a fork, so this file
shouldn't need to be open.

bug: 31243313
bug: 30963384

(cherry picked from commit 8dee0541904e4f792cdebdee4f23f768561cb276)

fd_utils: Fix broken usage of iterators.

There were two separate issues here :
- RestatInternal was using an iterator after a call to erase(). This
will not work because it will be invalidated.
- The "standard" for loop idiom for iterating over a map while making
structural changes to it is broken. Switch to a while loop and treat
cases where elements are erased differently from cases where they
aren't.

bug: 31092930
bug: 30963384

(cherry picked from commit 0b76d6a28e6978151bf245a775329cdae5e574d5)

add dri device to zygote whitelisted FDs

The driver can be used just like /dev/ion for graphic buffers.

(cherry picked from commit 8977e424ee2d6d85fec419532ae510131aa88c45)
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
3764a260f0c90dcb323caeda14baf903cc108759 30-Aug-2016 Narayan Kamath <narayan@google.com> Add a whitelist of sockets on fork.

Maintain a whitelist of AF_UNIX sockets that are permitted
to exist at the time of forking. If an open socket does not belong
to the whitelist (or is not AF_UNIX), the process will abort. If an
open socket is whitelisted, it will be redirected to /dev/null after
a sucessful fork. This allows us to unify our handling of the special
zygote sockets (/dev/socket/zygote[_secondary]) with the existing
whitelist of non socket file descriptors.

This change also removes non-fatal ALOGW messages since they have the
side effect of reopening the logging socket.

bug: 30963384
Change-Id: Ie04dac62d0e0f29354df9ac15af217ad652ffbbe
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
c5f27a7cb2ec816f483a65255034a1b57a8aa221 19-Aug-2016 Narayan Kamath <narayan@google.com> Reopen whitelisted zygote file descriptors after a fork.

We don't want these descriptors to be shared post-fork, so we'll
have to close and reopen them when the zygote forks. The set of
open descriptors is checked against a whitelist and it is a fatal
error if a non whitelisted FD is opened. It is also a fatal error
if anything other than a regular file / character device or socket
is opened at the time of forking.

This work is done in two stages :
- An initial list of FDs is constructed and cached prior to the
first zygote fork.

- On each subsequent fork, we check whether the list of open FDs
has changed. We are currently tolerant of changes, but in the
longer term, it should be a fatal error if the set of open file
descriptors in the zygote changes.

- Post fork, we traverse the list of open descriptors and reopen
them if necessary.

bug: 30963384
Change-Id: Icfd45c96c660491b554d146a9d70d97dbcc712bc
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
593aab732da2860a8394906dda0cdfbeda42b520 09-Aug-2016 Narayan Kamath <narayan@google.com> Zygote: Better logging for setgroups failures.

bug: 28865594
Change-Id: I88590afe6a05e2d1967c9bca74c79de3871440b8
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
885b742bb66660947d8335e9a4f5a4eef2e45ff9 20-Jan-2016 doheon1.lee <doheon1.lee@lge.com> Changes of root storage space unmounting time on Zygote Process

Zygote process forks every child process for launch the SystemServer and other
applications. When child process is forked, unmount storage inherited
from Zygote process is executed before it gains its own root storage
space.
If Zygote have no storage spaces, unmount operations not needed to
get relevant permission storage space.
Thus unmount is executed only once shortly before the SystemServer is forked.
And the child processes do not unmount its inherited root storage space.

Change-Id: I311ca7ea2c93085f42579f8cf8bdc7ef1d570a04
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
0f6ae2ec0df270c4ce51c87896fe01fe6e1fedfa 22-Feb-2016 Erik Kline <ek@google.com> resolve merge conflicts of b242549166 to nyc-dev

Change-Id: I42d4cac95a209fdfae5769d75d90f004a94d60a4
b2425491662b4d31fbcf09ab36bd10adc42a2b28 18-Feb-2016 Erik Kline <ek@google.com> Give bluetooth sufficient capabilities to run DhcpClient

Specifically:
CAP_NET_RAW
CAP_NET_BIND_SERVICE

Bug: 26991160
Change-Id: I2afddc9efa3b613d974afb0ea33703948203d99a
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
2956beeec97df6ee7fe0c826ccc8c6f625f36d75 28-Jan-2016 Pavlin Radoslavov <pavlin@google.com> Grant CAP_WAKE_ALARM to the Bluetooth process for any user

Use multiuser_get_app_id(uid) to check for AID_BLUETOOTH
and allow the CAP_WAKE_ALARM capability for any user.

Bug: 26784675
Change-Id: I11641e212b7c815e9137ae5620da6ad55f95a899
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
fbd5904ce690491b813ebf815a7e33083bc59ea0 24-Nov-2015 Pavlin Radoslavov <pavlin@google.com> Use GID "wakelock" to control access to kernel wakelock

* Added GID "wakelock" (3010) to the list of groups the System Server
belongs to.

* Added GID "wakelock" to the list of assigned groups for the
"android.permission.BLUETOOTH_STACK" Android permission.

* Grant CAP_BLOCK_SUSPEND to processes that belong to GID "wakelock"

Bug: 25864142
Change-Id: I8a9a5f11e4a9ecd1abf2d4f4b90ec89b3101332e
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
a87723515627401f142aec1fd98b8863b726a1a3 11-Dec-2015 Nicolas Geoffray <ngeoffray@google.com> Special case system_server to not create the JIT code cache.

(cherry picked from commit 3c43b3863328e339dff90b216aed15194d129e4a)

Change-Id: Ic7b0887f9edcb950fad98ccbe66cab6949fbdc52
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
b053cce7ae343feeb6c0908920692904f3b0b94c 18-Nov-2015 Andreas Gampe <agampe@google.com> Frameworks/base: Make RuntimeAbort more expressive

Pass a message to FatalError, which will be more prominent in
aborts than "RuntimeAbort."

Change-Id: Icb3b8f50ca0cc15fd1346c530cd8e6452e951879
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
ea1831d211ea0e6b2d161c714bb0786369ef2df5 24-Sep-2015 Elliott Hughes <enh@google.com> am b57dd722: resolved conflicts for a884d81e to stage-aosp-master

* commit 'b57dd722f1dc0663417da37d3a82f8283ad3c982':
constify JNINativeMethod function pointer tables
b57dd722f1dc0663417da37d3a82f8283ad3c982 24-Sep-2015 Elliott Hughes <enh@google.com> resolved conflicts for a884d81e to stage-aosp-master

Change-Id: Ice485967fa96f13786024b6939b826638e906ff0
76f6a86de25e1bf74717e047e55fd44b089673f3 19-Sep-2015 Daniel Micay <danielmicay@gmail.com> constify JNINativeMethod function pointer tables

Change-Id: I4036c924958221cbc644724f8eb01c5de3cd7954
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
db8a6ee56b8e40d0a743e929739fb19a8b3ec456 04-Sep-2015 Sharvil Nanavati <sharvil@google.com> am 80770c09: am 16db4101: Merge "DO NOT MERGE Add \'bluetooth\' user to the \'system\' group." into cw-e-dev

* commit '80770c099144b65e9c7768bbdb56608eebf03b01':
DO NOT MERGE Add 'bluetooth' user to the 'system' group.
16db4101829c7beee42a09fcaf87fa4e31bc1d5a 03-Sep-2015 Sharvil Nanavati <sharvil@google.com> Merge "DO NOT MERGE Add 'bluetooth' user to the 'system' group." into cw-e-dev
babe81546ef001ae26a5c4b572f1480ba737ae32 01-Sep-2015 Sharvil Nanavati <sharvil@google.com> DO NOT MERGE Add 'bluetooth' user to the 'system' group.

Also grant the Bluetooth process CAP_BLOCK_SUSPEND so it can acquire
wake locks directly from /sys/power/wake_lock.

Bug: 23375670
Change-Id: Ib094c5752d49488c2560897ff6bb821daf98a281
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
7dd51792e2131891d402b4f86c78afa86b6d5758 01-Sep-2015 Christopher Ferris <cferris@google.com> am d6597cb4: am 1bc7d0c8: am 70c958c4: Merge "Save/restore errno in SIGCHLD handler." into mnc-dr-dev

* commit 'd6597cb43c1985ec955f2f5c5daf7be52a9f12a2':
Save/restore errno in SIGCHLD handler.
a8a795428acf5cbe1cd348aa766243203ca78b80 01-Sep-2015 Christopher Ferris <cferris@google.com> Save/restore errno in SIGCHLD handler.

The SIGCHLD handler can set the errno, which can change the errno found
on the thread on which the signal handler is invoked. Most of the time
this is harmless, but it's possible that if the main thread was making
a system call, and allows certain failures based on errno, that logic
can fail. The fix is to save/restore errno in the handler.

Bug: 23572286
Bug: 23689391
Change-Id: I4542fd60cc1398ce0a8902d8df98a3d089fb6efe
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
1262059c072375cd5bd48e86b7ee69d66848494d 20-Aug-2015 Elliott Hughes <enh@google.com> am 260cb53f: am ce4fbb4d: Merge "zygote: fix memory leak when fork process"

* commit '260cb53fdb751dd6997b6b6f60a358257c4df82a':
zygote: fix memory leak when fork process
31b1b2766d80a9a1979488e57a49d1015cfb5538 20-Aug-2015 Elliott Hughes <enh@google.com> am 260cb53f: am ce4fbb4d: Merge "zygote: fix memory leak when fork process"

* commit '260cb53fdb751dd6997b6b6f60a358257c4df82a':
zygote: fix memory leak when fork process
1ca062f21e466b5e8b5defe12033c65b2b4276cb 31-Jul-2015 Mykola Kondratenko <mykola.kondratenko@sonymobile.com> zygote: fix memory leak when fork process

Release memory allocated by GetIntArrayElements.

Change-Id: If7ce2a78a480e58b0376352ce438dbe51f664f3a
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
7d28ad9b638a8184ab499cbe708d3427025e569b 06-Aug-2015 Jeff Sharkey <jsharkey@google.com> am cb54ffb2: Merge "Protect runtime storage mount points." into mnc-dev

* commit 'cb54ffb2cb9583eaf6b58dcc636681c4e4e07a7d':
Protect runtime storage mount points.
928e1ecfe2ca8deb7421f06c80bb4ae02d27f030 06-Aug-2015 Jeff Sharkey <jsharkey@android.com> Protect runtime storage mount points.

We have a bunch of magic that mounts the correct view of storage
access based on the runtime permissions of an app, but we forgot to
protect the real underlying data sources; oops.

This series of changes just bumps the directory heirarchy one level
to give us /mnt/runtime which we can mask off as 0700 to prevent
people from jumping to the exposed internals.

Also add CTS tests to verify that we're protecting access to
internal mount points like this.

Bug: 22964288
Change-Id: I74dbdcb01d4fabe92166b8043a74c6a1e93c6d5f
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
6d43a861d01ef48f37c69f96346a13d23164a585 05-Aug-2015 Tim Murray <timmurray@google.com> Add boost to increase the load on newly-forked zygote processes.

Makes it more likely for app launches to end up on a large core in
an HMP environment.

bug 21915482

Change-Id: Ieac192a4bc1237dd03b9492fcad3a78de5510a58
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
faf3f692174be30ef9226981e640bc9a09c4da97 01-Jul-2015 Jeff Sharkey <jsharkey@android.com> Fully unmount existing storage in Zygote.

Before mounting the requested storage into place, fully unmount all
existing mounts inherited from the root namespace.

Bug: 22192518
Change-Id: I6f7f12c1219d25ee487a031d37c60fb4051d24ad
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
9527b223a9d4a4d149bb005afc77148dbeeff785 25-Jun-2015 Jeff Sharkey <jsharkey@android.com> Let's reinvent storage, yet again!

Now that we're treating storage as a runtime permission, we need to
grant read/write access without killing the app. This is really
tricky, since we had been using GIDs for access control, and they're
set in stone once Zygote drops privileges.

The only thing left that can change dynamically is the filesystem
itself, so let's do that. This means changing the FUSE daemon to
present itself as three different views:

/mnt/runtime_default/foo - view for apps with no access
/mnt/runtime_read/foo - view for apps with read access
/mnt/runtime_write/foo - view for apps with write access

There is still a single location for all the backing files, and
filesystem permissions are derived the same way for each view, but
the file modes are masked off differently for each mountpoint.

During Zygote fork, it wires up the appropriate storage access into
an isolated mount namespace based on the current app permissions. When
the app is granted permissions dynamically at runtime, the system
asks vold to jump into the existing mount namespace and bind mount
the newly granted access model into place.

Bug: 21858077
Change-Id: I62fb25d126dd815aea699b33d580e3afb90f8fd2
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
4887789e44cdb16b042a35e8ec03983213e88ac6 18-Mar-2015 Jeff Sharkey <jsharkey@android.com> Progress towards dynamic storage support.

Storage devices are no longer hard-coded, and instead bubble up from
whatever Disk and VolumeBase that vold uncovered, turning into
sibling Java objects in MountService. We now treat vold events as
the source-of-truth for state, and synchronize our state by asking
vold to "reset" whenever we reconnect.

We've now moved to a model where all storage devices are mounted in
the root mount namespace (user boundaries protected with GIDs), so
we no longer need app-to-vold path translation. This also means that
zygote only needs to bind mount the user-specific /mnt/user/n/ path
onto /storage/self/ to make legacy paths like /sdcard work. This
grealy simplifies a lot of system code.

Many parts of the platform depend on a primary storage device always
being present, so we hack together a stub StorageVolume when vold
doesn't have a volume ready yet.

StorageVolume isn't really a volume anymore; it's the user-specific
view onto a volume, so MountService now filters and builds them
based on the calling user. StorageVolume is now immutable, making
it easier to reason about.

Environment now builds all of its paths dynamically based on active
volumes. Adds utility methods to turn int types and flags into
user-readable strings for debugging purposes.

Remove UMS sharing support for now, since no current devices support
it; MTP is the recommended solution going forward because it offers
better multi-user support.

Simplify unmount logic, since vold will now gladly trigger EJECTING
broadcast and kill stubborn processes.

Bug: 19993667
Change-Id: I9842280e61974c91bae15d764e386969aedcd338
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
ed6b9dff563c5e22f040ff37e12c0d771e0478ae 21-Nov-2014 Andreas Gampe <agampe@google.com> Frameworks/base: Consistency in core/jni

Make consistent use of core_jni_helpers for registration.

Translate some #ifdefs into const bools.

Change-Id: I37639aa053dd50f003a552cbd8550dddecc811c5
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
46d8444631b4b1253a76bfcc78a29d26014d022f 19-Nov-2014 Dan Albert <danalbert@google.com> Fix clang warnings in core/jni.

There are a few bugs in here too (mostly people expecting + to
concatenate C strings) :(

Change-Id: I0a243c05c4ea8b56e84896f37814d0fbea4c39d5
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
5d5e4b14f67903370a7805492eb92fbe3b487a14 29-Oct-2014 Calin Juravle <calin@google.com> am 43a92646: Merge "Use native brige only if we have a private data directory."

* commit '43a9264619e08f464dd4f184e53441a440cca09f':
Use native brige only if we have a private data directory.
6a4d2369e5493cea86817634eceb0be46ba7d7a6 28-Oct-2014 Calin Juravle <calin@google.com> Use native brige only if we have a private data directory.

Bug: 18027433

Change-Id: I59b1b1cbe1d7d14b93d8bb6d4255c951d9e469b6
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
5d4deb8246b13531a6b2b7611c650ba504e44dc6 28-Oct-2014 Calin Juravle <calin@google.com> am f7d24d24: Merge "PreInitializeNativeBridge only if its Available"

* commit 'f7d24d244319599f62c22e29c3e6540d6cbadf49':
PreInitializeNativeBridge only if its Available
79ec4c15ab941419d21700a9734f5238b975c31a 24-Oct-2014 Calin Juravle <calin@google.com> PreInitializeNativeBridge only if its Available

Also, assert that we always have a private application directory for non
system_server case.

Change-Id: I8397d7f7b04cde0bf65b60ca415bf3f4b349783c
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
921d8e2ddb04080827fa92239bb858631e3cabe3 01-Oct-2014 Elliott Hughes <enh@google.com> am ee7684ca: am 04517286: Merge "Use strerror(3) when reporting zygote failures."

* commit 'ee7684cad00a13fc82519599ad8fab3cfbd6fe8b':
Use strerror(3) when reporting zygote failures.
960e83185efc709470f3c4c85f69e82269d2927a 30-Sep-2014 Elliott Hughes <enh@google.com> Use strerror(3) when reporting zygote failures.

Bug: 17700596
Change-Id: I39a72ab6f19063de3c90c9fccdb749dc9a86324e
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
a103ebed6e9a44a406b31636791d2970c882ec44 25-Sep-2014 Andreas Gampe <agampe@google.com> resolved conflicts for merge of dfdabe37 to lmp-dev-plus-aosp

Change-Id: Ia9c350dcfb41f9d04400a86bd7e5f2cf2af656f1
2eacd06bfb82b33dfcbccafbcfc0bf1218484bb5 10-Sep-2014 jgu21 <jinghui.gu@intel.com> 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
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
dc84c6ca86290393fec2bb730f125575ee9e168e 05-Sep-2014 Andreas Gampe <agampe@google.com> resolved conflicts for merge of 82ad9ec3 to lmp-dev-plus-aosp

Change-Id: I7ae05c4f1b072906932a9ed47bdbad881b8e0d37
aec67dcc02362e4d2f7641c6605405b839bd1bd4 03-Sep-2014 Andreas Gampe <agampe@google.com> Frameworks/base: Add native bridge post-fork initialization

Change-Id: I5a20de1cb68dd1802937b369b14c50c9c1031c67
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
4990e4f0e3d493036e99e1f5fb893635a9b66eb1 30-Jun-2014 Sharvil Nanavati <sharvil@google.com> Launch processes running under the 'bluetooth' uid with CAP_WAKE_ALARM.

This is required since bluedroid needs to set wake alarms and timers.
Going through JNI back into Java code and then across Binder to
AlarmManager is both inefficient and doesn't provide the resolution
required for functions like A2DP.

Change-Id: I619be0b18a9e7ac2567b7c68ba84fcd15eecf715
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
3089bed197a4fbfcc3fb741aa0ed6b3e162e392c 15-Jul-2014 Colin Cross <ccross@android.com> Zygote: make libprocessgroup failures non-fatal

createProcessGroup can fail if the kernel does not support the
cpuacct cgroup. Print a more useful error message, and don't
runtime abort.

Bug: 16243791
Change-Id: Ibbf081bda58a99c83b8070f55d151905c706b378
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
0161bbc6e54744d5e0348af3d123858818f966e9 03-Jun-2014 Colin Cross <ccross@android.com> ActivityManager: use Process.killProcessGroup to kill forked processes

Place newly-created processes in a process group, and use
killProcessGroup to kill any forked processes.

Bug: 15313911
Change-Id: I0f3e2eeebd9a910dae3f6b2801826c92aea03030
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
18cd9f57621b47889bdf81b2b04413569a999ef4 13-Jun-2014 Colin Cross <ccross@android.com> clean up native com.android.internal.os.Zygote

This is never compiled for the host any more, so remove all the
unnecesarry ifdefs.

Change-Id: I757e6d604b7f41476ac1021f5bdbc777eac6f99e
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
160992da04cab56a92cd425adc249c52b040f93d 14-Apr-2014 Narayan Kamath <narayan@google.com> Fix broken logging in Zygote.cpp.

- Differentiate between clean exits and signals.
- Change the logic for the waitpid warning. We should log it
only if the *first* call to waitpid returned ECHILD.

Change-Id: I6bc50e4ffd100fb7f3f526d6b4056bed10b8045f
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
973b4663b0b5ee62006522bf4742af076096e548 31-Mar-2014 Narayan Kamath <narayan@google.com> Move zygote startup logic to the frameworks.

The Zygote class is now in com.android.internal.os. It is
responsible for the vast majority of work before and after
the call to fork(). It calls back into the Runtime via
the new dalvik.system.ZygoteHooks class to allow the Runtime
to perform pre fork cleanup and post fork initialization.

The native code in Zygote.cpp is a direct and straightforward
port of the existing code in art. Most differences are
superficial, for example :
- We use C style logging (ALOGE) instead of stream based
logging.
- We call env->FatalError() instead of using LOG(FATAL)

Change-Id: Ia101fb2af12d23894fe57e4134d2bc6d142e5059
/frameworks/base/core/jni/com_android_internal_os_Zygote.cpp