Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b874a1d1 authored by Joseph Pirozzo's avatar Joseph Pirozzo
Browse files

Implement PBAP PCE client role service.

Migrate code from frameworks/opt/bluetooth for pbap client to support
pbap as a bluetooth profile.

Bug: 27490041
Change-Id: I7a486af1c58d17ee10348aae044786df670a781e
parent 8b9e8741
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -30,9 +30,9 @@
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <!-- WRITE_CONTACTS is used for test cases only -->
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.READ_CALL_LOG" />
    <uses-permission android:name="android.permission.WRITE_CALL_LOG" />
    <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.NFC_HANDOVER_STATUS" />
@@ -350,5 +350,22 @@
                <action android:name="android.telecom.ConnectionService" />
            </intent-filter>
        </service>
        <service
            android:process="@string/process"
            android:name = ".pbapclient.PbapClientService"
            android:enabled="@bool/profile_supported_pbapclient">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothPbapClient" />
            </intent-filter>
        </service>
        <!-- Authenticator for PBAP account. -->
        <service android:name=".AuthenticationService" android:exported="true">
            <intent-filter>
                <action android:name="android.accounts.AccountAuthenticator" />
            </intent-filter>
            <meta-data
                android:name="android.accounts.AccountAuthenticator"
                android:resource="@xml/authenticator" />
        </service>
    </application>
</manifest>
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
    <bool name="profile_supported_map">true</bool>
    <bool name="profile_supported_avrcp_controller">false</bool>
    <bool name="profile_supported_sap">false</bool>
    <bool name="profile_supported_pbapclient">false</bool>

    <!-- If true, we will require location to be enabled on the device to
         fire Bluetooth LE scan result callbacks in addition to having one
+4 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="pbap_account_type">com.android.bluetooth.pbapsink</string>
</resources>
+18 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<account-authenticator
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:accountType="@string/pbap_account_type" />
+15 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ import com.android.bluetooth.hfp.HeadsetService;
import com.android.bluetooth.hfpclient.HeadsetClientService;
import com.android.bluetooth.hdp.HealthService;
import com.android.bluetooth.pan.PanService;
import com.android.bluetooth.pbapclient.PbapClientService;
import com.android.bluetooth.sdp.SdpManager;
import com.android.internal.R;
import com.android.bluetooth.Utils;
@@ -1634,6 +1635,7 @@ public class AdapterService extends Service {
             // Car Kitt profiles.
             autoConnectHeadsetClient();
             autoConnectA2dpSink();
             autoConnectPbapClient();
         }
         else {
             debugLog( "autoConnect() - BT is in quiet mode. Not initiating auto connections");
@@ -1696,6 +1698,19 @@ public class AdapterService extends Service {
         }
     }

     private void autoConnectPbapClient(){
         PbapClientService pbapClientService = PbapClientService.getPbapClientService();
         BluetoothDevice bondedDevices[] = getBondedDevices();
         if ((bondedDevices == null) ||(pbapClientService == null)) {
             return;
         }
         for (BluetoothDevice device : bondedDevices) {
             debugLog("autoConnectPbapClient() - Connecting PBAP Client with " + device.toString());
             pbapClientService.connect(device);
         }
    }


     public void connectOtherProfile(BluetoothDevice device, int firstProfileStatus){
        if ((mHandler.hasMessages(MESSAGE_CONNECT_OTHER_PROFILES) == false) &&
            (isQuietModeEnabled()== false)){
Loading