summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2018-05-22 23:54:53 -0700
committerCopybara-Service <copybara-piper@google.com>2018-05-29 23:25:52 -0700
commitffd525d8eb9dbe1bc4d87909b01371743c296a16 (patch)
tree3e23bdb086dcfc77f7d5d27d5a0ebbf8d1e7e892
parenta40a9ef54ca0fe71756ad9d3e103d74ab0f58e19 (diff)
Delete AppCompatConstants
Test: Existing tests PiperOrigin-RevId: 197681266 Change-Id: I27fdda1d5c252993795b6eb860663c8cab0d363c
-rw-r--r--java/com/android/dialer/app/calllog/CallLogGroupBuilder.java11
-rw-r--r--java/com/android/dialer/app/calllog/CallLogListItemHelper.java7
-rw-r--r--java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java15
-rw-r--r--java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java13
-rw-r--r--java/com/android/dialer/calllogutils/CallTypeHelper.java24
-rw-r--r--java/com/android/dialer/calllogutils/CallTypeIconsView.java14
-rw-r--r--java/com/android/dialer/compat/AppCompatConstants.java33
-rw-r--r--java/com/android/dialer/database/CallLogQueryHandler.java5
8 files changed, 41 insertions, 81 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
index 26b3a6260..e52591174 100644
--- a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
+++ b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
@@ -18,6 +18,7 @@ package com.android.dialer.app.calllog;
import android.content.Context;
import android.database.Cursor;
+import android.provider.CallLog.Calls;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.telephony.PhoneNumberUtils;
@@ -26,7 +27,6 @@ import android.text.format.Time;
import com.android.contacts.common.util.DateUtils;
import com.android.dialer.calllogutils.CallbackActionHelper;
import com.android.dialer.calllogutils.CallbackActionHelper.CallbackAction;
-import com.android.dialer.compat.AppCompatConstants;
import com.android.dialer.compat.telephony.TelephonyManagerCompat;
import com.android.dialer.inject.ApplicationContext;
import com.android.dialer.phonenumbercache.CallLogQuery;
@@ -267,18 +267,15 @@ public class CallLogGroupBuilder {
}
private boolean areBothNotVoicemail(int callType, int groupCallType) {
- return callType != AppCompatConstants.CALLS_VOICEMAIL_TYPE
- && groupCallType != AppCompatConstants.CALLS_VOICEMAIL_TYPE;
+ return callType != Calls.VOICEMAIL_TYPE && groupCallType != Calls.VOICEMAIL_TYPE;
}
private boolean areBothNotBlocked(int callType, int groupCallType) {
- return callType != AppCompatConstants.CALLS_BLOCKED_TYPE
- && groupCallType != AppCompatConstants.CALLS_BLOCKED_TYPE;
+ return callType != Calls.BLOCKED_TYPE && groupCallType != Calls.BLOCKED_TYPE;
}
private boolean areBothBlocked(int callType, int groupCallType) {
- return callType == AppCompatConstants.CALLS_BLOCKED_TYPE
- && groupCallType == AppCompatConstants.CALLS_BLOCKED_TYPE;
+ return callType == Calls.BLOCKED_TYPE && groupCallType == Calls.BLOCKED_TYPE;
}
private boolean meetsAssistedDialingGroupingCriteria(int groupFeatures, int callFeatures) {
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemHelper.java b/java/com/android/dialer/app/calllog/CallLogListItemHelper.java
index 13ee9a41f..a30d4d76e 100644
--- a/java/com/android/dialer/app/calllog/CallLogListItemHelper.java
+++ b/java/com/android/dialer/app/calllog/CallLogListItemHelper.java
@@ -26,7 +26,6 @@ import com.android.dialer.app.calllog.calllogcache.CallLogCache;
import com.android.dialer.calllogutils.PhoneCallDetails;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
-import com.android.dialer.compat.AppCompatConstants;
/** Helper class to fill in the views of a call log entry. */
/* package */ class CallLogListItemHelper {
@@ -224,15 +223,15 @@ import com.android.dialer.compat.AppCompatConstants;
int lastCallType = getLastCallType(callTypes);
int stringID;
- if (lastCallType == AppCompatConstants.CALLS_MISSED_TYPE) {
+ if (lastCallType == Calls.MISSED_TYPE) {
//Message: Missed call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>,
//<PhoneAccount>.
stringID = R.string.description_incoming_missed_call;
- } else if (lastCallType == AppCompatConstants.CALLS_INCOMING_TYPE) {
+ } else if (lastCallType == Calls.INCOMING_TYPE) {
//Message: Answered call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>,
//<PhoneAccount>.
stringID = R.string.description_incoming_answered_call;
- } else if (lastCallType == AppCompatConstants.CALLS_VOICEMAIL_TYPE) {
+ } else if (lastCallType == Calls.VOICEMAIL_TYPE) {
//Message: (Unread) [V/v]oicemail from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>,
//<PhoneAccount>.
stringID =
diff --git a/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java b/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java
index 77dad3082..05957ae80 100644
--- a/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java
+++ b/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java
@@ -34,7 +34,6 @@ import com.android.dialer.calllogutils.CallLogDurations;
import com.android.dialer.calllogutils.CallTypeHelper;
import com.android.dialer.calllogutils.CallTypeIconsView;
import com.android.dialer.common.LogUtil;
-import com.android.dialer.compat.AppCompatConstants;
import com.android.dialer.enrichedcall.historyquery.proto.HistoryResult;
import com.android.dialer.enrichedcall.historyquery.proto.HistoryResult.Type;
import com.android.dialer.glidephotomanager.PhotoInfo;
@@ -217,14 +216,14 @@ public class CallDetailsEntryViewHolder extends ViewHolder {
private static @ColorInt int getColorForCallType(Context context, int callType) {
switch (callType) {
- case AppCompatConstants.CALLS_OUTGOING_TYPE:
- case AppCompatConstants.CALLS_VOICEMAIL_TYPE:
- case AppCompatConstants.CALLS_BLOCKED_TYPE:
- case AppCompatConstants.CALLS_INCOMING_TYPE:
- case AppCompatConstants.CALLS_ANSWERED_EXTERNALLY_TYPE:
- case AppCompatConstants.CALLS_REJECTED_TYPE:
+ case Calls.OUTGOING_TYPE:
+ case Calls.VOICEMAIL_TYPE:
+ case Calls.BLOCKED_TYPE:
+ case Calls.INCOMING_TYPE:
+ case Calls.ANSWERED_EXTERNALLY_TYPE:
+ case Calls.REJECTED_TYPE:
return ContextCompat.getColor(context, R.color.dialer_secondary_text_color);
- case AppCompatConstants.CALLS_MISSED_TYPE:
+ case Calls.MISSED_TYPE:
default:
// It is possible for users to end up with calls with unknown call types in their
// call history, possibly due to 3rd party call log implementations (e.g. to
diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
index 357c623da..4def69cf9 100644
--- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
+++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
@@ -37,7 +37,6 @@ import com.android.dialer.calllogutils.CallLogRowActions;
import com.android.dialer.calllogutils.PhoneAccountUtils;
import com.android.dialer.calllogutils.PhotoInfoBuilder;
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.phonenumberutil.PhoneNumberHelper;
@@ -201,19 +200,19 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder {
private void setCallTypeIcon(CoalescedRow row) {
@DrawableRes int resId;
switch (row.getCallType()) {
- case AppCompatConstants.CALLS_INCOMING_TYPE:
- case AppCompatConstants.CALLS_ANSWERED_EXTERNALLY_TYPE:
+ case Calls.INCOMING_TYPE:
+ case Calls.ANSWERED_EXTERNALLY_TYPE:
resId = R.drawable.quantum_ic_call_received_vd_theme_24;
break;
- case AppCompatConstants.CALLS_OUTGOING_TYPE:
+ case Calls.OUTGOING_TYPE:
resId = R.drawable.quantum_ic_call_made_vd_theme_24;
break;
- case AppCompatConstants.CALLS_MISSED_TYPE:
+ case Calls.MISSED_TYPE:
resId = R.drawable.quantum_ic_call_missed_vd_theme_24;
break;
- case AppCompatConstants.CALLS_VOICEMAIL_TYPE:
+ case Calls.VOICEMAIL_TYPE:
throw new IllegalStateException("Voicemails not expected in call log");
- case AppCompatConstants.CALLS_BLOCKED_TYPE:
+ case Calls.BLOCKED_TYPE:
resId = R.drawable.quantum_ic_block_vd_theme_24;
break;
default:
diff --git a/java/com/android/dialer/calllogutils/CallTypeHelper.java b/java/com/android/dialer/calllogutils/CallTypeHelper.java
index 6feaeb998..1bcaa317b 100644
--- a/java/com/android/dialer/calllogutils/CallTypeHelper.java
+++ b/java/com/android/dialer/calllogutils/CallTypeHelper.java
@@ -17,7 +17,7 @@
package com.android.dialer.calllogutils;
import android.content.res.Resources;
-import com.android.dialer.compat.AppCompatConstants;
+import android.provider.CallLog.Calls;
import com.android.dialer.duo.Duo;
/** Helper class to perform operations related to call types. */
@@ -87,17 +87,17 @@ public class CallTypeHelper {
}
public static boolean isMissedCallType(int callType) {
- return (callType != AppCompatConstants.CALLS_INCOMING_TYPE
- && callType != AppCompatConstants.CALLS_OUTGOING_TYPE
- && callType != AppCompatConstants.CALLS_VOICEMAIL_TYPE
- && callType != AppCompatConstants.CALLS_ANSWERED_EXTERNALLY_TYPE);
+ return (callType != Calls.INCOMING_TYPE
+ && callType != Calls.OUTGOING_TYPE
+ && callType != Calls.VOICEMAIL_TYPE
+ && callType != Calls.ANSWERED_EXTERNALLY_TYPE);
}
/** Returns the text used to represent the given call type. */
public CharSequence getCallTypeText(
int callType, boolean isVideoCall, boolean isPulledCall, boolean isDuoCall) {
switch (callType) {
- case AppCompatConstants.CALLS_INCOMING_TYPE:
+ case Calls.INCOMING_TYPE:
if (isVideoCall) {
if (isPulledCall) {
return incomingVideoPulledName;
@@ -115,7 +115,7 @@ public class CallTypeHelper {
}
}
- case AppCompatConstants.CALLS_OUTGOING_TYPE:
+ case Calls.OUTGOING_TYPE:
if (isVideoCall) {
if (isPulledCall) {
return outgoingVideoPulledName;
@@ -133,23 +133,23 @@ public class CallTypeHelper {
}
}
- case AppCompatConstants.CALLS_MISSED_TYPE:
+ case Calls.MISSED_TYPE:
if (isVideoCall) {
return missedVideoName;
} else {
return missedName;
}
- case AppCompatConstants.CALLS_VOICEMAIL_TYPE:
+ case Calls.VOICEMAIL_TYPE:
return voicemailName;
- case AppCompatConstants.CALLS_REJECTED_TYPE:
+ case Calls.REJECTED_TYPE:
return rejectedName;
- case AppCompatConstants.CALLS_BLOCKED_TYPE:
+ case Calls.BLOCKED_TYPE:
return blockedName;
- case AppCompatConstants.CALLS_ANSWERED_EXTERNALLY_TYPE:
+ case Calls.ANSWERED_EXTERNALLY_TYPE:
return answeredElsewhereName;
default:
diff --git a/java/com/android/dialer/calllogutils/CallTypeIconsView.java b/java/com/android/dialer/calllogutils/CallTypeIconsView.java
index 1df615f9c..990fa7314 100644
--- a/java/com/android/dialer/calllogutils/CallTypeIconsView.java
+++ b/java/com/android/dialer/calllogutils/CallTypeIconsView.java
@@ -23,10 +23,10 @@ import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
+import android.provider.CallLog.Calls;
import android.support.annotation.VisibleForTesting;
import android.util.AttributeSet;
import android.view.View;
-import com.android.dialer.compat.AppCompatConstants;
import com.android.dialer.theme.base.ThemeUtil;
import java.util.ArrayList;
import java.util.List;
@@ -167,16 +167,16 @@ public class CallTypeIconsView extends View {
private Drawable getCallTypeDrawable(int callType) {
Resources resources = useLargeIcons ? largeResouces : CallTypeIconsView.resources;
switch (callType) {
- case AppCompatConstants.CALLS_INCOMING_TYPE:
- case AppCompatConstants.CALLS_ANSWERED_EXTERNALLY_TYPE:
+ case Calls.INCOMING_TYPE:
+ case Calls.ANSWERED_EXTERNALLY_TYPE:
return resources.incoming;
- case AppCompatConstants.CALLS_OUTGOING_TYPE:
+ case Calls.OUTGOING_TYPE:
return resources.outgoing;
- case AppCompatConstants.CALLS_MISSED_TYPE:
+ case Calls.MISSED_TYPE:
return resources.missed;
- case AppCompatConstants.CALLS_VOICEMAIL_TYPE:
+ case Calls.VOICEMAIL_TYPE:
return resources.voicemail;
- case AppCompatConstants.CALLS_BLOCKED_TYPE:
+ case Calls.BLOCKED_TYPE:
return resources.blocked;
default:
// It is possible for users to end up with calls with unknown call types in their
diff --git a/java/com/android/dialer/compat/AppCompatConstants.java b/java/com/android/dialer/compat/AppCompatConstants.java
deleted file mode 100644
index 4a51d3f9e..000000000
--- a/java/com/android/dialer/compat/AppCompatConstants.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dialer.compat;
-
-import android.provider.CallLog.Calls;
-
-public final class AppCompatConstants {
-
- public static final int CALLS_INCOMING_TYPE = Calls.INCOMING_TYPE;
- public static final int CALLS_OUTGOING_TYPE = Calls.OUTGOING_TYPE;
- public static final int CALLS_MISSED_TYPE = Calls.MISSED_TYPE;
- public static final int CALLS_VOICEMAIL_TYPE = Calls.VOICEMAIL_TYPE;
- // Added to android.provider.CallLog.Calls in N+.
- public static final int CALLS_REJECTED_TYPE = 5;
- // Added to android.provider.CallLog.Calls in N+.
- public static final int CALLS_BLOCKED_TYPE = 6;
- // Added to android.provider.CallLog.Calls in N+.
- public static final int CALLS_ANSWERED_EXTERNALLY_TYPE = Calls.ANSWERED_EXTERNALLY_TYPE;
-}
diff --git a/java/com/android/dialer/database/CallLogQueryHandler.java b/java/com/android/dialer/database/CallLogQueryHandler.java
index a18023c4b..de4329ddd 100644
--- a/java/com/android/dialer/database/CallLogQueryHandler.java
+++ b/java/com/android/dialer/database/CallLogQueryHandler.java
@@ -34,7 +34,6 @@ import android.provider.VoicemailContract.Status;
import android.provider.VoicemailContract.Voicemails;
import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler;
import com.android.dialer.common.LogUtil;
-import com.android.dialer.compat.AppCompatConstants;
import com.android.dialer.phonenumbercache.CallLogQuery;
import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.util.PermissionsUtil;
@@ -157,7 +156,7 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler {
// Always hide blocked calls.
where.append("(").append(Calls.TYPE).append(" != ?)");
- selectionArgs.add(Integer.toString(AppCompatConstants.CALLS_BLOCKED_TYPE));
+ selectionArgs.add(Integer.toString(Calls.BLOCKED_TYPE));
// Ignore voicemails marked as deleted
where.append(" AND (").append(Voicemails.DELETED).append(" = 0)");
@@ -171,7 +170,7 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler {
selectionArgs.add(Integer.toString(callType));
} else {
where.append(" AND NOT ");
- where.append("(" + Calls.TYPE + " = " + AppCompatConstants.CALLS_VOICEMAIL_TYPE + ")");
+ where.append("(" + Calls.TYPE + " = " + Calls.VOICEMAIL_TYPE + ")");
}
if (newerThan > 0) {