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

Commit e350cc7a authored by Hemant Gupta's avatar Hemant Gupta Committed by android-build-merger
Browse files

Merge "MAP: Fix to handle incomplete message listing object sent." am: cf77de70

am: 2265dd38

Change-Id: I754444b6bce947b1418fff82d09bfb41e1e7aeec
parents e6e48753 2265dd38
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -1174,9 +1174,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
        }
        }


        try {
        try {
            // Open the OBEX body stream
            outStream = op.openOutputStream();

            if (appParams.getMaxListCount() == BluetoothMapAppParams.INVALID_VALUE_PARAMETER) {
            if (appParams.getMaxListCount() == BluetoothMapAppParams.INVALID_VALUE_PARAMETER) {
                appParams.setMaxListCount(1024);
                appParams.setMaxListCount(1024);
            }
            }
@@ -1229,6 +1226,8 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
            replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams());
            replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams());
            op.sendHeaders(replyHeaders);
            op.sendHeaders(replyHeaders);


            // Open the OBEX body stream
            outStream = op.openOutputStream();
        } catch (IOException e) {
        } catch (IOException e) {
            Log.w(TAG, "sendMessageListingRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e);
            Log.w(TAG, "sendMessageListingRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e);
            if (outStream != null) {
            if (outStream != null) {
@@ -1366,9 +1365,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler {


        // Check to see if we only need to send the size - hence no need to encode.
        // Check to see if we only need to send the size - hence no need to encode.
        try {
        try {
            // Open the OBEX body stream
            outStream = op.openOutputStream();

            if (appParams.getMaxListCount() == BluetoothMapAppParams.INVALID_VALUE_PARAMETER) {
            if (appParams.getMaxListCount() == BluetoothMapAppParams.INVALID_VALUE_PARAMETER) {
                appParams.setMaxListCount(1024);
                appParams.setMaxListCount(1024);
            }
            }
@@ -1416,6 +1412,8 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
            replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams());
            replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams());
            op.sendHeaders(replyHeaders);
            op.sendHeaders(replyHeaders);


            // Open the OBEX body stream
            outStream = op.openOutputStream();
        } catch (IOException e) {
        } catch (IOException e) {
            Log.w(TAG, "sendConvoListingRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e);
            Log.w(TAG, "sendConvoListingRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e);
            if (outStream != null) {
            if (outStream != null) {
@@ -1524,7 +1522,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler {


            if (maxListCount != 0) {
            if (maxListCount != 0) {
                outBytes = mCurrentFolder.encode(listStartOffset, maxListCount);
                outBytes = mCurrentFolder.encode(listStartOffset, maxListCount);
                outStream = op.openOutputStream();
            } else {
            } else {
                // ESR08 specified that this shall only be included for MaxListCount=0
                // ESR08 specified that this shall only be included for MaxListCount=0
                outAppParams.setFolderListingSize(mCurrentFolder.getSubFolderCount());
                outAppParams.setFolderListingSize(mCurrentFolder.getSubFolderCount());
@@ -1535,6 +1532,9 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
            replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams());
            replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams());
            op.sendHeaders(replyHeaders);
            op.sendHeaders(replyHeaders);


            if (maxListCount != 0) {
                outStream = op.openOutputStream();
            }
        } catch (IOException e1) {
        } catch (IOException e1) {
            Log.w(TAG, "sendFolderListingRsp: IOException"
            Log.w(TAG, "sendFolderListingRsp: IOException"
                    + " - sending OBEX_HTTP_BAD_REQUEST Exception:", e1);
                    + " - sending OBEX_HTTP_BAD_REQUEST Exception:", e1);
@@ -1723,7 +1723,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler {


        try {
        try {
            outBytes = mOutContent.getMessage(handle, appParams, mCurrentFolder, version);
            outBytes = mOutContent.getMessage(handle, appParams, mCurrentFolder, version);
            outStream = op.openOutputStream();


            // If it is a fraction request of Email message, set header before responding
            // If it is a fraction request of Email message, set header before responding
            if ((BluetoothMapUtils.getMsgTypeFromHandle(handle).equals(TYPE.EMAIL)
            if ((BluetoothMapUtils.getMsgTypeFromHandle(handle).equals(TYPE.EMAIL)
@@ -1742,6 +1741,7 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
                            + "set FRACTION_DELIVER_LAST header");
                            + "set FRACTION_DELIVER_LAST header");
                }
                }
            }
            }
            outStream = op.openOutputStream();


        } catch (IOException e) {
        } catch (IOException e) {
            Log.w(TAG, "sendGetMessageRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e);
            Log.w(TAG, "sendGetMessageRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e);