summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/database
diff options
context:
space:
mode:
authorzachh <zachh@google.com>2017-10-03 17:27:01 -0700
committerEric Erfanian <erfanian@google.com>2017-10-04 08:18:36 -0700
commit5ee0b1e574ed93c7000e355e4a6b03fb9ed8aaba (patch)
treeade09fe638ed0dc2bf65bd64fa6d68a4e51a0b82 /java/com/android/dialer/database
parent01a964d7fbba63c670062ffca9a0ebe30cdcb1ff (diff)
Only show the most recent call type icon in the new call log, instead of the last 3.
This is according to the latest PRD: https://docs.google.com/document/d/1FLoQ6kNYL-QKplbniJAIUCHku87S9eYuYPs6IXe-U78 Also cleaned up warnings in CallLogQueryHandler. Screenshot: https://screenshot.googleplex.com/Z7p4BRVpLpE Bug: 34672501 Test: unit PiperOrigin-RevId: 170941445 Change-Id: Ibf79b70eda3837ea46d365729aaed0a87961e42b
Diffstat (limited to 'java/com/android/dialer/database')
-rw-r--r--java/com/android/dialer/database/CallLogQueryHandler.java61
1 files changed, 14 insertions, 47 deletions
diff --git a/java/com/android/dialer/database/CallLogQueryHandler.java b/java/com/android/dialer/database/CallLogQueryHandler.java
index 4867d9dce..35250d668 100644
--- a/java/com/android/dialer/database/CallLogQueryHandler.java
+++ b/java/com/android/dialer/database/CallLogQueryHandler.java
@@ -54,12 +54,9 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler {
*/
public static final int CALL_TYPE_ALL = -1;
- private static final String TAG = "CallLogQueryHandler";
private static final int NUM_LOGS_TO_DISPLAY = 1000;
/** The token for the query to fetch the old entries from the call log. */
private static final int QUERY_CALLLOG_TOKEN = 54;
- /** The token for the query to mark all missed calls as old after seeing the call log. */
- private static final int UPDATE_MARK_AS_OLD_TOKEN = 55;
/** The token for the query to mark all missed calls as read after seeing the call log. */
private static final int UPDATE_MARK_MISSED_CALL_AS_READ_TOKEN = 56;
/** The token for the query to fetch voicemail status messages. */
@@ -82,7 +79,7 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler {
Context context, ContentResolver contentResolver, Listener listener, int limit) {
super(contentResolver);
mContext = context.getApplicationContext();
- mListener = new WeakReference<Listener>(listener);
+ mListener = new WeakReference<>(listener);
mLogLimit = limit;
}
@@ -107,10 +104,6 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler {
}
}
- public void fetchCalls(int callType) {
- fetchCalls(callType, 0);
- }
-
public void fetchVoicemailStatus() {
StringBuilder where = new StringBuilder();
List<String> selectionArgs = new ArrayList<>();
@@ -226,28 +219,6 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler {
cancelOperation(QUERY_CALLLOG_TOKEN);
}
- /** Updates all new calls to mark them as old. */
- public void markNewCallsAsOld() {
- if (!PermissionsUtil.hasPhonePermissions(mContext)) {
- return;
- }
- // Mark all "new" calls as not new anymore.
- StringBuilder where = new StringBuilder();
- where.append(Calls.NEW);
- where.append(" = 1");
-
- ContentValues values = new ContentValues(1);
- values.put(Calls.NEW, "0");
-
- startUpdate(
- UPDATE_MARK_AS_OLD_TOKEN,
- null,
- TelecomUtil.getCallLogUri(mContext),
- values,
- where.toString(),
- null);
- }
-
/** Updates all missed calls to mark them as read. */
public void markMissedCallsAsRead() {
if (!PermissionsUtil.hasPhonePermissions(mContext)) {
@@ -316,19 +287,19 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler {
*/
private boolean updateAdapterData(Cursor cursor) {
final Listener listener = mListener.get();
- if (listener != null) {
- return listener.onCallsFetched(cursor);
- }
- return false;
+ return listener != null && listener.onCallsFetched(cursor);
}
/** @return Query string to get all unread missed calls. */
private String getUnreadMissedCallsQuery() {
- StringBuilder where = new StringBuilder();
- where.append(Calls.IS_READ).append(" = 0 OR ").append(Calls.IS_READ).append(" IS NULL");
- where.append(" AND ");
- where.append(Calls.TYPE).append(" = ").append(Calls.MISSED_TYPE);
- return where.toString();
+ return Calls.IS_READ
+ + " = 0 OR "
+ + Calls.IS_READ
+ + " IS NULL"
+ + " AND "
+ + Calls.TYPE
+ + " = "
+ + Calls.MISSED_TYPE;
}
private void updateVoicemailStatus(Cursor statusCursor) {
@@ -365,7 +336,7 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler {
void onMissedCallsUnreadCountFetched(Cursor cursor);
/**
- * Called when {@link CallLogQueryHandler#fetchCalls(int)} complete. Returns true if takes
+ * Called when {@link CallLogQueryHandler#fetchCalls(int, long)} complete. Returns true if takes
* ownership of cursor.
*/
boolean onCallsFetched(Cursor combinedCursor);
@@ -375,9 +346,9 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler {
* Simple handler that wraps background calls to catch {@link SQLiteException}, such as when the
* disk is full.
*/
- protected class CatchingWorkerHandler extends AsyncQueryHandler.WorkerHandler {
+ private class CatchingWorkerHandler extends AsyncQueryHandler.WorkerHandler {
- public CatchingWorkerHandler(Looper looper) {
+ CatchingWorkerHandler(Looper looper) {
super(looper);
}
@@ -386,11 +357,7 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler {
try {
// Perform same query while catching any exceptions
super.handleMessage(msg);
- } catch (SQLiteDiskIOException e) {
- LogUtil.e("CallLogQueryHandler.handleMessage", "exception on background worker thread", e);
- } catch (SQLiteFullException e) {
- LogUtil.e("CallLogQueryHandler.handleMessage", "exception on background worker thread", e);
- } catch (SQLiteDatabaseCorruptException e) {
+ } catch (SQLiteDiskIOException | SQLiteFullException | SQLiteDatabaseCorruptException e) {
LogUtil.e("CallLogQueryHandler.handleMessage", "exception on background worker thread", e);
} catch (IllegalArgumentException e) {
LogUtil.e("CallLogQueryHandler.handleMessage", "contactsProvider not present on device", e);