diff options
author | Nitin Arora <niarora@codeaurora.org> | 2014-07-11 14:56:06 -0700 |
---|---|---|
committer | Andre Eisenbach <eisenbach@google.com> | 2015-03-24 23:56:19 +0000 |
commit | fc75374b0afeac5ad1f0217299bbbe3c29a015c0 (patch) | |
tree | 34e27fd8daa5cd0055c98f4b85d212d007a5f8ba /src/com | |
parent | 22416075708990c5820fd18de7c028c017c6f1ab (diff) | |
download | packages_apps_Settings-fc75374b0afeac5ad1f0217299bbbe3c29a015c0.tar.gz packages_apps_Settings-fc75374b0afeac5ad1f0217299bbbe3c29a015c0.tar.bz2 packages_apps_Settings-fc75374b0afeac5ad1f0217299bbbe3c29a015c0.zip |
Increase allowed duration to connect to HOGP profile
This patch increases the duration allowed between the first device
connection attempt (immidiately after bonding) and profile connection
after service discovery from 5 seconds to 30 seconds to allow
HOGP connections for slow connection conditions.
Change-Id: Ia8a33a6ef8951d6e08b4a22837fcfdb70910112c
Diffstat (limited to 'src/com')
-rwxr-xr-x | src/com/android/settings/bluetooth/CachedBluetoothDevice.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java index f33f4db2b..c8b9c5b22 100755 --- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java +++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java @@ -16,6 +16,7 @@ package com.android.settings.bluetooth; +import android.bluetooth.BluetoothUuid; import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; @@ -102,6 +103,7 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> { // See mConnectAttempted private static final long MAX_UUID_DELAY_FOR_AUTO_CONNECT = 5000; + private static final long MAX_HOGP_DELAY_FOR_AUTO_CONNECT = 30000; /** Auto-connect after pairing only if locally initiated. */ private boolean mConnectAfterPairing; @@ -523,9 +525,11 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> { */ void onUuidChanged() { updateProfiles(); + ParcelUuid[] uuids = mDevice.getUuids(); + long timeout = MAX_UUID_DELAY_FOR_AUTO_CONNECT; if (DEBUG) { - Log.e(TAG, "onUuidChanged: Time since last connect" + Log.d(TAG, "onUuidChanged: Time since last connect" + (SystemClock.elapsedRealtime() - mConnectAttempted)); } @@ -533,9 +537,11 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> { * If a connect was attempted earlier without any UUID, we will do the * connect now. */ + if (BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.Hogp)) { + timeout = MAX_HOGP_DELAY_FOR_AUTO_CONNECT; + } if (!mProfiles.isEmpty() - && (mConnectAttempted + MAX_UUID_DELAY_FOR_AUTO_CONNECT) > SystemClock - .elapsedRealtime()) { + && (mConnectAttempted + timeout) > SystemClock.elapsedRealtime()) { connectWithoutResettingTimer(false); } dispatchAttributesChanged(); |