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
This commit is contained in:
Jaikumar Ganesh
2010-05-24 18:00:56 -07:00
parent 687094b42f
commit d432bf76de

View File

@@ -179,6 +179,9 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
} }
private void onProfileCheckedStateChanged(Profile profile, boolean checked) { private void onProfileCheckedStateChanged(Profile profile, boolean checked) {
LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager
.getProfileManager(mManager, profile);
profileManager.setPreferred(mCachedDevice.getDevice(), checked);
if (mOnlineMode) { if (mOnlineMode) {
if (checked) { if (checked) {
mCachedDevice.connect(profile); mCachedDevice.connect(profile);
@@ -186,10 +189,6 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
mCachedDevice.disconnect(profile); mCachedDevice.disconnect(profile);
} }
} }
LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager
.getProfileManager(mManager, profile);
profileManager.setPreferred(mCachedDevice.getDevice(), checked);
} }
public void onDeviceAttributesChanged(CachedBluetoothDevice cachedDevice) { public void onDeviceAttributesChanged(CachedBluetoothDevice cachedDevice) {