goldfish/nand.c: Prevent random EXT4 partition corruption.

The kernel's MTD module, in charge of handling reads/writes to/from
NAND memory implements caching that unfortunately results in random
corruption of partition images when the emulator terminates.

This patch prevents the problem by reporting an 'erase size' of 0
for EXT4 partitions. This prevents the caching in the kernel module
and doesn't seem to affect performance at runtime.

The reporting must be done conditionally, because it breaks the
ability to mount YAFFS partitions (used for anything before
Android 4.4 / KitKat).

Huge thanks to thomaswk@ for finding the root cause and providing
a fix!

BUG=16212647

Change-Id: I9cfb3102e98084645f1cbb9a89272363e1f05aac
android/base/synchronization/Lock.h: new helper class.

This adds the definitions of android::base::Lock which implements
a portable wrapper around platform-specific locks / mutexes.

Change-Id: Ibab2263b62d3302a109e96ad23bc79dce5267905
android/base/memory/LazyInstance.h: new helper class.

This patch implements the android::base::LazyInstance<> template
which can be used to perform thread-safe on-demand initialization
of static variables without the use of a C++ static constructor.

Change-Id: Ide1cfb92445aca36c087b13dad3c9ea87e84181b
android/base/threads/ThreadStore.h: new helper class.

This patch implements android::base::ThreadStore which can be
used to implement thread-local storage of liberal values.

Change-Id: I2cd70cfe1a9381779da833816ad89c372b839fc4
android/base/threads/Thread.h: new helper class.

This implements android::base::Thread, which acts as a wrapper
around platform-specific threads. Note that this also ensures that
ThreadStore::OnThreadExit() is always called as expected on
thread exit.

Change-Id: I7f7777db6f1a3c22723271a92ddd413dabb7da22
android/base/async/ThreadLooper.h: new helper class

Change-Id: I8356ac52a9a55f9a6616e75e03b48cbf9fb788e9
Merge "goldfish/nand.c: Prevent random EXT4 partition corruption."
Merge changes I8356ac52,I7f7777db,I2cd70cfe,Ide1cfb92,Ibab2263b

* changes:
  android/base/async/ThreadLooper.h: new helper class
  android/base/threads/Thread.h: new helper class.
  android/base/threads/ThreadStore.h: new helper class.
  android/base/memory/LazyInstance.h: new helper class.
  android/base/synchronization/Lock.h: new helper class.