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

Commit 0446c237 authored by Joseph Pirozzo's avatar Joseph Pirozzo Committed by Sanket Agarwal
Browse files

MAP MCE

Message Access Profile Client code. Supports Message Notification
Service server and Message Access Service Client for sending messages
and receiving new messages and retrieving unread messages.

Bug: 30467210
Change-Id: Ia4f27f11acbbcb5975d85344f0c19be3d1975b66
(cherry picked from commit 55c0276f5ebf0337739131aa4f7d6af558b65ef8)
parent c3cfde70
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -265,6 +265,14 @@
                  android:grantUriPermissions="true"
                  android:exported="false">
        </provider>
        <service
            android:process="@string/process"
            android:name=".mapclient.MapClientService"
            android:enabled="@bool/profile_supported_mapmce" >
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothMapClient" />
            </intent-filter>
        </service>
        <service
            android:process="@string/process"
            android:name=".sap.SapService"
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
    <bool name="profile_supported_avrcp_controller">false</bool>
    <bool name="profile_supported_sap">false</bool>
    <bool name="profile_supported_pbapclient">false</bool>
    <bool name="profile_supported_mapmce">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
+1 −1
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ public class ObexServerSockets {
     * Set state to accept new incoming connection. Will cause the next incoming connection to be
     * Signaled through {@link IObexConnectionValidator#onConnect()};
     */
    public void prepareForNewConnect() {
    synchronized public void prepareForNewConnect() {
        if(D) Log.d(TAG, "prepareForNewConnect()");
        mConAccepted = false;
    }
+10 −1
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ import com.android.bluetooth.a2dpsink.A2dpSinkService;
import com.android.bluetooth.hid.HidService;
import com.android.bluetooth.hfp.HeadsetService;
import com.android.bluetooth.hfpclient.HeadsetClientService;
import com.android.bluetooth.mapclient.MapClientService;
import com.android.bluetooth.pan.PanService;
import com.android.bluetooth.pbapclient.PbapClientService;
import com.android.bluetooth.sdp.SdpManager;
@@ -255,7 +256,7 @@ public class AdapterService extends Service {
        HeadsetClientService headsetClientService = HeadsetClientService.getHeadsetClientService();
        PbapClientService pbapClientService = PbapClientService.getPbapClientService();
        PanService panService = PanService.getPanService();

        MapClientService mapClientService = MapClientService.getMapClientService();

        // 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
@@ -307,6 +308,14 @@ public class AdapterService extends Service {
                 R.bool.config_bluetooth_pan_enable_autoconnect))) {
            panService.setPriority(device, BluetoothProfile.PRIORITY_ON);
        }

        if ((mapClientService != null) &&
                ((BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.MAP) ||
                        BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.MAS) ||
                        BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.MNS)) &&
                        (mapClientService.getPriority(device) == BluetoothProfile.PRIORITY_UNDEFINED))) {
            mapClientService.setPriority(device, BluetoothProfile.PRIORITY_ON);
        }
    }

    private void processProfileStateChanged(BluetoothDevice device, int profileId, int newState, int prevState) {
+7 −2
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.bluetooth.hid.HidService;
import com.android.bluetooth.pan.PanService;
import com.android.bluetooth.gatt.GattService;
import com.android.bluetooth.map.BluetoothMapService;
import com.android.bluetooth.mapclient.MapClientService;
import com.android.bluetooth.sap.SapService;
import com.android.bluetooth.pbapclient.PbapClientService;

@@ -59,7 +60,8 @@ public class Config {
        HeadsetClientService.class,
        AvrcpControllerService.class,
        SapService.class,
        PbapClientService.class
        PbapClientService.class,
        MapClientService.class
    };
    /**
     * Resource flag to indicate whether profile is supported or not.
@@ -76,7 +78,8 @@ public class Config {
        R.bool.profile_supported_hfpclient,
        R.bool.profile_supported_avrcp_controller,
        R.bool.profile_supported_sap,
        R.bool.profile_supported_pbapclient
        R.bool.profile_supported_pbapclient,
        R.bool.profile_supported_mapmce
    };

    private static Class[] SUPPORTED_PROFILES = new Class[0];
@@ -163,6 +166,8 @@ public class Config {
            profileIndex = BluetoothProfile.SAP;
        } else if (profile == PbapClientService.class) {
            profileIndex = BluetoothProfile.PBAP_CLIENT;
        } else if (profile == MapClientService.class) {
            profileIndex = BluetoothProfile.MAP_CLIENT;
        }

        return profileIndex;
Loading