diff options
2 files changed, 14 insertions, 5 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java index 2873fb68ce5b..9caff100cb9d 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java @@ -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 && diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java index 9cda669379dd..991d9221c796 100755..100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java @@ -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) { |