HeadsetClientService headsetClientService = HeadsetClientService.getHeadsetClientService();
A2dpSinkService a2dpSinkService = A2dpSinkService.getA2dpSinkService();
PbapClientService pbapClientService = PbapClientService.getPbapClientService();
+ MapClientService mapClientService = MapClientService.getMapClientService();
PanService panService = PanService.getPanService();
boolean allProfilesEmpty = true;
List<BluetoothDevice> headsetClientConnDevList = null;
List<BluetoothDevice> a2dpSinkConnDevList = null;
List<BluetoothDevice> pbapClientConnDevList = null;
+ List<BluetoothDevice> mapClientConnDevList = null;
List<BluetoothDevice> panConnDevList = null;
if (hsService != null) {
pbapClientConnDevList = pbapClientService.getConnectedDevices();
allProfilesEmpty = allProfilesEmpty && pbapClientConnDevList.isEmpty();
}
+ if (mapClientService != null) {
+ mapClientConnDevList = mapClientService.getConnectedDevices();
+ allProfilesEmpty = allProfilesEmpty && mapClientConnDevList.isEmpty();
+ }
if (panService != null) {
panConnDevList = panService.getConnectedDevices();
allProfilesEmpty = allProfilesEmpty && panConnDevList.isEmpty();
pbapClientService.connect(device);
}
}
+ if (mapClientService != null) {
+ if (mapClientConnDevList.isEmpty() &&
+ (mapClientService.getPriority(device) >= BluetoothProfile.PRIORITY_ON)) {
+ if (pbapClientConnDevList.isEmpty() || pbapClientConnDevList.contains(device)) {
+ mapClientService.connect(device);
+ }
+ }
+ }
if (panService != null) {
if (panConnDevList.isEmpty() &&
(panService.getPriority(device) >= BluetoothProfile.PRIORITY_ON)) {