OSDN Git Service

Make PBAP PCE (Client) role auto-connectable.
authorJoseph Pirozzo <pirozzoj@google.com>
Tue, 5 Apr 2016 21:25:18 +0000 (14:25 -0700)
committerSanket Agarwal <sanketa@google.com>
Tue, 5 Apr 2016 23:59:53 +0000 (23:59 +0000)
Set the default flag to enable contact sharing from Car Kit by default
like the other autoconnect profiles.

Bug: 27977457
Change-Id: Ibbd09ea93ff402193e8a03ba77148dea9417a488

src/com/android/bluetooth/btservice/AdapterService.java

index 18d7695..c76f0e3 100644 (file)
@@ -261,6 +261,7 @@ public class AdapterService extends Service {
         A2dpSinkService a2dpSinkService = A2dpSinkService.getA2dpSinkService();
         HeadsetService headsetService = HeadsetService.getHeadsetService();
         HeadsetClientService headsetClientService = HeadsetClientService.getHeadsetClientService();
+        PbapClientService pbapClientService = PbapClientService.getPbapClientService();
 
         // Set profile priorities only for the profiles discovered on the remote device.
         // This avoids needless auto-connect attempts to profiles non-existent on the remote device
@@ -299,6 +300,11 @@ public class AdapterService extends Service {
             a2dpSinkService.setPriority(device, BluetoothProfile.PRIORITY_ON);
         }
 
+        if ((pbapClientService != null) &&
+            (BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.PBAP_PSE) &&
+             (pbapClientService.getPriority(device) == BluetoothProfile.PRIORITY_UNDEFINED))) {
+            pbapClientService.setPriority(device, BluetoothProfile.PRIORITY_ON);
+        }
     }
 
     private void processProfileStateChanged(BluetoothDevice device, int profileId, int newState, int prevState) {