Merge change 1700 into donut

* changes:
  Update CTS to use the new IDevice#getSyncService().
diff --git a/tools/host/src/com/android/cts/DeviceManager.java b/tools/host/src/com/android/cts/DeviceManager.java
index 85b88db..06aff4f 100644
--- a/tools/host/src/com/android/cts/DeviceManager.java
+++ b/tools/host/src/com/android/cts/DeviceManager.java
@@ -21,6 +21,7 @@
 import com.android.ddmlib.NullOutputReceiver;
 import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
@@ -213,20 +214,24 @@
 
         @Override
         public void run() {
-            while (mDevice.getSyncService() == null || mDevice.getPropertyCount() == 0) {
-                try {
-                    Thread.sleep(100);
-                } catch (InterruptedException e) {
-                    Log.e("", e);
+            try {
+               while (mDevice.getSyncService() == null || mDevice.getPropertyCount() == 0) {
+                    try {
+                        Thread.sleep(100);
+                    } catch (InterruptedException e) {
+                        Log.e("", e);
+                    }
                 }
+                CUIOutputStream.println("Device(" + mDevice + ") connected");
+                if (!TestSession.isADBServerRestartedMode()) {
+                    CUIOutputStream.printPrompt();
+                }
+                appendDevice(mDevice);
+                // increment the counter semaphore to unblock threads waiting for devices
+                mSemaphore.release();
+            } catch (IOException e) {
+                // FIXME: handle failed connection to device.
             }
-            CUIOutputStream.println("Device(" + mDevice + ") connected");
-            if (!TestSession.isADBServerRestartedMode()) {
-                CUIOutputStream.printPrompt();
-            }
-            appendDevice(mDevice);
-            // increment the counter semaphore to unblock threads waiting for devices
-            mSemaphore.release();
         }
     }
 
diff --git a/tools/host/src/com/android/cts/TestDevice.java b/tools/host/src/com/android/cts/TestDevice.java
index ad88780..4475e70 100644
--- a/tools/host/src/com/android/cts/TestDevice.java
+++ b/tools/host/src/com/android/cts/TestDevice.java
@@ -130,7 +130,11 @@
 
     public TestDevice(Device device) {
         mDevice = device;
-        mSyncService = mDevice.getSyncService();
+        try {
+            mSyncService = mDevice.getSyncService();
+        } catch (IOException e) {
+            // FIXME: handle failed connection.
+        }
         mBatchModeResultParser = null;
         mUninstallObserver = new PackageActionObserver(ACTION_UNINSTALL);
         mStatus = STATUS_IDLE;