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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user