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

Commit 918b73ab authored by Chiao Cheng's avatar Chiao Cheng
Browse files

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
parent 8076f88c
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.database.sqlite.SQLiteDatabaseCorruptException;
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 @@ import javax.annotation.concurrent.GuardedBy;
    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 @@ import javax.annotation.concurrent.GuardedBy;
            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);
    }