diff options
author | Casper Bonde <c.bonde@samsung.com> | 2014-09-10 11:02:38 +0200 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2014-09-12 14:37:14 -0700 |
commit | 8b17c7f2f98bbea105a41a0bb962a4581b7cce5c (patch) | |
tree | 2f80eccf2c97078b4596bee18174796b78ca0b21 /src/com/android/bluetooth/map | |
parent | 7ac43d2e29e3405b4df2e9ebd947ae7a9d10e8a0 (diff) | |
download | android_packages_apps_Bluetooth-8b17c7f2f98bbea105a41a0bb962a4581b7cce5c.tar.gz android_packages_apps_Bluetooth-8b17c7f2f98bbea105a41a0bb962a4581b7cce5c.tar.bz2 android_packages_apps_Bluetooth-8b17c7f2f98bbea105a41a0bb962a4581b7cce5c.zip |
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: Casper Bonde <c.bonde@samsung.com>
Diffstat (limited to 'src/com/android/bluetooth/map')
-rw-r--r-- | src/com/android/bluetooth/map/BluetoothMapContent.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/com/android/bluetooth/map/BluetoothMapContent.java b/src/com/android/bluetooth/map/BluetoothMapContent.java index 58bfc5289..41df206e6 100644 --- a/src/com/android/bluetooth/map/BluetoothMapContent.java +++ b/src/com/android/bluetooth/map/BluetoothMapContent.java @@ -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); } |