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

Commit 23cb8cfb authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "Ported: Bluetooth Message Access Profile (MAP) from CM9" into jellybean

parents 678201e5 c771d5a5
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -56,6 +56,10 @@ public final class BluetoothUuid {
            ParcelUuid.fromString("00001105-0000-1000-8000-00805f9b34fb");
    public static final ParcelUuid Hid =
            ParcelUuid.fromString("00001124-0000-1000-8000-00805f9b34fb");
    public static final ParcelUuid MessageAccessServer =
            ParcelUuid.fromString("00001132-0000-1000-8000-00805f9b34fb");
    public static final ParcelUuid MessageNotificationServer =
            ParcelUuid.fromString("00001133-0000-1000-8000-00805f9b34fb");
    public static final ParcelUuid PANU =
            ParcelUuid.fromString("00001115-0000-1000-8000-00805F9B34FB");
    public static final ParcelUuid NAP =
@@ -67,7 +71,7 @@ public final class BluetoothUuid {

    public static final ParcelUuid[] RESERVED_UUIDS = {
        AudioSink, AudioSource, AdvAudioDist, HSP, Handsfree, AvrcpController, AvrcpTarget,
        ObexObjectPush, PANU, NAP};
        ObexObjectPush, MessageAccessServer, MessageNotificationServer, PANU, NAP};

    public static boolean isAudioSource(ParcelUuid uuid) {
        return uuid.equals(AudioSource);
@@ -131,6 +135,14 @@ public final class BluetoothUuid {
        return false;
    }

    public static boolean isMessageAccessServer(ParcelUuid uuid) {
        return uuid.equals(MessageAccessServer);
    }

    public static boolean isMessageNotificationServer(ParcelUuid uuid) {
        return uuid.equals(MessageNotificationServer);
    }

    /**
     * Returns true if there any common ParcelUuids in uuidA and uuidB.
     *
+3 −1
Original line number Diff line number Diff line
@@ -137,7 +137,8 @@ public class BluetoothService extends IBluetooth.Stub {
    private static final ParcelUuid[] RFCOMM_UUIDS = {
            BluetoothUuid.Handsfree,
            BluetoothUuid.HSP,
            BluetoothUuid.ObexObjectPush };
            BluetoothUuid.ObexObjectPush,
	    BluetoothUuid.MessageNotificationServer };

    private final BluetoothAdapterProperties mAdapterProperties;
    private final BluetoothDeviceProperties mDeviceProperties;
@@ -589,6 +590,7 @@ public class BluetoothService extends IBluetooth.Stub {
        if (R.getBoolean(com.android.internal.R.bool.config_bluetooth_default_profiles)) {
            uuids.add(BluetoothUuid.HSP_AG);
            uuids.add(BluetoothUuid.ObexObjectPush);
	    uuids.add(BluetoothUuid.MessageAccessServer);
        }

        if (R.getBoolean(com.android.internal.R.bool.config_voice_capable)) {
+11 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2008-2009, Motorola, Inc.
 * Copyright (c) 2010-2011, Motorola, Inc.
 *
 * All rights reserved.
 *
@@ -121,6 +121,12 @@ public final class ClientOperation implements Operation, BaseStream {
                    (header).mAuthResp.length);

        }
        if ((header).mConnectionID != null) {
            mRequestHeader.mConnectionID = new byte[4];
            System.arraycopy((header).mConnectionID, 0, mRequestHeader.mConnectionID, 0,
                    4);

        }
    }

    /**
@@ -723,4 +729,8 @@ public final class ClientOperation implements Operation, BaseStream {
            }
        }
    }

    public void noEndofBody() {

    }
}
+2 −0
Original line number Diff line number Diff line
@@ -175,6 +175,8 @@ public interface Operation {

    DataOutputStream openDataOutputStream() throws IOException;

    void noEndofBody();

    void close() throws IOException;

    int getMaxPacketSize();
+25 −11
Original line number Diff line number Diff line
/*
 * Copyright (c) 2008-2009, Motorola, Inc.
 * Copyright (c) 2010-2011, Motorola, Inc.
 *
 * All rights reserved.
 *
@@ -88,6 +88,8 @@ public final class ServerOperation implements Operation, BaseStream {

    private boolean mHasBody;

    private boolean mEndofBody = true;

    /**
     * Creates new ServerOperation
     * @param p the parent that created this object
@@ -364,24 +366,31 @@ public final class ServerOperation implements Operation, BaseStream {
                 * (End of Body) otherwise, we need to send 0x48 (Body)
                 */
                if ((finalBitSet) || (mPrivateOutput.isClosed())) {
                    out.write(0x49);
                    if (mEndofBody) {
                        out.write((byte)0x49);
                        bodyLength += 3;
                        out.write((byte)(bodyLength >> 8));
                        out.write((byte)bodyLength);
                        out.write(body);
                    }
                } else {
                    out.write(0x48);
                }

                    bodyLength += 3;
                    out.write((byte)(bodyLength >> 8));
                    out.write((byte)bodyLength);
                    out.write(body);
                }

            }
        }

        if ((finalBitSet) && (type == ResponseCodes.OBEX_HTTP_OK) && (orginalBodyLength <= 0)) {
            if (mEndofBody) {
               out.write(0x49);
               orginalBodyLength = 3;
               out.write((byte)(orginalBodyLength >> 8));
               out.write((byte)orginalBodyLength);

           }
        }

        mResponseSize = 3;
@@ -711,4 +720,9 @@ public final class ServerOperation implements Operation, BaseStream {
    public void streamClosed(boolean inStream) throws IOException {

    }

    public void noEndofBody() {
        mEndofBody = false;
    }

}