Add locking around boot image generation.

If zygote aborts due to an error, it will restart and
spawn another dex2oat process while the old one is still
running. If this happens fast enough, the system will
eventually need a kernel reboot since neither the zygote
nor dex2oat are killable.

This brings boot image generation in line with dex2oat
generation, which uses a similar pattern of advisory
locking.

bug: 15415316

Change-Id: Iaccd274d3d96ab002b04e246ec4b3ef9a422ff7c
7 files changed