Adding 1000 entry limit to number of call logs shown.

Reduces the time to show call logs since every entry must be looked
at for aggregation.  For people with a large amount of calls, this
improves load time by ~30% for 5k entries and ~50% for 10k entries.

Bug: 6849968

Change-Id: I84dd70b3705811f381f677596f1c19345cf218db
diff --git a/src/com/android/contacts/calllog/CallLogQueryHandler.java b/src/com/android/contacts/calllog/CallLogQueryHandler.java
index ba604cd..690852c 100644
--- a/src/com/android/contacts/calllog/CallLogQueryHandler.java
+++ b/src/com/android/contacts/calllog/CallLogQueryHandler.java
@@ -26,6 +26,7 @@
 import android.database.sqlite.SQLiteDiskIOException;
 import android.database.sqlite.SQLiteException;
 import android.database.sqlite.SQLiteFullException;
+import android.net.Uri;
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
@@ -48,6 +49,7 @@
     private static final String[] EMPTY_STRING_ARRAY = new String[0];
 
     private static final String TAG = "CallLogQueryHandler";
+    private static final int NUM_LOGS_TO_DISPLAY = 1000;
 
     /** The token for the query to fetch the new entries from the call log. */
     private static final int QUERY_NEW_CALLS_TOKEN = 53;
@@ -199,7 +201,10 @@
             selection = String.format("(%s) AND (%s = ?)", selection, Calls.TYPE);
             selectionArgs.add(Integer.toString(Calls.VOICEMAIL_TYPE));
         }
-        startQuery(token, requestId, Calls.CONTENT_URI_WITH_VOICEMAIL,
+        Uri uri = Calls.CONTENT_URI_WITH_VOICEMAIL.buildUpon()
+                .appendQueryParameter(Calls.LIMIT_PARAM_KEY, Integer.toString(NUM_LOGS_TO_DISPLAY))
+                .build();
+        startQuery(token, requestId, uri,
                 CallLogQuery._PROJECTION, selection, selectionArgs.toArray(EMPTY_STRING_ARRAY),
                 Calls.DEFAULT_SORT_ORDER);
     }