Zygote: Fix race condition on package preloads.

Before this change, ZygoteProcess.preloadPackageForAbi returned
as soon as the command was written to the zygote socket and not
after the preload completed. This meant that there was a small
window of time before the server side of the socket polled its FDs
where a second command could be written to the zygote socket. This
would lead to only one of the commands being processed and the
other being dropped. The client side of that socket would then wait
forever for a response and bring down the system once the watchdog
timeout was hit.

Example failure case :
--------------
system_server:send command(preloadPackage)
system_server:send command(fork)
zygote:poll & process command(preloadPackage)  // the fork command is dropped.

Example of normal operation :
------------------
system_server:send command(preloadPackage)
zygote:poll & process command(preloadPackage)
system_server:send command(fork)
zygote:poll & process command(fork)

This change makes preloadPackageForAbi synchronous, which ensures
that each POLLIN event corresponds to precisely one command.

(cherry picked from commit 24a3306c32aa3860184025638f3abaab96cc9153)

Bug: 62886909
Bug: 13618569
Test: Manual
Contributed-By: yuqianyu@huawei.com

Merged-In: I83faf974c9a70a6ab18323f692c1981784e4c56a
Change-Id: I83faf974c9a70a6ab18323f692c1981784e4c56a
3 files changed