Make ActivityManagerService.systemReady thread safe

During boot of the framework, two threads execute code in
ActivityManagerService and ActivityStack, respectively. At one point
in time, the latter thread checks the internal state of the first
thread, but if for some reason that thread has stalled for an
unexpected amount of time, the state has not been updated (yet).

An example of the above is when one of the services started from
SystemServer (eg AppWidgetService) takes unexpectedly long to start.
This causes the framework to boot without broadcasting
BOOT_COMPLETED, which in turn has ramifications for the entire
system.

Change-Id: I14b5f6fcb320be01596a2e04db3f724a43f4fbe1
Detach engines before destroying WallpaperService

WallpaperService contained a race condition where the service might be
destroyed before all its engines had been detached. For subclass
ImageWallpaper this would leak the engine's BroadcastListener, which in
turn would trigger a system crash (as ImageWallpaper runs as part of
the system).

Change-Id: Ia900173a1d3070cbf6bcf769f68376c8c8cbc62a
Merge "Make ActivityManagerService.systemReady thread safe" into jb43
Merge "Detach engines before destroying WallpaperService" into jb43