summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNancy Chen <nancychen@google.com>2015-12-22 11:41:36 -0800
committerNancy Chen <nancychen@google.com>2015-12-28 18:32:26 -0800
commitfdb93b7079d522d688ec0ebe58c92d45aee48786 (patch)
treef5aaf12bc77f8348c9fa122e7aac9c599104cacc /tests
parent4a7c43ab60a186d6d6fe5c2bb91cdb55df619c4f (diff)
Make TelecomManager APIs compatible with Lollipop. (1/3)
+ Add methods to TelecomManagerCompat - Move TelecomManagerCompat to ContactsCommon because it is called within ContactsCommon - Move TestTelecomCallLogCache to the right package so tests pass Bug: 25776171 Change-Id: I1963959292d8038ab505488d831afd06e6fef6d0
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java1
-rw-r--r--tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java1
-rw-r--r--tests/src/com/android/dialer/calllog/calllogcache/TestTelecomCallLogCache.java (renamed from tests/src/com/android/dialer/calllog/TestTelecomCallLogCache.java)4
-rw-r--r--tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java14
4 files changed, 9 insertions, 11 deletions
diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
index a97fce3f7..28caed469 100644
--- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
+++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
@@ -26,6 +26,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.calllog.calllogcache.TestTelecomCallLogCache;
import com.android.dialer.util.AppCompatConstants;
/**
diff --git a/tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java
index 23ee7b311..b6202b904 100644
--- a/tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java
+++ b/tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java
@@ -28,6 +28,7 @@ import android.widget.TextView;
import com.android.dialer.PhoneCallDetails;
import com.android.dialer.R;
+import com.android.dialer.calllog.calllogcache.TestTelecomCallLogCache;
import com.android.dialer.util.AppCompatConstants;
import com.android.dialer.util.LocaleTestUtils;
diff --git a/tests/src/com/android/dialer/calllog/TestTelecomCallLogCache.java b/tests/src/com/android/dialer/calllog/calllogcache/TestTelecomCallLogCache.java
index fcf988412..077a498c9 100644
--- a/tests/src/com/android/dialer/calllog/TestTelecomCallLogCache.java
+++ b/tests/src/com/android/dialer/calllog/calllogcache/TestTelecomCallLogCache.java
@@ -14,14 +14,12 @@
* limitations under the License
*/
-package com.android.dialer.calllog;
+package com.android.dialer.calllog.calllogcache;
import android.content.Context;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
-import com.android.dialer.calllog.calllogcache.CallLogCache;
-
/**
* Modified version of {@link com.android.dialer.calllog.calllogcache.CallLogCache} to be used in
* tests that allows injecting the voicemail number.
diff --git a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
index ae0dba822..da41dfce4 100644
--- a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
+++ b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
@@ -39,7 +39,6 @@ import android.provider.VoicemailContract.Status;
import android.provider.VoicemailContract.Voicemails;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
-import android.telecom.TelecomManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.format.DateFormat;
@@ -56,8 +55,10 @@ import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
+import com.android.contacts.common.compat.telecom.TelecomManagerCompat;
import com.android.dialer.tests.R;
import com.android.dialer.util.AppCompatConstants;
+import com.android.dialer.util.TelecomUtil;
import java.util.Calendar;
import java.util.List;
@@ -439,9 +440,8 @@ public class FillCallLogTestActivity extends Activity {
}
private PhoneAccountHandle getManualAccount() {
- TelecomManager telecomManager =
- (TelecomManager) getSystemService(Context.TELECOM_SERVICE);
- List <PhoneAccountHandle> accountHandles = telecomManager.getCallCapablePhoneAccounts();
+ List <PhoneAccountHandle> accountHandles = TelecomUtil.getCallCapablePhoneAccounts(this);
+ //TODO: hide the corresponding radio buttons if no accounts are available.
if (mAccount0.isChecked()) {
return accountHandles.get(0);
} else if (mAccount1.isChecked()){
@@ -567,11 +567,9 @@ public class FillCallLogTestActivity extends Activity {
final ContentResolver resolver = getContentResolver();
int numberPresentation = Calls.PRESENTATION_ALLOWED;
- TelecomManager tm = (TelecomManager) getSystemService(Context.TELECOM_SERVICE);
-
String accountAddress = null;
- if (tm != null && accountHandle != null) {
- PhoneAccount account = tm.getPhoneAccount(accountHandle);
+ if (accountHandle != null) {
+ PhoneAccount account = TelecomUtil.getPhoneAccount(this, accountHandle);
if (account != null) {
Uri address = account.getSubscriptionAddress();
if (address != null) {