Merge "Bluetooth: Add support for PBAP UI preference"

This commit is contained in:
Treehugger Robot
2017-12-13 00:30:42 +00:00
committed by Gerrit Code Review
2 changed files with 14 additions and 5 deletions

View File

@@ -135,7 +135,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
if (newProfileState == BluetoothProfile.STATE_CONNECTED) {
if (profile instanceof MapProfile) {
profile.setPreferred(mDevice, true);
} else if (!mProfiles.contains(profile)) {
}
if (!mProfiles.contains(profile)) {
mRemovedProfiles.remove(profile);
mProfiles.add(profile);
if (profile instanceof PanProfile &&

View File

@@ -25,6 +25,7 @@ import android.bluetooth.BluetoothHidHost;
import android.bluetooth.BluetoothMap;
import android.bluetooth.BluetoothMapClient;
import android.bluetooth.BluetoothPan;
import android.bluetooth.BluetoothPbap;
import android.bluetooth.BluetoothPbapClient;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothUuid;
@@ -140,9 +141,11 @@ public class LocalBluetoothProfileManager {
BluetoothMap.ACTION_CONNECTION_STATE_CHANGED);
}
//Create PBAP server profile, but do not add it to list of profiles
// as we do not need to monitor the profile as part of profile list
//Create PBAP server profile
if(DEBUG) Log.d(TAG, "Adding local PBAP profile");
mPbapProfile = new PbapServerProfile(context);
addProfile(mPbapProfile, PbapServerProfile.NAME,
BluetoothPbap.ACTION_CONNECTION_STATE_CHANGED);
if (DEBUG) Log.d(TAG, "LocalBluetoothProfileManager construction complete");
}
@@ -495,6 +498,13 @@ public class LocalBluetoothProfileManager {
mMapProfile.setPreferred(device, true);
}
if ((mPbapProfile != null) &&
(mPbapProfile.getConnectionStatus(device) == BluetoothProfile.STATE_CONNECTED)) {
profiles.add(mPbapProfile);
removedProfiles.remove(mPbapProfile);
mPbapProfile.setPreferred(device, true);
}
if (mMapClientProfile != null) {
profiles.add(mMapClientProfile);
removedProfiles.remove(mMapClientProfile);
@@ -503,8 +513,6 @@ public class LocalBluetoothProfileManager {
if (mUsePbapPce) {
profiles.add(mPbapClientProfile);
removedProfiles.remove(mPbapClientProfile);
profiles.remove(mPbapProfile);
removedProfiles.add(mPbapProfile);
}
if (DEBUG) {