Support multiple device allocations and state refactoring.

Change the IDeviceManager allocateDevice to be a blocking call, and get rid of
the unimplemented IDeviceListener mechanism.

Previously there was intermittent problems when a device reboots. This occurred
because ddmlib creates a new IDevice reference each time a device connects to
adb. and thus TestDevice was keeping stale references to IDevice.

Do yet another refactoring of device state management logic to solve both
these issues.

DeviceManager is now responsible for detecting device state changes and
informing TestDevice which informs DeviceStateMonitor.
See the Device section in design doc and model for more details.

Change-Id: Ie0884ae363c926027f15d544f3ff6f03a30041c3
26 files changed