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

Commit c06dad4b authored by Ajay Panicker's avatar Ajay Panicker
Browse files

Allow MAP to accept and list draft messages without recipients

Bug: 28970268
Change-Id: I5bdef6cd67708036352ed37ea35b027d6a54af03
parent 4b84ae98
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -952,7 +952,11 @@ public class BluetoothMapContent {
                    // Fetch address for Drafts folder from "canonical_address" table
                    int threadIdInd = c.getColumnIndex(Sms.THREAD_ID);
                    String threadIdStr = c.getString(threadIdInd);
                    // If a draft message has no recipient, it has no thread ID
                    // hence threadIdStr could possibly be null
                    if (threadIdStr != null) {
                        address = getCanonicalAddressSms(mResolver, Integer.valueOf(threadIdStr));
                    }
                    if(V)  Log.v(TAG, "threadId = " + threadIdStr + " adress:" + address +"\n");
                }
            } else if (fi.mMsgType == FilterInfo.TYPE_MMS) {
@@ -1601,7 +1605,8 @@ public class BluetoothMapContent {
        } else if (BluetoothMapContract.FOLDER_NAME_SENT.equalsIgnoreCase(folder)) {
            where = Sms.TYPE + " = 2 AND " + Sms.THREAD_ID + " <> -1";
        } else if (BluetoothMapContract.FOLDER_NAME_DRAFT.equalsIgnoreCase(folder)) {
            where = Sms.TYPE + " = 3 AND " + Sms.THREAD_ID + " <> -1";
            where = Sms.TYPE + " = 3 AND " +
                "(" + Sms.THREAD_ID + " IS NULL OR " + Sms.THREAD_ID + " <> -1 )";
        } else if (BluetoothMapContract.FOLDER_NAME_DELETED.equalsIgnoreCase(folder)) {
            where = Sms.THREAD_ID + " = -1";
        }
@@ -1618,7 +1623,8 @@ public class BluetoothMapContent {
        } else if (BluetoothMapContract.FOLDER_NAME_SENT.equalsIgnoreCase(folder)) {
            where = Mms.MESSAGE_BOX + " = 2 AND " + Mms.THREAD_ID + " <> -1";
        } else if (BluetoothMapContract.FOLDER_NAME_DRAFT.equalsIgnoreCase(folder)) {
            where = Mms.MESSAGE_BOX + " = 3 AND " + Mms.THREAD_ID + " <> -1";
            where = Mms.MESSAGE_BOX + " = 3 AND " +
                "(" + Mms.THREAD_ID + " IS NULL OR " + Mms.THREAD_ID + " <> -1 )";
        } else if (BluetoothMapContract.FOLDER_NAME_DELETED.equalsIgnoreCase(folder)) {
            where = Mms.THREAD_ID + " = -1";
        }
+10 −2
Original line number Diff line number Diff line
@@ -2442,9 +2442,17 @@ public class BluetoothMapContentObserver {
        long folderId = -1;

        if (recipientList == null) {
            if (D) Log.d(TAG, "empty recipient list");
            if (folderElement.getName().equalsIgnoreCase(BluetoothMapContract.FOLDER_NAME_DRAFT)) {
                BluetoothMapbMessage.vCard empty =
                    new BluetoothMapbMessage.vCard("", "", null, null, 0);
                recipientList = new ArrayList<BluetoothMapbMessage.vCard>();
                recipientList.add(empty);
                Log.w(TAG, "Added empty recipient to draft message");
            } else {
                Log.e(TAG, "Trying to send a message with no recipients");
                return -1;
            }
        }

        if ( msg.getType().equals(TYPE.EMAIL) ) {
            /* Write the message to the database */
+2 −2
Original line number Diff line number Diff line
@@ -993,8 +993,8 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
                return ResponseCodes.OBEX_HTTP_BAD_REQUEST;
            }
            Log.v(TAG,"sendMessageListingRsp: has sms " + folderToList.hasSmsMmsContent() +
                    "has email " + folderToList.hasEmailContent() +
                    "has IM " + folderToList.hasImContent() );
                    ", has email " + folderToList.hasEmailContent() +
                    ", has IM " + folderToList.hasImContent() );
        }

        try {