summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-10-02 22:50:08 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-10-02 22:50:08 +0000
commit2e542167f106f7f09a4cedd26c803aa184836cc0 (patch)
treec586d9f08f63d37fa973b11a52ad858a0686ac7d
parente3b4563ea4bced9ef4bb5f21e67218f50794d4e6 (diff)
parent27bf26e70548c530946e37d994c89c23b7887386 (diff)
am 27bf26e7: Merge "Add BLOCKED call type and util to mark in call log." into ub-contactsdialer-a-dev
* commit '27bf26e70548c530946e37d994c89c23b7887386': Add BLOCKED call type and util to mark in call log.
-rw-r--r--res/values/strings.xml12
-rw-r--r--src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java144
-rw-r--r--src/com/android/dialer/calllog/CallLogListItemHelper.java6
-rw-r--r--src/com/android/dialer/calllog/CallLogQueryHandler.java3
-rw-r--r--src/com/android/dialer/calllog/CallTypeHelper.java35
-rw-r--r--src/com/android/dialer/calllog/CallTypeIconsView.java10
-rw-r--r--src/com/android/dialer/util/AppCompatConstants.java30
-rw-r--r--tests/src/com/android/dialer/CallDetailActivityTest.java3
-rw-r--r--tests/src/com/android/dialer/calllog/CallLogAdapterTest.java19
-rw-r--r--tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java116
-rw-r--r--tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java49
-rw-r--r--tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java48
-rw-r--r--tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java17
13 files changed, 345 insertions, 147 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e5d32ea6c..9fac7a3d7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -309,13 +309,13 @@
is already in progress.) -->
<string name="dialer_addAnotherCall">Add call</string>
- <!-- Title for incoming call details screen -->
+ <!-- Title for incoming call type. [CHAR LIMIT=40] -->
<string name="type_incoming">Incoming call</string>
- <!-- Title for outgoing call details screen -->
+ <!-- Title for outgoing call type. [CHAR LIMIT=40] -->
<string name="type_outgoing">Outgoing call</string>
- <!-- Title for missed call details screen -->
+ <!-- Title for missed call type. [CHAR LIMIT=40] -->
<string name="type_missed">Missed call</string>
<!-- Title for incoming video call in call details screen [CHAR LIMIT=60] -->
@@ -330,6 +330,12 @@
<!-- Title for voicemail details screen -->
<string name="type_voicemail">Voicemail</string>
+ <!-- Title for rejected call type. [CHAR LIMIT=40] -->
+ <string name="type_rejected">Declined call</string>
+
+ <!-- Title for blocked call type. [CHAR LIMIT=40] -->
+ <string name="type_blocked">Blocked call</string>
+
<!-- Description for incoming calls going to voice mail vs. not -->
<string name="actionIncomingCall">Incoming calls</string>
diff --git a/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java b/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java
index aa994d25a..89932ffce 100644
--- a/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java
+++ b/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java
@@ -31,6 +31,7 @@ import android.util.Log;
import com.android.contacts.common.GeoUtil;
import com.android.dialer.DialtactsActivity;
import com.android.dialer.PhoneCallDetails;
+import com.android.dialer.util.AppCompatConstants;
import com.android.dialer.util.AsyncTaskExecutor;
import com.android.dialer.util.AsyncTaskExecutors;
import com.android.dialer.util.PhoneNumberUtil;
@@ -45,6 +46,7 @@ public class CallLogAsyncTaskUtil {
public enum Tasks {
DELETE_VOICEMAIL,
DELETE_CALL,
+ MARK_BLOCKED,
MARK_VOICEMAIL_READ,
GET_CALL_DETAILS,
}
@@ -79,12 +81,31 @@ public class CallLogAsyncTaskUtil {
static final int TRANSCRIPTION_COLUMN_INDEX = 11;
}
+ private static class CallLogMarkBlockedQuery {
+ static final String[] PROJECTION = new String[] {
+ CallLog.Calls._ID,
+ CallLog.Calls.DATE
+ };
+
+ static final int ID_COLUMN_INDEX = 0;
+ static final int DATE_COLUMN_INDEX = 1;
+ }
+
public interface CallLogAsyncTaskListener {
public void onDeleteCall();
public void onDeleteVoicemail();
public void onGetCallDetails(PhoneCallDetails[] details);
}
+ public interface OnCallLogQueryFinishedListener {
+ public void onQueryFinished(boolean hasEntry);
+ }
+
+ // Try to identify if a call log entry corresponds to a number which was blocked. We match by
+ // by comparing its creation time to the time it was added in the InCallUi and seeing if they
+ // fall within a certain threshold.
+ private static final int MATCH_BLOCKED_CALL_THRESHOLD_MS = 1500;
+
private static AsyncTaskExecutor sAsyncTaskExecutor;
private static void initTaskExecutor() {
@@ -156,8 +177,8 @@ public class CallLogAsyncTaskUtil {
boolean isVoicemail = PhoneNumberUtil.isVoicemailNumber(context, accountHandle, number);
boolean shouldLookupNumber =
PhoneNumberUtil.canPlaceCallsTo(number, numberPresentation) && !isVoicemail;
-
ContactInfo info = ContactInfo.EMPTY;
+
if (shouldLookupNumber) {
ContactInfo lookupInfo = contactInfoHelper.lookupNumber(number, countryIso);
info = lookupInfo != null ? lookupInfo : ContactInfo.EMPTY;
@@ -205,7 +226,7 @@ public class CallLogAsyncTaskUtil {
*
* @param context The context.
* @param callIds String of the callIds to delete from the call log, delimited by commas (",").
- * @param callLogAsyncTaskListenerg The listener to invoke after the entries have been deleted.
+ * @param callLogAsyncTaskListener The listener to invoke after the entries have been deleted.
*/
public static void deleteCalls(
final Context context,
@@ -215,26 +236,88 @@ public class CallLogAsyncTaskUtil {
initTaskExecutor();
}
- sAsyncTaskExecutor.submit(Tasks.DELETE_CALL,
- new AsyncTask<Void, Void, Void>() {
- @Override
- public Void doInBackground(Void... params) {
- context.getContentResolver().delete(
- TelecomUtil.getCallLogUri(context),
- CallLog.Calls._ID + " IN (" + callIds + ")", null);
- return null;
- }
+ sAsyncTaskExecutor.submit(Tasks.DELETE_CALL, new AsyncTask<Void, Void, Void>() {
+ @Override
+ public Void doInBackground(Void... params) {
+ context.getContentResolver().delete(
+ TelecomUtil.getCallLogUri(context),
+ CallLog.Calls._ID + " IN (" + callIds + ")", null);
+ return null;
+ }
- @Override
- public void onPostExecute(Void result) {
- if (callLogAsyncTaskListener != null) {
- callLogAsyncTaskListener.onDeleteCall();
- }
+ @Override
+ public void onPostExecute(Void result) {
+ if (callLogAsyncTaskListener != null) {
+ callLogAsyncTaskListener.onDeleteCall();
+ }
+ }
+ });
+ }
+
+ /**
+ * Marks last call made by the number the call type of the specified call as BLOCKED in the call log.
+ *
+ * @param context The context.
+ * @param number Number of which to mark the most recent call as BLOCKED.
+ * @param timeAddedMs The time the number was added to InCall, in milliseconds.
+ * @param listener The listener to invoke after looking up for a call log entry matching the
+ * number and time added.
+ */
+ public static void markCallAsBlocked(
+ final Context context,
+ final String number,
+ final long timeAddedMs,
+ final OnCallLogQueryFinishedListener listener) {
+ if (sAsyncTaskExecutor == null) {
+ initTaskExecutor();
+ }
+
+ sAsyncTaskExecutor.submit(Tasks.MARK_BLOCKED, new AsyncTask<Void, Void, Long>() {
+ @Override
+ public Long doInBackground(Void... params) {
+ // First, lookup the call log entry of the most recent call with this number.
+ Cursor cursor = context.getContentResolver().query(
+ TelecomUtil.getCallLogUri(context),
+ CallLogMarkBlockedQuery.PROJECTION,
+ CallLog.Calls.NUMBER + "= ?",
+ new String[] { number },
+ CallLog.Calls.DATE + " DESC LIMIT 1");
+
+ // If found, return the call log entry id.
+ if (cursor.moveToFirst()) {
+ long creationTime = cursor.getLong(CallLogMarkBlockedQuery.DATE_COLUMN_INDEX);
+ if (timeAddedMs > creationTime
+ && timeAddedMs - creationTime < MATCH_BLOCKED_CALL_THRESHOLD_MS) {
+ return cursor.getLong(CallLogMarkBlockedQuery.ID_COLUMN_INDEX);
}
- });
+ }
+ return (long) -1;
+ }
+
+ @Override
+ public void onPostExecute(Long callLogEntryId) {
+ if (listener != null) {
+ listener.onQueryFinished(callLogEntryId >= 0);
+ }
+
+ if (callLogEntryId < 0) {
+ return;
+ }
+ // Then, update that call log entry to have type BLOCKED.
+ final ContentValues values = new ContentValues();
+ values.put(CallLog.Calls.TYPE, AppCompatConstants.CALLS_BLOCKED_TYPE);
+
+ context.getContentResolver().update(
+ TelecomUtil.getCallLogUri(context),
+ values,
+ CallLog.Calls._ID + "= ?",
+ new String[] { Long.toString(callLogEntryId) });
+ }
+ });
}
+
public static void markVoicemailAsRead(final Context context, final Uri voicemailUri) {
if (sAsyncTaskExecutor == null) {
initTaskExecutor();
@@ -266,21 +349,20 @@ public class CallLogAsyncTaskUtil {
initTaskExecutor();
}
- sAsyncTaskExecutor.submit(Tasks.DELETE_VOICEMAIL,
- new AsyncTask<Void, Void, Void>() {
- @Override
- public Void doInBackground(Void... params) {
- context.getContentResolver().delete(voicemailUri, null, null);
- return null;
- }
+ sAsyncTaskExecutor.submit(Tasks.DELETE_VOICEMAIL, new AsyncTask<Void, Void, Void>() {
+ @Override
+ public Void doInBackground(Void... params) {
+ context.getContentResolver().delete(voicemailUri, null, null);
+ return null;
+ }
- @Override
- public void onPostExecute(Void result) {
- if (callLogAsyncTaskListener != null) {
- callLogAsyncTaskListener.onDeleteVoicemail();
- }
- }
- });
+ @Override
+ public void onPostExecute(Void result) {
+ if (callLogAsyncTaskListener != null) {
+ callLogAsyncTaskListener.onDeleteVoicemail();
+ }
+ }
+ });
}
@VisibleForTesting
diff --git a/src/com/android/dialer/calllog/CallLogListItemHelper.java b/src/com/android/dialer/calllog/CallLogListItemHelper.java
index d18e274ba..8e45dd36f 100644
--- a/src/com/android/dialer/calllog/CallLogListItemHelper.java
+++ b/src/com/android/dialer/calllog/CallLogListItemHelper.java
@@ -24,6 +24,7 @@ import android.text.TextUtils;
import android.util.Log;
import com.android.dialer.PhoneCallDetails;
+import com.android.dialer.util.AppCompatConstants;
import com.android.dialer.R;
/**
@@ -220,11 +221,12 @@ import com.android.dialer.R;
int lastCallType = getLastCallType(callTypes);
int stringID;
- if (lastCallType == Calls.VOICEMAIL_TYPE || lastCallType == Calls.MISSED_TYPE) {
+ if (lastCallType == AppCompatConstants.CALLS_VOICEMAIL_TYPE
+ || lastCallType == AppCompatConstants.CALLS_MISSED_TYPE) {
//Message: Missed call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>,
//<PhoneAccount>.
stringID = R.string.description_incoming_missed_call;
- } else if (lastCallType == Calls.INCOMING_TYPE) {
+ } else if (lastCallType == AppCompatConstants.CALLS_INCOMING_TYPE) {
//Message: Answered call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>,
//<PhoneAccount>.
stringID = R.string.description_incoming_answered_call;
diff --git a/src/com/android/dialer/calllog/CallLogQueryHandler.java b/src/com/android/dialer/calllog/CallLogQueryHandler.java
index 771df99e2..81e49d2d4 100644
--- a/src/com/android/dialer/calllog/CallLogQueryHandler.java
+++ b/src/com/android/dialer/calllog/CallLogQueryHandler.java
@@ -36,6 +36,7 @@ import android.util.Log;
import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler;
import com.android.contacts.common.util.PermissionsUtil;
+import com.android.dialer.util.AppCompatConstants;
import com.android.dialer.util.TelecomUtil;
import com.android.dialer.voicemail.VoicemailStatusHelperImpl;
@@ -180,7 +181,7 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler {
selectionArgs.add(Integer.toString(callType));
} else {
where.append(" AND NOT ");
- where.append("(" + Calls.TYPE + " = " + Calls.VOICEMAIL_TYPE + ")");
+ where.append("(" + Calls.TYPE + " = " + AppCompatConstants.CALLS_VOICEMAIL_TYPE + ")");
}
if (newerThan > 0) {
diff --git a/src/com/android/dialer/calllog/CallTypeHelper.java b/src/com/android/dialer/calllog/CallTypeHelper.java
index 36c0975bd..acc114c5c 100644
--- a/src/com/android/dialer/calllog/CallTypeHelper.java
+++ b/src/com/android/dialer/calllog/CallTypeHelper.java
@@ -17,9 +17,9 @@
package com.android.dialer.calllog;
import android.content.res.Resources;
-import android.provider.CallLog.Calls;
import com.android.dialer.R;
+import com.android.dialer.util.AppCompatConstants;
/**
* Helper class to perform operations related to call types.
@@ -39,6 +39,10 @@ public class CallTypeHelper {
private final CharSequence mMissedVideoName;
/** Name used to identify voicemail calls. */
private final CharSequence mVoicemailName;
+ /** Name used to identify rejected calls. */
+ private final CharSequence mRejectedName;
+ /** Name used to identify blocked calls. */
+ private final CharSequence mBlockedName;
/** Color used to identify new missed calls. */
private final int mNewMissedColor;
/** Color used to identify new voicemail calls. */
@@ -53,6 +57,8 @@ public class CallTypeHelper {
mOutgoingVideoName = resources.getString(R.string.type_outgoing_video);
mMissedVideoName = resources.getString(R.string.type_missed_video);
mVoicemailName = resources.getString(R.string.type_voicemail);
+ mRejectedName = resources.getString(R.string.type_rejected);
+ mBlockedName = resources.getString(R.string.type_blocked);
mNewMissedColor = resources.getColor(R.color.call_log_missed_call_highlight_color);
mNewVoicemailColor = resources.getColor(R.color.call_log_voicemail_highlight_color);
}
@@ -60,30 +66,36 @@ public class CallTypeHelper {
/** Returns the text used to represent the given call type. */
public CharSequence getCallTypeText(int callType, boolean isVideoCall) {
switch (callType) {
- case Calls.INCOMING_TYPE:
+ case AppCompatConstants.CALLS_INCOMING_TYPE:
if (isVideoCall) {
return mIncomingVideoName;
} else {
return mIncomingName;
}
- case Calls.OUTGOING_TYPE:
+ case AppCompatConstants.CALLS_OUTGOING_TYPE:
if (isVideoCall) {
return mOutgoingVideoName;
} else {
return mOutgoingName;
}
- case Calls.MISSED_TYPE:
+ case AppCompatConstants.CALLS_MISSED_TYPE:
if (isVideoCall) {
return mMissedVideoName;
} else {
return mMissedName;
}
- case Calls.VOICEMAIL_TYPE:
+ case AppCompatConstants.CALLS_VOICEMAIL_TYPE:
return mVoicemailName;
+ case AppCompatConstants.CALLS_REJECTED_TYPE:
+ return mRejectedName;
+
+ case AppCompatConstants.CALLS_BLOCKED_TYPE:
+ return mBlockedName;
+
default:
return mMissedName;
}
@@ -92,18 +104,18 @@ public class CallTypeHelper {
/** Returns the color used to highlight the given call type, null if not highlight is needed. */
public Integer getHighlightedColor(int callType) {
switch (callType) {
- case Calls.INCOMING_TYPE:
+ case AppCompatConstants.CALLS_INCOMING_TYPE:
// New incoming calls are not highlighted.
return null;
- case Calls.OUTGOING_TYPE:
+ case AppCompatConstants.CALLS_OUTGOING_TYPE:
// New outgoing calls are not highlighted.
return null;
- case Calls.MISSED_TYPE:
+ case AppCompatConstants.CALLS_MISSED_TYPE:
return mNewMissedColor;
- case Calls.VOICEMAIL_TYPE:
+ case AppCompatConstants.CALLS_VOICEMAIL_TYPE:
return mNewVoicemailColor;
default:
@@ -115,7 +127,8 @@ public class CallTypeHelper {
}
public static boolean isMissedCallType(int callType) {
- return (callType != Calls.INCOMING_TYPE && callType != Calls.OUTGOING_TYPE &&
- callType != Calls.VOICEMAIL_TYPE);
+ return (callType != AppCompatConstants.CALLS_INCOMING_TYPE
+ && callType != AppCompatConstants.CALLS_OUTGOING_TYPE
+ && callType != AppCompatConstants.CALLS_VOICEMAIL_TYPE);
}
}
diff --git a/src/com/android/dialer/calllog/CallTypeIconsView.java b/src/com/android/dialer/calllog/CallTypeIconsView.java
index 31d4f4b0e..d680cfe42 100644
--- a/src/com/android/dialer/calllog/CallTypeIconsView.java
+++ b/src/com/android/dialer/calllog/CallTypeIconsView.java
@@ -23,13 +23,13 @@ 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.util.AttributeSet;
import android.view.View;
import com.android.contacts.common.testing.NeededForTesting;
import com.android.contacts.common.util.BitmapUtil;
import com.android.dialer.R;
+import com.android.dialer.util.AppCompatConstants;
import com.google.common.collect.Lists;
import java.util.List;
@@ -106,13 +106,13 @@ public class CallTypeIconsView extends View {
private Drawable getCallTypeDrawable(int callType) {
switch (callType) {
- case Calls.INCOMING_TYPE:
+ case AppCompatConstants.CALLS_INCOMING_TYPE:
return mResources.incoming;
- case Calls.OUTGOING_TYPE:
+ case AppCompatConstants.CALLS_OUTGOING_TYPE:
return mResources.outgoing;
- case Calls.MISSED_TYPE:
+ case AppCompatConstants.CALLS_MISSED_TYPE:
return mResources.missed;
- case Calls.VOICEMAIL_TYPE:
+ case AppCompatConstants.CALLS_VOICEMAIL_TYPE:
return mResources.voicemail;
default:
// It is possible for users to end up with calls with unknown call types in their
diff --git a/src/com/android/dialer/util/AppCompatConstants.java b/src/com/android/dialer/util/AppCompatConstants.java
new file mode 100644
index 000000000..1d52eee1d
--- /dev/null
+++ b/src/com/android/dialer/util/AppCompatConstants.java
@@ -0,0 +1,30 @@
+/*
+ * 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.util;
+
+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;
+}
diff --git a/tests/src/com/android/dialer/CallDetailActivityTest.java b/tests/src/com/android/dialer/CallDetailActivityTest.java
index 59c2434f2..27fbc304e 100644
--- a/tests/src/com/android/dialer/CallDetailActivityTest.java
+++ b/tests/src/com/android/dialer/CallDetailActivityTest.java
@@ -33,6 +33,7 @@ import android.widget.PopupMenu;
import android.widget.TextView;
import com.android.dialer.calllog.CallLogAsyncTaskUtil;
+import com.android.dialer.util.AppCompatConstants;
import com.android.dialer.util.AsyncTaskExecutors;
import com.android.dialer.util.FakeAsyncTaskExecutor;
@@ -121,7 +122,7 @@ public class CallDetailActivityTest extends ActivityInstrumentationTestCase2<Cal
ContentValues values = new ContentValues();
values.put(CallLog.Calls.NUMBER, CONTACT_NUMBER);
values.put(CallLog.Calls.NUMBER_PRESENTATION, CallLog.Calls.PRESENTATION_ALLOWED);
- values.put(CallLog.Calls.TYPE, CallLog.Calls.INCOMING_TYPE);
+ values.put(CallLog.Calls.TYPE, AppCompatConstants.CALLS_INCOMING_TYPE);
mCallLogUri = contentResolver.insert(CallLog.Calls.CONTENT_URI, values);
setActivityIntent(new Intent(Intent.ACTION_VIEW, mCallLogUri));
}
diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java
index 83d098fc5..3a79695be 100644
--- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java
+++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java
@@ -35,6 +35,7 @@ import android.view.View;
import com.android.dialer.contactinfo.ContactInfoCache;
import com.android.dialer.contactinfo.ContactInfoCache.OnContactInfoChangedListener;
+import com.android.dialer.util.AppCompatConstants;
import com.android.dialer.util.TestConstants;
import com.google.common.collect.Lists;
@@ -344,7 +345,7 @@ public class CallLogAdapterTest extends AndroidTestCase {
public void testBindView_UriNumber() {
createCallLogEntryWithCachedValues(
"sip:johndoe@gmail.com",
- Calls.INCOMING_TYPE,
+ AppCompatConstants.CALLS_INCOMING_TYPE,
"John Doe",
Phone.TYPE_HOME,
TEST_DEFAULT_CUSTOM_LABEL,
@@ -404,7 +405,7 @@ public class CallLogAdapterTest extends AndroidTestCase {
public void testBindView_NumberOnlyDbCachedFormattedNumber() {
createCallLogEntryWithCachedValues(
TEST_NUMBER,
- Calls.INCOMING_TYPE,
+ AppCompatConstants.CALLS_INCOMING_TYPE,
EMPTY_STRING,
TEST_CACHED_NUMBER_TYPE,
TEST_CACHED_NUMBER_LABEL,
@@ -454,11 +455,17 @@ public class CallLogAdapterTest extends AndroidTestCase {
}
private void createPrivateCallLogEntry() {
- createCallLogEntry(EMPTY_STRING, Calls.PRESENTATION_RESTRICTED, Calls.INCOMING_TYPE);
+ createCallLogEntry(
+ EMPTY_STRING,
+ Calls.PRESENTATION_RESTRICTED,
+ AppCompatConstants.CALLS_INCOMING_TYPE);
}
private void createUnknownCallLogEntry() {
- createCallLogEntry(EMPTY_STRING, Calls.PRESENTATION_UNKNOWN, Calls.INCOMING_TYPE);
+ createCallLogEntry(
+ EMPTY_STRING,
+ Calls.PRESENTATION_UNKNOWN,
+ AppCompatConstants.CALLS_INCOMING_TYPE);
}
private void createVoicemailCallLogEntry() {
@@ -499,7 +506,7 @@ public class CallLogAdapterTest extends AndroidTestCase {
* It includes the values for the cached contact associated with the number.
*
* @param number The phone number.
- * @param type Either Call.OUTGOING_TYPE or Call.INCOMING_TYPE or Call.MISSED_TYPE.
+ * @param type Valid value of {@code Calls.TYPE}.
* @param cachedName The name of the contact with this number
* @param cachedNumberType The type of the number, from the contact with this number.
* @param cachedNumberLabel The label of the number, from the contact with this number.
@@ -555,7 +562,7 @@ public class CallLogAdapterTest extends AndroidTestCase {
if (type != NO_VALUE_SET) {
values[CallLogQuery.CALL_TYPE] = type;
}
- if (type == Calls.VOICEMAIL_TYPE) {
+ if (type == AppCompatConstants.CALLS_VOICEMAIL_TYPE) {
values[CallLogQuery.VOICEMAIL_URI] = ContentUris.withAppendedId(
VoicemailContract.Voicemails.CONTENT_URI, mCursor.getCount());
}
diff --git a/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java b/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java
index 9bdcd40c0..f5a9fe612 100644
--- a/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java
+++ b/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java
@@ -19,10 +19,11 @@ package com.android.dialer.calllog;
import static com.google.common.collect.Lists.newArrayList;
import android.database.MatrixCursor;
-import android.provider.CallLog.Calls;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
+import com.android.dialer.util.AppCompatConstants;
+
import java.util.List;
/**
@@ -64,31 +65,31 @@ public class CallLogGroupBuilderTest extends AndroidTestCase {
}
public void testAddGroups_OneCall() {
- addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE);
+ addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_INCOMING_TYPE);
mBuilder.addGroups(mCursor);
assertEquals(1, mFakeGroupCreator.groups.size());
}
public void testAddGroups_TwoCallsNotMatching() {
- addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE);
- addCallLogEntry(TEST_NUMBER2, Calls.INCOMING_TYPE);
+ addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_INCOMING_TYPE);
+ addCallLogEntry(TEST_NUMBER2, AppCompatConstants.CALLS_INCOMING_TYPE);
mBuilder.addGroups(mCursor);
assertEquals(2, mFakeGroupCreator.groups.size());
}
public void testAddGroups_ThreeCallsMatching() {
- addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE);
- addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE);
- addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE);
+ addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_INCOMING_TYPE);
+ addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_INCOMING_TYPE);
+ addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_INCOMING_TYPE);
mBuilder.addGroups(mCursor);
assertEquals(1, mFakeGroupCreator.groups.size());
assertGroupIs(0, 3, mFakeGroupCreator.groups.get(0));
}
public void testAddGroups_MatchingIncomingAndOutgoing() {
- addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE);
- addCallLogEntry(TEST_NUMBER1, Calls.OUTGOING_TYPE);
- addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE);
+ addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_INCOMING_TYPE);
+ addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_OUTGOING_TYPE);
+ addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_INCOMING_TYPE);
mBuilder.addGroups(mCursor);
assertEquals(1, mFakeGroupCreator.groups.size());
assertGroupIs(0, 3, mFakeGroupCreator.groups.get(0));
@@ -96,57 +97,88 @@ public class CallLogGroupBuilderTest extends AndroidTestCase {
public void testAddGroups_Voicemail() {
// Does not group with other types of calls, include voicemail themselves.
- assertCallsAreNotGrouped(Calls.VOICEMAIL_TYPE, Calls.MISSED_TYPE);
- assertCallsAreNotGrouped(Calls.VOICEMAIL_TYPE, Calls.VOICEMAIL_TYPE);
- assertCallsAreNotGrouped(Calls.VOICEMAIL_TYPE, Calls.INCOMING_TYPE);
- assertCallsAreNotGrouped(Calls.VOICEMAIL_TYPE, Calls.OUTGOING_TYPE);
+ assertCallsAreNotGrouped(
+ AppCompatConstants.CALLS_VOICEMAIL_TYPE, AppCompatConstants.CALLS_MISSED_TYPE);
+ assertCallsAreNotGrouped(
+ AppCompatConstants.CALLS_VOICEMAIL_TYPE, AppCompatConstants.CALLS_VOICEMAIL_TYPE);
+ assertCallsAreNotGrouped(
+ AppCompatConstants.CALLS_VOICEMAIL_TYPE, AppCompatConstants.CALLS_INCOMING_TYPE);
+ assertCallsAreNotGrouped(
+ AppCompatConstants.CALLS_VOICEMAIL_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE);
}
public void testAddGroups_Missed() {
// Groups with one or more missed calls.
- assertCallsAreGrouped(Calls.MISSED_TYPE, Calls.MISSED_TYPE);
- assertCallsAreGrouped(Calls.MISSED_TYPE, Calls.MISSED_TYPE, Calls.MISSED_TYPE);
+ assertCallsAreGrouped(
+ AppCompatConstants.CALLS_MISSED_TYPE, AppCompatConstants.CALLS_MISSED_TYPE);
+ assertCallsAreGrouped(
+ AppCompatConstants.CALLS_MISSED_TYPE,
+ AppCompatConstants.CALLS_MISSED_TYPE,
+ AppCompatConstants.CALLS_MISSED_TYPE);
// Does not group with other types of calls.
- assertCallsAreNotGrouped(Calls.MISSED_TYPE, Calls.VOICEMAIL_TYPE);
- assertCallsAreGrouped(Calls.MISSED_TYPE, Calls.INCOMING_TYPE);
- assertCallsAreGrouped(Calls.MISSED_TYPE, Calls.OUTGOING_TYPE);
+ assertCallsAreNotGrouped(
+ AppCompatConstants.CALLS_MISSED_TYPE, AppCompatConstants.CALLS_VOICEMAIL_TYPE);
+ assertCallsAreGrouped(
+ AppCompatConstants.CALLS_MISSED_TYPE, AppCompatConstants.CALLS_INCOMING_TYPE);
+ assertCallsAreGrouped(
+ AppCompatConstants.CALLS_MISSED_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE);
}
public void testAddGroups_Incoming() {
// Groups with one or more incoming or outgoing.
- assertCallsAreGrouped(Calls.INCOMING_TYPE, Calls.INCOMING_TYPE);
- assertCallsAreGrouped(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE);
- assertCallsAreGrouped(Calls.INCOMING_TYPE, Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE);
- assertCallsAreGrouped(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE, Calls.INCOMING_TYPE);
- assertCallsAreGrouped(Calls.INCOMING_TYPE, Calls.MISSED_TYPE);
+ assertCallsAreGrouped(
+ AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_INCOMING_TYPE);
+ assertCallsAreGrouped(
+ AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE);
+ assertCallsAreGrouped(
+ AppCompatConstants.CALLS_INCOMING_TYPE,
+ AppCompatConstants.CALLS_INCOMING_TYPE,
+ AppCompatConstants.CALLS_OUTGOING_TYPE);
+ assertCallsAreGrouped(
+ AppCompatConstants.CALLS_INCOMING_TYPE,
+ AppCompatConstants.CALLS_OUTGOING_TYPE,
+ AppCompatConstants.CALLS_INCOMING_TYPE);
+ assertCallsAreGrouped(
+ AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_MISSED_TYPE);
// Does not group with voicemail and missed calls.
- assertCallsAreNotGrouped(Calls.INCOMING_TYPE, Calls.VOICEMAIL_TYPE);
+ assertCallsAreNotGrouped(
+ AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_VOICEMAIL_TYPE);
}
public void testAddGroups_Outgoing() {
// Groups with one or more incoming or outgoing.
- assertCallsAreGrouped(Calls.OUTGOING_TYPE, Calls.INCOMING_TYPE);
- assertCallsAreGrouped(Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE);
- assertCallsAreGrouped(Calls.OUTGOING_TYPE, Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE);
- assertCallsAreGrouped(Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE, Calls.INCOMING_TYPE);
- assertCallsAreGrouped(Calls.INCOMING_TYPE, Calls.MISSED_TYPE);
+ assertCallsAreGrouped(
+ AppCompatConstants.CALLS_OUTGOING_TYPE, AppCompatConstants.CALLS_INCOMING_TYPE);
+ assertCallsAreGrouped(
+ AppCompatConstants.CALLS_OUTGOING_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE);
+ assertCallsAreGrouped(
+ AppCompatConstants.CALLS_OUTGOING_TYPE,
+ AppCompatConstants.CALLS_INCOMING_TYPE,
+ AppCompatConstants.CALLS_OUTGOING_TYPE);
+ assertCallsAreGrouped(
+ AppCompatConstants.CALLS_OUTGOING_TYPE,
+ AppCompatConstants.CALLS_OUTGOING_TYPE,
+ AppCompatConstants.CALLS_INCOMING_TYPE);
+ assertCallsAreGrouped(
+ AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_MISSED_TYPE);
// Does not group with voicemail and missed calls.
- assertCallsAreNotGrouped(Calls.INCOMING_TYPE, Calls.VOICEMAIL_TYPE);
+ assertCallsAreNotGrouped(
+ AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_VOICEMAIL_TYPE);
}
public void testAddGroups_Mixed() {
addMultipleCallLogEntries(TEST_NUMBER1,
- Calls.VOICEMAIL_TYPE, // Group 1:Stand-alone
- Calls.INCOMING_TYPE, // Group 2: 1-4
- Calls.OUTGOING_TYPE,
- Calls.MISSED_TYPE,
- Calls.MISSED_TYPE,
- Calls.VOICEMAIL_TYPE, // Group 3: Stand-alone
- Calls.INCOMING_TYPE, // Group 4: Stand-alone
- Calls.VOICEMAIL_TYPE, // Group 5: Stand-alone
- Calls.MISSED_TYPE, // Group 6: 8-10
- Calls.MISSED_TYPE,
- Calls.OUTGOING_TYPE);
+ AppCompatConstants.CALLS_VOICEMAIL_TYPE, // Group 1:Stand-alone
+ AppCompatConstants.CALLS_INCOMING_TYPE, // Group 2: 1-4
+ AppCompatConstants.CALLS_OUTGOING_TYPE,
+ AppCompatConstants.CALLS_MISSED_TYPE,
+ AppCompatConstants.CALLS_MISSED_TYPE,
+ AppCompatConstants.CALLS_VOICEMAIL_TYPE, // Group 3: Stand-alone
+ AppCompatConstants.CALLS_INCOMING_TYPE, // Group 4: Stand-alone
+ AppCompatConstants.CALLS_VOICEMAIL_TYPE, // Group 5: Stand-alone
+ AppCompatConstants.CALLS_MISSED_TYPE, // Group 6: 8-10
+ AppCompatConstants.CALLS_MISSED_TYPE,
+ AppCompatConstants.CALLS_OUTGOING_TYPE);
mBuilder.addGroups(mCursor);
assertEquals(6, mFakeGroupCreator.groups.size());
assertGroupIs(0, 1, mFakeGroupCreator.groups.get(0));
diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
index 8c2d8e443..d554ad4d2 100644
--- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
+++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
@@ -25,6 +25,7 @@ import android.view.View;
import com.android.contacts.common.CallUtil;
import com.android.dialer.PhoneCallDetails;
import com.android.dialer.R;
+import com.android.dialer.util.AppCompatConstants;
/**
* Unit tests for {@link CallLogListItemHelper}.
@@ -103,20 +104,22 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
}
public void testSetPhoneCallDetails_ReadVoicemail() {
- PhoneCallDetails details = getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE);
+ PhoneCallDetails details =
+ getPhoneCallDetailsWithTypes(AppCompatConstants.CALLS_VOICEMAIL_TYPE);
mHelper.setPhoneCallDetails(mViewHolder, details);
assertEquals(View.VISIBLE, mViewHolder.voicemailPlaybackView.getVisibility());
}
public void testSetPhoneCallDetails_UnreadVoicemail() {
- PhoneCallDetails details = getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE);
+ PhoneCallDetails details =
+ getPhoneCallDetailsWithTypes(AppCompatConstants.CALLS_VOICEMAIL_TYPE);
mHelper.setPhoneCallDetails(mViewHolder, details);
assertEquals(View.VISIBLE, mViewHolder.voicemailPlaybackView.getVisibility());
}
public void testSetPhoneCallDetails_VoicemailFromUnknown() {
setPhoneCallDetailsWithNumberAndType("", Calls.PRESENTATION_UNKNOWN,
- "", Calls.VOICEMAIL_TYPE);
+ "", AppCompatConstants.CALLS_VOICEMAIL_TYPE);
assertEquals(View.VISIBLE, mViewHolder.voicemailPlaybackView.getVisibility());
}
@@ -124,7 +127,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
* Test getCallDescriptionID method used to get the accessibility description for calls.
*/
public void testGetCallDescriptionID_Answered() {
- int[] callTypes = new int[]{ Calls.INCOMING_TYPE };
+ int[] callTypes = new int[]{ AppCompatConstants.CALLS_INCOMING_TYPE };
assertEquals(R.string.description_incoming_answered_call,
mHelper.getCallDescriptionStringID(callTypes));
}
@@ -133,7 +136,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
* Test getCallDescriptionID method used to get the accessibility description for calls.
*/
public void testGetCallDescriptionID_Missed() {
- int[] callTypes = new int[]{ Calls.MISSED_TYPE };
+ int[] callTypes = new int[]{ AppCompatConstants.CALLS_MISSED_TYPE };
assertEquals(R.string.description_incoming_missed_call,
mHelper.getCallDescriptionStringID(callTypes));
}
@@ -142,7 +145,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
* Test getCallDescriptionID method used to get the accessibility description for calls.
*/
public void testGetCallDescriptionID_Voicemail() {
- int[] callTypes = new int[]{ Calls.VOICEMAIL_TYPE };
+ int[] callTypes = new int[]{ AppCompatConstants.CALLS_VOICEMAIL_TYPE };
assertEquals(R.string.description_incoming_missed_call,
mHelper.getCallDescriptionStringID(callTypes));
}
@@ -153,7 +156,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
* only a single call for this caller.
*/
public void testGetCallDescriptionID_OutgoingSingle() {
- int[] callTypes = new int[]{ Calls.OUTGOING_TYPE };
+ int[] callTypes = new int[]{ AppCompatConstants.CALLS_OUTGOING_TYPE };
assertEquals(R.string.description_outgoing_call,
mHelper.getCallDescriptionStringID(callTypes));
}
@@ -164,7 +167,10 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
* many calls for this caller.
*/
public void testGetCallDescriptionID_OutgoingMultiple() {
- int[] callTypes = new int[]{ Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE };
+ int[] callTypes = new int[]{
+ AppCompatConstants.CALLS_OUTGOING_TYPE,
+ AppCompatConstants.CALLS_OUTGOING_TYPE
+ };
assertEquals(R.string.description_outgoing_call,
mHelper.getCallDescriptionStringID(callTypes));
}
@@ -174,8 +180,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
* For outgoing calls, we should NOT have "New Voicemail" in the description.
*/
public void testGetCallDescription_NoVoicemailOutgoing() {
- PhoneCallDetails details =
- getPhoneCallDetailsWithTypes(Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE);
+ PhoneCallDetails details = getPhoneCallDetailsWithTypes(
+ AppCompatConstants.CALLS_OUTGOING_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE);
CharSequence description = mHelper.getCallDescription(details);
assertFalse(description.toString()
.contains(this.mResources.getString(R.string.description_new_voicemail)));
@@ -186,8 +192,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
* For regular incoming calls, we should NOT have "New Voicemail" in the description.
*/
public void testGetCallDescription_NoVoicemailIncoming() {
- PhoneCallDetails details =
- getPhoneCallDetailsWithTypes(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE);
+ PhoneCallDetails details = getPhoneCallDetailsWithTypes(
+ AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE);
CharSequence description = mHelper.getCallDescription(details);
assertFalse(description.toString()
.contains(this.mResources.getString(R.string.description_new_voicemail)));
@@ -198,8 +204,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
* For regular missed calls, we should NOT have "New Voicemail" in the description.
*/
public void testGetCallDescription_NoVoicemailMissed() {
- PhoneCallDetails details =
- getPhoneCallDetailsWithTypes(Calls.MISSED_TYPE, Calls.OUTGOING_TYPE);
+ PhoneCallDetails details = getPhoneCallDetailsWithTypes(
+ AppCompatConstants.CALLS_MISSED_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE);
CharSequence description = mHelper.getCallDescription(details);
assertFalse(description.toString()
.contains(this.mResources.getString(R.string.description_new_voicemail)));
@@ -210,8 +216,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
* For voicemail calls, we should have "New Voicemail" in the description.
*/
public void testGetCallDescription_Voicemail() {
- PhoneCallDetails details =
- getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE, Calls.OUTGOING_TYPE);
+ PhoneCallDetails details = getPhoneCallDetailsWithTypes(
+ AppCompatConstants.CALLS_VOICEMAIL_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE);
CharSequence description = mHelper.getCallDescription(details);
assertTrue(description.toString()
.contains(this.mResources.getString(R.string.description_new_voicemail)));
@@ -222,7 +228,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
* Test that the "X calls" message is not present if there is only a single call.
*/
public void testGetCallDescription_NumCallsSingle() {
- PhoneCallDetails details = getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE);
+ PhoneCallDetails details =
+ getPhoneCallDetailsWithTypes(AppCompatConstants.CALLS_VOICEMAIL_TYPE);
CharSequence description = mHelper.getCallDescription(details);
// Rather than hard coding the "X calls" string message, we'll generate it with an empty
@@ -238,8 +245,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
* Test that the "X calls" message is present if there are many calls.
*/
public void testGetCallDescription_NumCallsMultiple() {
- PhoneCallDetails details =
- getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE, Calls.INCOMING_TYPE);
+ PhoneCallDetails details = getPhoneCallDetailsWithTypes(
+ AppCompatConstants.CALLS_VOICEMAIL_TYPE, AppCompatConstants.CALLS_INCOMING_TYPE);
CharSequence description = mHelper.getCallDescription(details);
assertTrue(description.toString()
.contains(this.mResources.getString(R.string.description_num_calls, 2)));
@@ -250,8 +257,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
* Test that the "Video call." message is present if the call had video capability.
*/
public void testGetCallDescription_Video() {
- PhoneCallDetails details =
- getPhoneCallDetailsWithTypes(Calls.INCOMING_TYPE, Calls.INCOMING_TYPE);
+ PhoneCallDetails details = getPhoneCallDetailsWithTypes(
+ AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_INCOMING_TYPE);
details.features = Calls.FEATURES_VIDEO;
CharSequence description = mHelper.getCallDescription(details);
diff --git a/tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java
index 318250247..dfacf4605 100644
--- a/tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java
+++ b/tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java
@@ -27,6 +27,7 @@ import android.widget.TextView;
import com.android.dialer.PhoneCallDetails;
import com.android.dialer.R;
+import com.android.dialer.util.AppCompatConstants;
import com.android.dialer.util.LocaleTestUtils;
import java.util.GregorianCalendar;
@@ -149,17 +150,17 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
}
public void testSetPhoneCallDetails_CallTypeIcons() {
- setPhoneCallDetailsWithCallTypeIcons(Calls.INCOMING_TYPE);
- assertCallTypeIconsEquals(Calls.INCOMING_TYPE);
+ setPhoneCallDetailsWithCallTypeIcons(AppCompatConstants.CALLS_INCOMING_TYPE);
+ assertCallTypeIconsEquals(AppCompatConstants.CALLS_INCOMING_TYPE);
- setPhoneCallDetailsWithCallTypeIcons(Calls.OUTGOING_TYPE);
- assertCallTypeIconsEquals(Calls.OUTGOING_TYPE);
+ setPhoneCallDetailsWithCallTypeIcons(AppCompatConstants.CALLS_OUTGOING_TYPE);
+ assertCallTypeIconsEquals(AppCompatConstants.CALLS_OUTGOING_TYPE);
- setPhoneCallDetailsWithCallTypeIcons(Calls.MISSED_TYPE);
- assertCallTypeIconsEquals(Calls.MISSED_TYPE);
+ setPhoneCallDetailsWithCallTypeIcons(AppCompatConstants.CALLS_MISSED_TYPE);
+ assertCallTypeIconsEquals(AppCompatConstants.CALLS_MISSED_TYPE);
- setPhoneCallDetailsWithCallTypeIcons(Calls.VOICEMAIL_TYPE);
- assertCallTypeIconsEquals(Calls.VOICEMAIL_TYPE);
+ setPhoneCallDetailsWithCallTypeIcons(AppCompatConstants.CALLS_VOICEMAIL_TYPE);
+ assertCallTypeIconsEquals(AppCompatConstants.CALLS_VOICEMAIL_TYPE);
}
/**
@@ -185,18 +186,31 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
}
public void testSetPhoneCallDetails_MultipleCallTypeIcons() {
- setPhoneCallDetailsWithCallTypeIcons(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE);
- assertCallTypeIconsEquals(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE);
+ setPhoneCallDetailsWithCallTypeIcons(
+ AppCompatConstants.CALLS_INCOMING_TYPE,
+ AppCompatConstants.CALLS_OUTGOING_TYPE);
+ assertCallTypeIconsEquals(
+ AppCompatConstants.CALLS_INCOMING_TYPE,
+ AppCompatConstants.CALLS_OUTGOING_TYPE);
- setPhoneCallDetailsWithCallTypeIcons(Calls.MISSED_TYPE, Calls.MISSED_TYPE);
- assertCallTypeIconsEquals(Calls.MISSED_TYPE, Calls.MISSED_TYPE);
+ setPhoneCallDetailsWithCallTypeIcons(
+ AppCompatConstants.CALLS_MISSED_TYPE,
+ AppCompatConstants.CALLS_MISSED_TYPE);
+ assertCallTypeIconsEquals(
+ AppCompatConstants.CALLS_MISSED_TYPE,
+ AppCompatConstants.CALLS_MISSED_TYPE);
}
public void testSetPhoneCallDetails_MultipleCallTypeIconsLastOneDropped() {
- setPhoneCallDetailsWithCallTypeIcons(Calls.MISSED_TYPE, Calls.MISSED_TYPE,
- Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE);
+ setPhoneCallDetailsWithCallTypeIcons(
+ AppCompatConstants.CALLS_MISSED_TYPE,
+ AppCompatConstants.CALLS_MISSED_TYPE,
+ AppCompatConstants.CALLS_INCOMING_TYPE,
+ AppCompatConstants.CALLS_OUTGOING_TYPE);
assertCallTypeIconsEqualsPlusOverflow("(4)",
- Calls.MISSED_TYPE, Calls.MISSED_TYPE, Calls.INCOMING_TYPE);
+ AppCompatConstants.CALLS_MISSED_TYPE,
+ AppCompatConstants.CALLS_MISSED_TYPE,
+ AppCompatConstants.CALLS_INCOMING_TYPE);
}
public void testSetPhoneCallDetails_Geocode() {
@@ -322,7 +336,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
private void setPhoneCallDetailsWithNumber(String number, int presentation,
String formattedNumber) {
PhoneCallDetails details = getPhoneCallDetails(number, presentation, formattedNumber);
- details.callTypes = new int[]{ Calls.VOICEMAIL_TYPE };
+ details.callTypes = new int[]{ AppCompatConstants.CALLS_VOICEMAIL_TYPE };
mHelper.setPhoneCallDetails(mViews, details);
}
@@ -384,7 +398,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
}
private void setDefaultDetails(PhoneCallDetails details) {
- details.callTypes = new int[]{ Calls.INCOMING_TYPE };
+ details.callTypes = new int[]{ AppCompatConstants.CALLS_INCOMING_TYPE };
details.countryIso = TEST_COUNTRY_ISO;
details.date = TEST_DATE;
details.duration = TEST_DURATION;
diff --git a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
index e499e550d..ae0dba822 100644
--- a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
+++ b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
@@ -57,6 +57,7 @@ import android.widget.TimePicker;
import android.widget.Toast;
import com.android.dialer.tests.R;
+import com.android.dialer.util.AppCompatConstants;
import java.util.Calendar;
import java.util.List;
@@ -72,7 +73,9 @@ public class FillCallLogTestActivity extends Activity {
private static final Random RNG = new Random();
private static final int[] CALL_TYPES = new int[] {
- Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE, Calls.MISSED_TYPE,
+ AppCompatConstants.CALLS_INCOMING_TYPE,
+ AppCompatConstants.CALLS_OUTGOING_TYPE,
+ AppCompatConstants.CALLS_MISSED_TYPE
};
private TextView mNumberTextView;
@@ -406,15 +409,15 @@ public class FillCallLogTestActivity extends Activity {
*/
private int getManualCallType() {
if (mCallTypeIncoming.isChecked()) {
- return Calls.INCOMING_TYPE;
+ return AppCompatConstants.CALLS_INCOMING_TYPE;
} else if (mCallTypeOutgoing.isChecked()) {
- return Calls.OUTGOING_TYPE;
+ return AppCompatConstants.CALLS_OUTGOING_TYPE;
} else if (mCallTypeVoicemail.isChecked()) {
- return Calls.VOICEMAIL_TYPE;
+ return AppCompatConstants.CALLS_VOICEMAIL_TYPE;
} else if (mCallTypeCustom.isChecked()) {
return Integer.parseInt(mCustomCallTypeTextView.getText().toString());
} else {
- return Calls.MISSED_TYPE;
+ return AppCompatConstants.CALLS_MISSED_TYPE;
}
}
@@ -536,7 +539,7 @@ public class FillCallLogTestActivity extends Activity {
dataUsage = (long) RNG.nextInt(52428800);
}
- if (getManualCallType() == Calls.VOICEMAIL_TYPE) {
+ if (getManualCallType() == AppCompatConstants.CALLS_VOICEMAIL_TYPE) {
addManualVoicemail(dateTime.getTimeInMillis());
} else {
addCall(mPhoneNumber.getText().toString(), getManualPresentation(),
@@ -606,7 +609,7 @@ public class FillCallLogTestActivity extends Activity {
values.put("phone_account_address", accountAddress);
values.put(Calls.NEW, Integer.valueOf(1));
- if (callType == Calls.MISSED_TYPE) {
+ if (callType == AppCompatConstants.CALLS_MISSED_TYPE) {
values.put(Calls.IS_READ, 0);
}