Fix desk dock getting stuck after unpairing.

Note: This is a workaround. The read problem is that
we are making a call to Bluez when it is not ready yet.
The interface has not been registered, so dbus call should fail.
We need to fix this properly.

Dr No: Eastham
Bug: 2317784
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index 53c1253..ca72d8a 100644
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -383,6 +383,12 @@
         connectWithoutResettingTimer();
     }
 
+    /*package*/ void onBondingDockConnect() {
+        // Don't connect just set the timer.
+        // TODO(): Fix the actual problem
+        mConnectAttempted = SystemClock.elapsedRealtime();
+    }
+
     private void connectWithoutResettingTimer() {
         // Try to initialize the profiles if there were not.
         if (mProfiles.size() == 0) {
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java b/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java
index c3dfc20..7906d79 100644
--- a/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java
@@ -186,7 +186,11 @@
 
         if (bondState == BluetoothDevice.BOND_BONDED) {
             // Auto-connect after pairing
-            cachedDevice.connect();
+            if (!device.isBluetoothDock()) {
+                cachedDevice.connect();
+            } else {
+                cachedDevice.onBondingDockConnect();
+            }
         }
     }