diff options
author | zachh <zachh@google.com> | 2017-08-15 18:13:03 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-08-30 03:45:26 +0000 |
commit | 4e9a7930756e2e1dbfba20355f8f716987835a3a (patch) | |
tree | a4434a38478029d4f8c44396b0a2b82c20d90622 /java/com/android/dialer/calllog/database | |
parent | f1fa776384ceab6682ad86348e3d08e3ca2b983b (diff) |
Added a few more columns to annotated call log.
These are mostly columns that are just copied from the system call log.
Also refactored and implemented new logic for displaying call log durations and dates (not used yet).
Bug: 34672501
Test: existing and new
PiperOrigin-RevId: 165387731
Change-Id: I2bc736d848b5c10e42562e62beea64efdeed9c12
Diffstat (limited to 'java/com/android/dialer/calllog/database')
4 files changed, 130 insertions, 6 deletions
diff --git a/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java b/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java index 30aa2bff5..9a3d2e20f 100644 --- a/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java +++ b/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java @@ -112,7 +112,9 @@ public class AnnotatedCallLogContentProvider extends ContentProvider { } return cursor; case COALESCED_ANNOTATED_CALL_LOG_TABLE_CODE: - Assert.checkArgument(projection == null, "projection not supported for coalesced call log"); + Assert.checkArgument( + projection == CoalescedAnnotatedCallLog.ALL_COLUMNS, + "only ALL_COLUMNS projection supported for coalesced call log"); Assert.checkArgument(selection == null, "selection not supported for coalesced call log"); Assert.checkArgument( selectionArgs == null, "selection args not supported for coalesced call log"); diff --git a/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java b/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java index 5f48d7b1f..ebfd3c79b 100644 --- a/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java +++ b/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java @@ -35,9 +35,20 @@ class AnnotatedCallLogDatabaseHelper extends SQLiteOpenHelper { private static final String CREATE_TABLE_SQL = new StringBuilder() .append("create table if not exists " + AnnotatedCallLog.TABLE + " (") + // Common columns. .append(AnnotatedCallLog._ID + " integer primary key, ") .append(AnnotatedCallLog.TIMESTAMP + " integer, ") - .append(AnnotatedCallLog.CONTACT_NAME + " string, ") + .append(AnnotatedCallLog.PRIMARY_TEXT + " string, ") + .append(AnnotatedCallLog.CONTACT_PHOTO_URI + " string, ") + .append(AnnotatedCallLog.NUMBER_TYPE_LABEL + " string, ") + .append(AnnotatedCallLog.IS_READ + " integer, ") + .append(AnnotatedCallLog.GEOCODED_LOCATION + " string, ") + .append(AnnotatedCallLog.PHONE_ACCOUNT_LABEL + " string, ") + .append(AnnotatedCallLog.PHONE_ACCOUNT_COLOR + " integer, ") + .append(AnnotatedCallLog.FEATURES + " integer, ") + .append(AnnotatedCallLog.IS_BUSINESS + " integer, ") + .append(AnnotatedCallLog.IS_VOICEMAIL + " integer, ") + // Columns only in AnnotatedCallLog .append(AnnotatedCallLog.NUMBER + " blob") .append(");") .toString(); diff --git a/java/com/android/dialer/calllog/database/annotated_call_log.proto b/java/com/android/dialer/calllog/database/annotated_call_log.proto new file mode 100644 index 000000000..eb0ee52ce --- /dev/null +++ b/java/com/android/dialer/calllog/database/annotated_call_log.proto @@ -0,0 +1,14 @@ +syntax = "proto2"; + +option java_package = "com.android.dialer"; +option java_multiple_files = true; +option optimize_for = LITE_RUNTIME; + +// DIALER_SCRUB.UNCOMMENT_IN_OPEN_SOURCE option optimize_for = LITE_RUNTIME; + +package com.android.dialer; + +// A list of android.provider.CallLog.Calls.TYPE values. +message CallTypes { + repeated int32 type = 1; +} diff --git a/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java b/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java index 7f314e37c..172006878 100644 --- a/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java +++ b/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java @@ -42,13 +42,103 @@ public class AnnotatedCallLogContract { String TIMESTAMP = "timestamp"; /** - * Name to display for the entry. + * Primary text to display for the entry. This could be a name from a local contact or caller ID + * data source, or it could just be a phone number, for example. + * + * <p>This is exactly how it should appear to the user. If the user's locale or name display + * preferences change, this column should be rewritten. * * <p>Type: TEXT */ - String CONTACT_NAME = "contact_name"; + String PRIMARY_TEXT = "primary_text"; + + /** + * Local photo URI for the contact associated with the phone number, if it exists. + * + * <p>Photos currently only come from local contacts database and not caller ID sources. If + * there is no photo for a contact then an appropriate letter tile should be drawn. + * + * <p>TYPE: TEXT + */ + String CONTACT_PHOTO_URI = "contact_photo_uri"; + + // TODO(zachh): If we need to support photos other than local contacts', add a (blob?) column. + + /** + * The number type as a string to be displayed to the user, for example "Home" or "Mobile". + * + * <p>This column should be updated for the appropriate language when the locale changes. + * + * <p>TYPE: TEXT + */ + String NUMBER_TYPE_LABEL = "number_type_label"; + + /** + * See CallLog.Calls.IS_READ. + * + * <p>TYPE: INTEGER (boolean) + */ + String IS_READ = "is_read"; - String[] ALL_COMMON_COLUMNS = new String[] {_ID, TIMESTAMP, CONTACT_NAME}; + /** + * See CallLog.Calls.GEOCODED_LOCATION. + * + * <p>TYPE: TEXT + */ + String GEOCODED_LOCATION = "geocoded_location"; + + /** + * String suitable for display which indicates the phone account used to make the call. + * + * <p>TYPE: TEXT + */ + String PHONE_ACCOUNT_LABEL = "phone_account_label"; + + /** + * The color int for the phone account. + * + * <p>TYPE: INTEGER (int) + */ + String PHONE_ACCOUNT_COLOR = "phone_account_color"; + + /** + * See CallLog.Calls.FEATURES. + * + * <p>TYPE: INTEGER (int) + */ + String FEATURES = "features"; + + /** + * True if a caller ID data source informed us that this is a business number. This is used to + * determine if a generic business avatar should be shown vs. a generic person avatar. + * + * <p>TYPE: INTEGER (boolean) + */ + String IS_BUSINESS = "is_business"; + + /** + * True if this was a call to voicemail. This is used to determine if the voicemail avatar + * should be displayed. + * + * <p>TYPE: INTEGER (boolean) + */ + String IS_VOICEMAIL = "is_voicemail"; + + String[] ALL_COMMON_COLUMNS = + new String[] { + _ID, + TIMESTAMP, + PRIMARY_TEXT, + CONTACT_PHOTO_URI, + NUMBER_TYPE_LABEL, + IS_READ, + GEOCODED_LOCATION, + PHONE_ACCOUNT_LABEL, + PHONE_ACCOUNT_COLOR, + FEATURES, + IS_BUSINESS, + IS_VOICEMAIL + }; } /** @@ -116,11 +206,18 @@ public class AnnotatedCallLogContract { public static final String FORMATTED_NUMBER = "formatted_number"; /** + * The call types of the most recent 3 calls, encoded as a CallTypes proto. + * + * <p>TYPE: BLOB + */ + public static final String CALL_TYPES = "call_types"; + + /** * Columns that are only in the {@link CoalescedAnnotatedCallLog} but not the {@link * AnnotatedCallLog}. */ private static final String[] COLUMNS_ONLY_IN_COALESCED_CALL_LOG = - new String[] {NUMBER_CALLS, FORMATTED_NUMBER}; + new String[] {NUMBER_CALLS, FORMATTED_NUMBER, CALL_TYPES}; /** All columns in the {@link CoalescedAnnotatedCallLog}. */ public static final String[] ALL_COLUMNS = |