From d432bf76de6f7284187040de30ad6af2d6d765da Mon Sep 17 00:00:00 2001 From: Jaikumar Ganesh Date: Mon, 24 May 2010 18:00:56 -0700 Subject: [PATCH] Set profiles as preferred and then try to connect. The APIs implementations are being updated to expose A2DP and HFP APIs. A connect call is not honoured if its not a preferred profile. So if an app changes the preference of the profile than it should first update the state before making the connect call. The API for updating preference might not be exposed and will be mostly an API for app with ADMIN privileges like Settings app. Change-Id: I58b8e8201357bcfe615dc2322342520319d9e355 --- .../settings/bluetooth/ConnectSpecificProfilesActivity.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/bluetooth/ConnectSpecificProfilesActivity.java b/src/com/android/settings/bluetooth/ConnectSpecificProfilesActivity.java index 08534f3b85..2a8af5fdec 100644 --- a/src/com/android/settings/bluetooth/ConnectSpecificProfilesActivity.java +++ b/src/com/android/settings/bluetooth/ConnectSpecificProfilesActivity.java @@ -179,6 +179,9 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity } private void onProfileCheckedStateChanged(Profile profile, boolean checked) { + LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager + .getProfileManager(mManager, profile); + profileManager.setPreferred(mCachedDevice.getDevice(), checked); if (mOnlineMode) { if (checked) { mCachedDevice.connect(profile); @@ -186,10 +189,6 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity mCachedDevice.disconnect(profile); } } - - LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager - .getProfileManager(mManager, profile); - profileManager.setPreferred(mCachedDevice.getDevice(), checked); } public void onDeviceAttributesChanged(CachedBluetoothDevice cachedDevice) { -- 2.11.0