summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkschulz <k.schulz@samsung.com>2013-10-11 15:13:25 +0200
committerZhihai Xu <zhihaixu@google.com>2014-03-08 00:17:20 -0800
commit6d4c5c8befa3e585271ed4db770dd6990827d1f0 (patch)
tree58b3aa64599edc7ce6da19e80b8b5b8120c5f489
parentd3195daf68329036df6a01331b466844b5cb29de (diff)
downloadandroid_packages_apps_Bluetooth-6d4c5c8befa3e585271ed4db770dd6990827d1f0.tar.gz
android_packages_apps_Bluetooth-6d4c5c8befa3e585271ed4db770dd6990827d1f0.tar.bz2
android_packages_apps_Bluetooth-6d4c5c8befa3e585271ed4db770dd6990827d1f0.zip
DO NOT MERGE MAP: fixed missing filtering on Priority
FilterPriority was ignored in the code as SMS does not have priority. This fixes the support for the priority filter for sms + mms. NOTICE: sms messages does not have priority and hence will return an empty messagelisting if the client requests a list with priority filter set til high-pri only. Bug: 11168636 Change-Id: If028e47850323d20d1e9a23bc947782ae8da1df0
-rw-r--r--src/com/android/bluetooth/map/BluetoothMapContent.java57
1 files changed, 42 insertions, 15 deletions
diff --git a/src/com/android/bluetooth/map/BluetoothMapContent.java b/src/com/android/bluetooth/map/BluetoothMapContent.java
index 1108a48c7..588b6ac64 100644
--- a/src/com/android/bluetooth/map/BluetoothMapContent.java
+++ b/src/com/android/bluetooth/map/BluetoothMapContent.java
@@ -38,6 +38,7 @@ import android.util.Log;
import com.android.bluetooth.map.BluetoothMapUtils.TYPE;
import com.google.android.mms.pdu.CharacterSets;
+import com.google.android.mms.pdu.PduHeaders;
public class BluetoothMapContent {
private static final String TAG = "BluetoothMapContent";
@@ -389,8 +390,15 @@ public class BluetoothMapContent {
private void setPriority(BluetoothMapMessageListingElement e, Cursor c,
FilterInfo fi, BluetoothMapAppParams ap) {
+ String priority = "no";
if ((ap.getParameterMask() & MASK_PRIORITY) != 0) {
- String priority = "no";
+ int pri = 0;
+ if (fi.msgType == FilterInfo.TYPE_MMS) {
+ pri = c.getInt(c.getColumnIndex(Mms.PRIORITY));
+ }
+ if (pri == PduHeaders.PRIORITY_HIGH) {
+ priority = "yes";
+ }
if (D) Log.d(TAG, "setPriority: " + priority);
e.setPriority(priority);
}
@@ -1051,6 +1059,23 @@ public class BluetoothMapContent {
return where;
}
+ private String setWhereFilterPriority(BluetoothMapAppParams ap, FilterInfo fi) {
+ String where = "";
+ int pri = ap.getFilterPriority();
+ /*only MMS have priority info */
+ if(fi.msgType == FilterInfo.TYPE_MMS)
+ {
+ if(pri == 0x0002)
+ {
+ where += " AND " + Mms.PRIORITY + "<=" +
+ Integer.toString(PduHeaders.PRIORITY_NORMAL);
+ }else if(pri == 0x0001) {
+ where += " AND " + Mms.PRIORITY + "=" +
+ Integer.toString(PduHeaders.PRIORITY_HIGH);
+ }
+ }
+ return where;
+ }
private String setWhereFilterRecipient(BluetoothMapAppParams ap,
FilterInfo fi) {
@@ -1094,6 +1119,7 @@ public class BluetoothMapContent {
where += setWhereFilterFolderType(folder, fi);
where += setWhereFilterReadStatus(ap);
where += setWhereFilterPeriod(ap, fi);
+ where += setWhereFilterPriority(ap,fi);
/* where += setWhereFilterOriginator(ap, fi); */
/* where += setWhereFilterRecipient(ap, fi); */
@@ -1155,21 +1181,22 @@ public class BluetoothMapContent {
if (smsSelected(fi, ap)) {
fi.msgType = FilterInfo.TYPE_SMS;
-
- String where = setWhereFilter(folder, fi, ap);
-
- Cursor c = mResolver.query(Sms.CONTENT_URI,
- SMS_PROJECTION, where, null, "date DESC");
-
- if (c != null) {
- while (c.moveToNext()) {
- if (matchAddresses(c, fi, ap)) {
- printSms(c);
- e = element(c, fi, ap);
- bmList.add(e);
+ if(ap.getFilterPriority() != 1){ /*SMS cannot have high priority*/
+ String where = setWhereFilter(folder, fi, ap);
+
+ Cursor c = mResolver.query(Sms.CONTENT_URI,
+ SMS_PROJECTION, where, null, "date DESC");
+
+ if (c != null) {
+ while (c.moveToNext()) {
+ if (matchAddresses(c, fi, ap)) {
+ printSms(c);
+ e = element(c, fi, ap);
+ bmList.add(e);
+ }
}
+ c.close();
}
- c.close();
}
}
@@ -1256,7 +1283,7 @@ public class BluetoothMapContent {
where += " AND read=0 ";
where += setWhereFilterPeriod(ap, fi);
Cursor c = mResolver.query(Sms.CONTENT_URI,
- SMS_PROJECTION, where, null, "date DESC");
+ SMS_PROJECTION, where, null, "date DESC");
if (c != null) {
cnt = c.getCount();