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

Commit f2d7e51e authored by Ashwini Munigala's avatar Ashwini Munigala Committed by Steve Kondik
Browse files

MAP: Support MAP Server role on Bluedroid with javax.OBEX lib.

Handle No END OF BODY for MAP 1.0 Server Get request. Only the
last packet need send the 0x49(End of Body). For intermediate
packets, we need to send 0x48 (Body).

Move definitions for MAP or FTP Service Specific UUID and
Request type for CONNECTION_ACCESS_REQUEST intent to
BluetoothExt APK.

Change-Id: I04cfeb8d53b8f8c19160a2de1eb448a7ec1f2c41
CRs-fixed: 504042

Conflicts:

	obex/javax/obex/ClientOperation.java
	obex/javax/obex/ServerOperation.java
(cherry picked from commit 375d8f5e964263eadeeadd312384c1f8ebf9ff21)
(cherry picked from commit 7788ff7b9ff1ff5adbd38d9b7d8584d6a127dad6)
(cherry picked from commit 717672648b06678e3d1f10aa1f5c8791b4add846)
parent 2c28e314
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2008-2009, Motorola, Inc.
 *
 * All rights reserved.
@@ -733,4 +734,7 @@ public final class ClientOperation implements Operation, BaseStream {

    public void noBodyHeader(){
    }
    public void noEndofBody() {

    }
}
+12 −4
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2008-2009, Motorola, Inc.
 *
 * All rights reserved.
@@ -62,6 +63,7 @@ public final class ClientSession extends ObexSession {

    private final OutputStream mOutput;

    private long mTotalSize = 0;
    public ClientSession(final ObexTransport trans) throws IOException {
        mInput = trans.openInputStream();
        mOutput = trans.openOutputStream();
@@ -479,6 +481,12 @@ public final class ClientSession extends ObexSession {
                byte[] body = ObexHelper.updateHeaderSet(header, data);
                if ((privateInput != null) && (body != null)) {
                    privateInput.writeBytes(body, 1);
                    mTotalSize += (long)(body.length - 1);
                    if((body[0] == HeaderSet.END_OF_BODY) &&
                                            (header.getHeader(HeaderSet.LENGTH) == null)){
                        header.setHeader(HeaderSet.LENGTH, mTotalSize);
                        mTotalSize = 0;
                    }
                }

            if (header.mConnectionID != null) {
+3 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2008-2009, Motorola, Inc.
 *
 * All rights reserved.
@@ -177,6 +178,8 @@ public interface Operation {

    void close() throws IOException;

    void noEndofBody();

    int getMaxPacketSize();

    public void noBodyHeader();
+12 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2008-2009, Motorola, Inc.
 *
 * All rights reserved.
@@ -90,6 +91,7 @@ public final class ServerOperation implements Operation, BaseStream {

    private boolean mSendBodyHeader = true;

    private boolean mEndofBody = true;
    /**
     * Creates new ServerOperation
     * @param p the parent that created this object
@@ -366,7 +368,7 @@ public final class ServerOperation implements Operation, BaseStream {
                 * (End of Body) otherwise, we need to send 0x48 (Body)
                 */
                if ((finalBitSet) || (mPrivateOutput.isClosed())) {
                    if(mSendBodyHeader == true) {
                    if (mEndofBody) {
                        out.write(0x49);
                        bodyLength += 3;
                        out.write((byte)(bodyLength >> 8));
@@ -388,6 +390,12 @@ public final class ServerOperation implements Operation, BaseStream {

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

                out.write(0x49);
                orginalBodyLength = 3;
                out.write((byte)(orginalBodyLength >> 8));
@@ -726,4 +734,7 @@ public final class ServerOperation implements Operation, BaseStream {
    public void noBodyHeader(){
        mSendBodyHeader = false;
    }
    public void noEndofBody() {
        mEndofBody = false;
    }
}