summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/calllog
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2018-04-16 13:07:20 -0700
committerCopybara-Service <copybara-piper@google.com>2018-04-16 14:43:00 -0700
commit3865d300feeab8c7695762e86004804c052577ae (patch)
tree4722ba29c1ea8e58d0c01cb8996cc964c1c3a6e0 /java/com/android/dialer/calllog
parentc298ec9c33d105971dbe612cd7798f5e9af34f71 (diff)
Remove column PHONE_ACCOUNT_LABEL and PHONE_ACCOUNT_COLOR from the annotated call log.
Bug: 77808449 Test: NewCallLogViewHolderTest + existing tests for the call log framework PiperOrigin-RevId: 193086917 Change-Id: I39244c69acf1d261699610f6010c0cf147ca3492
Diffstat (limited to 'java/com/android/dialer/calllog')
-rw-r--r--java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java2
-rw-r--r--java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java20
-rw-r--r--java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java36
-rw-r--r--java/com/android/dialer/calllog/model/coalesced_row.proto20
-rw-r--r--java/com/android/dialer/calllog/ui/CoalescedAnnotatedCallLogCursorLoader.java20
-rw-r--r--java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java32
6 files changed, 42 insertions, 88 deletions
diff --git a/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java b/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java
index 7df83b3d1..66ba8aa59 100644
--- a/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java
+++ b/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java
@@ -68,8 +68,6 @@ public class AnnotatedCallLogDatabaseHelper extends SQLiteOpenHelper {
+ (AnnotatedCallLog.GEOCODED_LOCATION + " text, ")
+ (AnnotatedCallLog.PHONE_ACCOUNT_COMPONENT_NAME + " text, ")
+ (AnnotatedCallLog.PHONE_ACCOUNT_ID + " text, ")
- + (AnnotatedCallLog.PHONE_ACCOUNT_LABEL + " text, ")
- + (AnnotatedCallLog.PHONE_ACCOUNT_COLOR + " integer, ")
+ (AnnotatedCallLog.FEATURES + " integer, ")
+ (AnnotatedCallLog.TRANSCRIPTION + " integer, ")
+ (AnnotatedCallLog.VOICEMAIL_URI + " text, ")
diff --git a/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java b/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java
index b1cf6e495..5e4e4afd3 100644
--- a/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java
+++ b/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java
@@ -103,20 +103,6 @@ public class AnnotatedCallLogContract {
String PHONE_ACCOUNT_ID = "phone_account_id";
/**
- * 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 {@link android.provider.CallLog.Calls#FEATURES}.
*
* <p>TYPE: INTEGER (int)
@@ -170,8 +156,6 @@ public class AnnotatedCallLogContract {
GEOCODED_LOCATION,
PHONE_ACCOUNT_COMPONENT_NAME,
PHONE_ACCOUNT_ID,
- PHONE_ACCOUNT_LABEL,
- PHONE_ACCOUNT_COLOR,
FEATURES,
NUMBER_ATTRIBUTES,
IS_VOICEMAIL_CALL,
@@ -223,9 +207,9 @@ public class AnnotatedCallLogContract {
public static final String TRANSCRIPTION = "transcription";
/**
- * See {@link VoicemailCompat.TRANSCRIPTION_STATE}
+ * See {@link VoicemailCompat#TRANSCRIPTION_STATE}
*
- * <p>Only populated in {@link Build.VERSION_CODES.O} and above
+ * <p>Only populated in {@link Build.VERSION_CODES#O} and above
*
* <p>TYPE: INTEGER
*/
diff --git a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java
index df4e66e8b..99c3c9d0c 100644
--- a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java
+++ b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java
@@ -29,13 +29,10 @@ import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.provider.VoicemailContract;
import android.provider.VoicemailContract.Voicemails;
-import android.support.annotation.ColorInt;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.annotation.VisibleForTesting;
import android.support.annotation.WorkerThread;
-import android.telecom.PhoneAccount;
-import android.telecom.PhoneAccountHandle;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.util.ArraySet;
@@ -46,7 +43,6 @@ import com.android.dialer.calllog.datasources.CallLogDataSource;
import com.android.dialer.calllog.datasources.CallLogMutations;
import com.android.dialer.calllog.datasources.util.RowCombiner;
import com.android.dialer.calllog.observer.MarkDirtyObserver;
-import com.android.dialer.calllogutils.PhoneAccountUtils;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor;
@@ -55,8 +51,6 @@ import com.android.dialer.duo.DuoConstants;
import com.android.dialer.inject.ApplicationContext;
import com.android.dialer.phonenumberproto.DialerPhoneNumberUtil;
import com.android.dialer.storage.Unencrypted;
-import com.android.dialer.telecom.TelecomUtil;
-import com.android.dialer.theme.R;
import com.android.dialer.util.PermissionsUtil;
import com.google.common.collect.Iterables;
import com.google.common.util.concurrent.Futures;
@@ -236,8 +230,6 @@ public class SystemCallLogDataSource implements CallLogDataSource {
.useMostRecentString(AnnotatedCallLog.GEOCODED_LOCATION)
.useSingleValueString(AnnotatedCallLog.PHONE_ACCOUNT_COMPONENT_NAME)
.useSingleValueString(AnnotatedCallLog.PHONE_ACCOUNT_ID)
- .useSingleValueString(AnnotatedCallLog.PHONE_ACCOUNT_LABEL)
- .useSingleValueLong(AnnotatedCallLog.PHONE_ACCOUNT_COLOR)
.useMostRecentLong(AnnotatedCallLog.CALL_TYPE)
// If any call in a group includes a feature (like Wifi/HD), consider the group to have the
// feature.
@@ -372,8 +364,6 @@ public class SystemCallLogDataSource implements CallLogDataSource {
contentValues.put(AnnotatedCallLog.GEOCODED_LOCATION, geocodedLocation);
contentValues.put(AnnotatedCallLog.PHONE_ACCOUNT_COMPONENT_NAME, phoneAccountComponentName);
contentValues.put(AnnotatedCallLog.PHONE_ACCOUNT_ID, phoneAccountId);
- populatePhoneAccountLabelAndColor(
- appContext, contentValues, phoneAccountComponentName, phoneAccountId);
contentValues.put(AnnotatedCallLog.FEATURES, features);
contentValues.put(AnnotatedCallLog.DURATION, duration);
contentValues.put(AnnotatedCallLog.DATA_USAGE, dataUsage);
@@ -458,32 +448,6 @@ public class SystemCallLogDataSource implements CallLogDataSource {
return PROJECTION_PRE_O;
}
- private void populatePhoneAccountLabelAndColor(
- Context appContext,
- ContentValues contentValues,
- String phoneAccountComponentName,
- String phoneAccountId) {
- PhoneAccountHandle phoneAccountHandle =
- TelecomUtil.composePhoneAccountHandle(phoneAccountComponentName, phoneAccountId);
- if (phoneAccountHandle == null) {
- return;
- }
- String label = PhoneAccountUtils.getAccountLabel(appContext, phoneAccountHandle);
- if (TextUtils.isEmpty(label)) {
- return;
- }
- contentValues.put(AnnotatedCallLog.PHONE_ACCOUNT_LABEL, label);
-
- @ColorInt int color = PhoneAccountUtils.getAccountColor(appContext, phoneAccountHandle);
- if (color == PhoneAccount.NO_HIGHLIGHT_COLOR) {
- color =
- appContext
- .getResources()
- .getColor(R.color.dialer_secondary_text_color, appContext.getTheme());
- }
- contentValues.put(AnnotatedCallLog.PHONE_ACCOUNT_COLOR, color);
- }
-
private static void handleDeletes(
Context appContext, Set<Long> existingAnnotatedCallLogIds, CallLogMutations mutations) {
Set<Long> systemCallLogIds =
diff --git a/java/com/android/dialer/calllog/model/coalesced_row.proto b/java/com/android/dialer/calllog/model/coalesced_row.proto
index 3cb10e7a6..913f07298 100644
--- a/java/com/android/dialer/calllog/model/coalesced_row.proto
+++ b/java/com/android/dialer/calllog/model/coalesced_row.proto
@@ -12,7 +12,7 @@ import "java/com/android/dialer/calllog/database/contract/number_attributes.prot
import "java/com/android/dialer/phonenumberproto/dialer_phone_number.proto";
// Contains the contents of a row from the CoalescedAnnotatedCallLog.
-// Next ID: 19
+// Next ID: 17
message CoalescedRow {
// Value in column CoalescedAnnotatedCallLog._ID
optional int64 id = 1;
@@ -44,27 +44,21 @@ message CoalescedRow {
// Value in column CoalescedAnnotatedCallLog.PHONE_ACCOUNT_ID
optional string phone_account_id = 10;
- // Value in column CoalescedAnnotatedCallLog.PHONE_ACCOUNT_LABEL
- optional string phone_account_label = 11;
-
- // Value in column CoalescedAnnotatedCallLog.PHONE_ACCOUNT_COLOR
- optional int32 phone_account_color = 12;
-
// Value in column CoalescedAnnotatedCallLog.FEATURES
- optional int32 features = 13;
+ optional int32 features = 11;
// Value in column CoalescedAnnotatedCallLog.CALL_TYPE
- optional int32 call_type = 14;
+ optional int32 call_type = 12;
// Value in column CoalescedAnnotatedCallLog.NUMBER_ATTRIBUTES
- optional com.android.dialer.NumberAttributes number_attributes = 15;
+ optional com.android.dialer.NumberAttributes number_attributes = 13;
// Value in column CoalescedAnnotatedCallLog.IS_VOICEMAIL_CALL
- optional bool is_voicemail_call = 16;
+ optional bool is_voicemail_call = 14;
// Value in column CoalescedAnnotatedCallLog.VOICEMAIL_CALL_TAG
- optional string voicemail_call_tag = 17;
+ optional string voicemail_call_tag = 15;
// Value in column CoalescedAnnotatedCallLog.COALESCED_IDS
- optional com.android.dialer.CoalescedIds coalesced_ids = 18;
+ optional com.android.dialer.CoalescedIds coalesced_ids = 16;
}
diff --git a/java/com/android/dialer/calllog/ui/CoalescedAnnotatedCallLogCursorLoader.java b/java/com/android/dialer/calllog/ui/CoalescedAnnotatedCallLogCursorLoader.java
index e2ddcc846..164bb7dad 100644
--- a/java/com/android/dialer/calllog/ui/CoalescedAnnotatedCallLogCursorLoader.java
+++ b/java/com/android/dialer/calllog/ui/CoalescedAnnotatedCallLogCursorLoader.java
@@ -41,14 +41,12 @@ final class CoalescedAnnotatedCallLogCursorLoader extends CursorLoader {
private static final int GEOCODED_LOCATION = 7;
private static final int PHONE_ACCOUNT_COMPONENT_NAME = 8;
private static final int PHONE_ACCOUNT_ID = 9;
- private static final int PHONE_ACCOUNT_LABEL = 10;
- private static final int PHONE_ACCOUNT_COLOR = 11;
- private static final int FEATURES = 12;
- private static final int NUMBER_ATTRIBUTES = 13;
- private static final int IS_VOICEMAIL_CALL = 14;
- private static final int VOICEMAIL_CALL_TAG = 15;
- private static final int CALL_TYPE = 16;
- private static final int COALESCED_IDS = 17;
+ private static final int FEATURES = 10;
+ private static final int NUMBER_ATTRIBUTES = 11;
+ private static final int IS_VOICEMAIL_CALL = 12;
+ private static final int VOICEMAIL_CALL_TAG = 13;
+ private static final int CALL_TYPE = 14;
+ private static final int COALESCED_IDS = 15;
CoalescedAnnotatedCallLogCursorLoader(Context context) {
// CoalescedAnnotatedCallLog requires that PROJECTION be ALL_COLUMNS and the following params be
@@ -93,7 +91,6 @@ final class CoalescedAnnotatedCallLogCursorLoader extends CursorLoader {
.setNumberPresentation(cursor.getInt(NUMBER_PRESENTATION))
.setIsRead(cursor.getInt(IS_READ) == 1)
.setIsNew(cursor.getInt(NEW) == 1)
- .setPhoneAccountColor(cursor.getInt(PHONE_ACCOUNT_COLOR))
.setFeatures(cursor.getInt(FEATURES))
.setCallType(cursor.getInt(CALL_TYPE))
.setNumberAttributes(numberAttributes)
@@ -121,11 +118,6 @@ final class CoalescedAnnotatedCallLogCursorLoader extends CursorLoader {
coalescedRowBuilder.setPhoneAccountId(phoneAccountId);
}
- String phoneAccountLabel = cursor.getString(PHONE_ACCOUNT_LABEL);
- if (!TextUtils.isEmpty(phoneAccountLabel)) {
- coalescedRowBuilder.setPhoneAccountLabel(phoneAccountLabel);
- }
-
String voicemailCallTag = cursor.getString(VOICEMAIL_CALL_TAG);
if (!TextUtils.isEmpty(voicemailCallTag)) {
coalescedRowBuilder.setVoicemailCallTag(voicemailCallTag);
diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
index d1a654a09..796ffe515 100644
--- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
+++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
@@ -20,9 +20,12 @@ import android.content.Intent;
import android.content.res.ColorStateList;
import android.database.Cursor;
import android.provider.CallLog.Calls;
+import android.support.annotation.ColorInt;
import android.support.annotation.DrawableRes;
import android.support.v4.os.BuildCompat;
import android.support.v7.widget.RecyclerView;
+import android.telecom.PhoneAccount;
+import android.telecom.PhoneAccountHandle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
@@ -33,10 +36,12 @@ import com.android.dialer.calllog.ui.menu.NewCallLogMenu;
import com.android.dialer.calllogutils.CallLogEntryText;
import com.android.dialer.calllogutils.CallLogIntents;
import com.android.dialer.calllogutils.NumberAttributesConverter;
+import com.android.dialer.calllogutils.PhoneAccountUtils;
import com.android.dialer.common.concurrent.DialerExecutorComponent;
import com.android.dialer.compat.AppCompatConstants;
import com.android.dialer.compat.telephony.TelephonyManagerCompat;
import com.android.dialer.oem.MotorolaUtils;
+import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.time.Clock;
import com.android.dialer.widget.ContactPhotoView;
import com.google.common.util.concurrent.FutureCallback;
@@ -232,13 +237,30 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder {
}
private void setPhoneAccounts(CoalescedRow row) {
- if (!TextUtils.isEmpty(row.getPhoneAccountLabel())) {
- phoneAccountView.setText(row.getPhoneAccountLabel());
- phoneAccountView.setTextColor(row.getPhoneAccountColor());
- phoneAccountView.setVisibility(View.VISIBLE);
- } else {
+ PhoneAccountHandle phoneAccountHandle =
+ TelecomUtil.composePhoneAccountHandle(
+ row.getPhoneAccountComponentName(), row.getPhoneAccountId());
+ if (phoneAccountHandle == null) {
+ phoneAccountView.setVisibility(View.GONE);
+ return;
+ }
+
+ String phoneAccountLabel = PhoneAccountUtils.getAccountLabel(context, phoneAccountHandle);
+ if (TextUtils.isEmpty(phoneAccountLabel)) {
phoneAccountView.setVisibility(View.GONE);
+ return;
}
+
+ @ColorInt
+ int phoneAccountColor = PhoneAccountUtils.getAccountColor(context, phoneAccountHandle);
+ if (phoneAccountColor == PhoneAccount.NO_HIGHLIGHT_COLOR) {
+ phoneAccountColor =
+ context.getResources().getColor(R.color.dialer_secondary_text_color, context.getTheme());
+ }
+
+ phoneAccountView.setText(phoneAccountLabel);
+ phoneAccountView.setTextColor(phoneAccountColor);
+ phoneAccountView.setVisibility(View.VISIBLE);
}
private void setOnClickListenerForRow(CoalescedRow row) {