Bluetooth: Add support for PBAP UI preference
Usecase: 1) Connect with carkit that supports PBAP/MAP 2) Try to uncheck the checkbox for contact sharing from device sub settings menu Expected Result: 1) DUT should display "Connected (No Media or Phone)" 1) Should be able to disconnect when checkbox moves from selected->unselected, and carkit should be able to connect when checkbox is selected again Observation: 1) No UI updates when PBAP/MAP are connected. 2) On unchecking Contact sharing checkbox nothing happens. PBAP connection remains active and user is not asked to disconnect profile level connection. Fix: Add support for PBAP UI preference in SettingsLib. Also Fix issues related to MAP profile addition/removal. Test: Connect from carkit, try disconnecting from sub settings menu by unchecking Contact Sharing checkbox and check if PBAP is successfully disconnected. Bug: 35014213 Change-Id: I283a0cb65cb132931010fb2f8c977bea20a67951
This commit is contained in:
committed by
Myles Watson
parent
f845bbdfa4
commit
dbc3d8dd12
@@ -132,7 +132,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 &&
|
||||
|
||||
16
packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java
Executable file → Normal file
16
packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java
Executable file → Normal 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) {
|
||||
|
||||
Reference in New Issue
Block a user