Bluetooth: Fix profile auto-connect logic
The fix in commit 05e08c3a2f27d5027b34e81b7c0a67e4da7341f6 caused a
duplicate connect message to be sent to A2DP devices (and others),
causing the A2DP state machine to disconnect a device shortly after
connecting it.
This patch reverts the relevant part of commit 05e06c that causes the
faulty auto-connect behaviour.
Bug: 22128169
Change-Id: Ie0dadd5c9583bf2b64a8434a2a3603cb749b21d0
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
index b0429ef..e4b1ed8 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
@@ -539,10 +539,10 @@
* Otherwise, allow the connect on UUID change.
*/
if (!mProfiles.isEmpty()
- && ((mConnectAttempted + timeout) > SystemClock.elapsedRealtime()
- || (mConnectAttempted == 0))) {
+ && ((mConnectAttempted + timeout) > SystemClock.elapsedRealtime())) {
connectWithoutResettingTimer(false);
}
+
dispatchAttributesChanged();
}