summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/map
diff options
context:
space:
mode:
authorPradeep Panigrahi <pradeepp@codeaurora.org>2015-01-23 19:16:40 +0530
committerPradeep Panigrahi <pradeepp@codeaurora.org>2015-02-03 11:48:37 +0530
commit231682f6c01c81d5af13abcdb003d67ea65d6216 (patch)
tree508af32c3bd6774ae2452bd955a51af3312400b3 /src/com/android/bluetooth/map
parent70f0c7b34fb0539ffeacd11fbf46d5a9fd4dfd50 (diff)
downloadandroid_packages_apps_Bluetooth-231682f6c01c81d5af13abcdb003d67ea65d6216.tar.gz
android_packages_apps_Bluetooth-231682f6c01c81d5af13abcdb003d67ea65d6216.tar.bz2
android_packages_apps_Bluetooth-231682f6c01c81d5af13abcdb003d67ea65d6216.zip
MAP: Bug fixes on Map Profile.
Added following bug fixes: 1) Optimize GET MessagesListing operation Modify sqlite database query to fetch only 'MaxListCount' elements starting from 'ListStartOffset' instead of fetching the complete database and filter out, when these parameters are specified in the GET MessagesListing Request. 2) Change to set empty sender addressing in message listing element if it is null. 3) set empty sender name in message lsiting element if null. Change-Id: I27ba852628e0455905dcd6d37ee045da6b5afc77 CRs-fixed: 785977
Diffstat (limited to 'src/com/android/bluetooth/map')
-rw-r--r--src/com/android/bluetooth/map/BluetoothMapContent.java54
-rw-r--r--src/com/android/bluetooth/map/BluetoothMapMessageListingElement.java2
2 files changed, 43 insertions, 13 deletions
diff --git a/src/com/android/bluetooth/map/BluetoothMapContent.java b/src/com/android/bluetooth/map/BluetoothMapContent.java
index 63ac86ee5..05cd7c46c 100644
--- a/src/com/android/bluetooth/map/BluetoothMapContent.java
+++ b/src/com/android/bluetooth/map/BluetoothMapContent.java
@@ -929,6 +929,10 @@ public class BluetoothMapContent {
}
}
+ if( name ==null) {
+ //set empty value
+ name = "";
+ }
if (D) Log.d(TAG, "setSenderName: " + name);
e.setSenderName(name);
}
@@ -2213,7 +2217,16 @@ public class BluetoothMapContent {
fi.msgType = FilterInfo.TYPE_EMAIL;
String where = setWhereFilter(folder, fi, ap);
- Log.d(TAG, "where clause is = " + where);
+ where+= " AND "+ Message.FLAG_LOADED_SELECTION;
+ where+= " order by timeStamp desc ";
+ //Fetch only maxListCount emails from startOffset
+ if(ap.getMaxListCount() > 0 && ap.getMaxListCount() < 65536) {
+ where+=" LIMIT "+ap.getMaxListCount();
+ }
+ if(ap.getStartOffset() > 0 && ap.getStartOffset() < 65536) {
+ where+=" OFFSET "+ap.getStartOffset();
+ }
+ if (V) Log.d(TAG, "where clause is = " + where);
try {
Cursor c = mResolver.query(uriEmail,
EMAIL_PROJECTION, where + " AND " + Message.FLAG_LOADED_SELECTION, null, "timeStamp desc");
@@ -2239,7 +2252,8 @@ public class BluetoothMapContent {
/* Enable this if post sorting and segmenting needed */
bmList.sort();
- bmList.segment(ap.getMaxListCount(), ap.getStartOffset());
+ //Handle OFFSET and MAXLISTCOUNT from DB query
+ //bmList.segment(ap.getMaxListCount(), ap.getStartOffset());
return bmList;
}
@@ -2325,10 +2339,18 @@ public class BluetoothMapContent {
fi.msgType = FilterInfo.TYPE_SMS;
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");
-
+ Cursor c =null;
+ //Fetch only maxListCount messages from startOffset
+ if(ap.getStartOffset() > 0 && ap.getStartOffset() < 65536) {
+ c = mResolver.query(Sms.CONTENT_URI,
+ SMS_PROJECTION, where, null, "date DESC" + " limit " +
+ ap.getMaxListCount()+" offset "+ ap.getStartOffset());
+ }else {
+ c = mResolver.query(Sms.CONTENT_URI,
+ SMS_PROJECTION, where, null, "date DESC" + " limit " +
+ ap.getMaxListCount());
+ }
+ if (V) Log.d(TAG, "where clause is = " + where);
if (c != null) {
while (c.moveToNext()) {
if (matchAddresses(c, fi, ap)) {
@@ -2344,12 +2366,20 @@ public class BluetoothMapContent {
if (mmsSelected(fi, ap)) {
fi.msgType = FilterInfo.TYPE_MMS;
-
String where = setWhereFilter(folder, fi, ap);
where += " AND " + INTERESTED_MESSAGE_TYPE_CLAUSE;
- Cursor c = mResolver.query(Mms.CONTENT_URI,
- MMS_PROJECTION, where, null, "date DESC");
-
+ Cursor c =null;
+ //Fetch only maxListCount messages from startOffset
+ if(ap.getStartOffset() > 0 && ap.getStartOffset() < 65536) {
+ c = mResolver.query(Mms.CONTENT_URI,
+ MMS_PROJECTION, where, null, "date DESC" + " limit " +
+ ap.getMaxListCount()+" offset "+ ap.getStartOffset());
+ } else {
+ c = mResolver.query(Mms.CONTENT_URI,
+ MMS_PROJECTION, where, null, "date DESC" + " limit " +
+ ap.getMaxListCount());
+ }
+ if (V) Log.d(TAG, "where clause is = " + where);
if (c != null) {
int cnt = 0;
while (c.moveToNext()) {
@@ -2362,10 +2392,10 @@ public class BluetoothMapContent {
c.close();
}
}
-
/* Enable this if post sorting and segmenting needed */
bmList.sort();
- bmList.segment(ap.getMaxListCount(), ap.getStartOffset());
+ //Handle OFFSET and MAXLISTCOUNT from DB query
+ //bmList.segment(ap.getMaxListCount(), ap.getStartOffset());
return bmList;
}
diff --git a/src/com/android/bluetooth/map/BluetoothMapMessageListingElement.java b/src/com/android/bluetooth/map/BluetoothMapMessageListingElement.java
index d3d892e1c..2d84a049a 100644
--- a/src/com/android/bluetooth/map/BluetoothMapMessageListingElement.java
+++ b/src/com/android/bluetooth/map/BluetoothMapMessageListingElement.java
@@ -116,7 +116,7 @@ public class BluetoothMapMessageListingElement
*/
this.senderAddressing = PhoneNumberUtils.extractNetworkPortion(senderAddressing);
if(this.senderAddressing == null || this.senderAddressing.length() < 2){
- this.senderAddressing = "11"; // Ensure we have at least two digits to
+ this.senderAddressing = ""; // Set empty value
}
}