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

Commit 081b680e authored by Casper Bonde's avatar Casper Bonde Committed by Matthew Xie
Browse files

MAP: Workaround for missing size values in message data base



Not all messages in the MMS/Email message data bases have
the size/attachment size attribute set.

This causes MAP clients to behave wrongly, e.g. they
request to exclude attachments if the attachments size
is 0. Even for messages which actually have attachments.

The attachment size is the only way for MAP clients to
know if attachments are present, hence the behavior of
the client is not wrong.
bug 17389452

Change-Id: I82cd76bc044601eb6e8b190d0c6fc41b51410a93
Signed-off-by: default avatarCasper Bonde <c.bonde@samsung.com>
parent c96fc1c5
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -459,12 +459,22 @@ public class BluetoothMapContent {
            if (fi.mMsgType == FilterInfo.TYPE_MMS) {
                if(c.getInt(fi.mMmsColTextOnly) == 0) {
                    size = c.getInt(fi.mMmsColAttachmentSize);
                    if(size <= 0) {
                        // We know there are attachments, since it is not TextOnly
                        // Hence the size in the database must be wrong.
                        // Set size to 1 to indicate to the client, that attachments are present
                        if (D) Log.d(TAG, "Error in message database, size reported as: " + size
                                + " Changing size to 1");
                        size = 1;
                    }
                }
            } else if (fi.mMsgType == FilterInfo.TYPE_EMAIL) {
                int attachment = c.getInt(fi.mEmailColAttachment);
                size = c.getInt(fi.mEmailColAttachementSize);
                if(attachment == 1 && size == 0) {
                    size = 1; /* Ensure we indicate we have attachments in the size, it the
                    if (D) Log.d(TAG, "Error in message database, attachment size reported as: " + size
                            + " Changing size to 1");
                    size = 1; /* Ensure we indicate we have attachments in the size, if the
                                 message has attachments, in case the e-mail client do not
                                 report a size */
                }
@@ -522,6 +532,14 @@ public class BluetoothMapContent {
            } else if (fi.mMsgType == FilterInfo.TYPE_EMAIL) {
                size = c.getInt(fi.mEmailColSize);
            }
            if(size <= 0) {
                // A message cannot have size 0
                // Hence the size in the database must be wrong.
                // Set size to 1 to indicate to the client, that the message has content.
                if (D) Log.d(TAG, "Error in message database, size reported as: " + size
                        + " Changing size to 1");
                size = 1;
            }
            if (V) Log.d(TAG, "setSize: " + size);
            e.setSize(size);
        }