Home | History | Annotate | Download | only in calllogcache
      1 /*
      2  * Copyright (C) 2013 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License
     15  */
     16 
     17 package com.android.dialer.calllog.calllogcache;
     18 
     19 import android.content.Context;
     20 import android.telecom.PhoneAccount;
     21 import android.telecom.PhoneAccountHandle;
     22 
     23 /**
     24  * Modified version of {@link com.android.dialer.calllog.calllogcache.CallLogCache} to be used in
     25  * tests that allows injecting the voicemail number.
     26  *
     27  * NOTE: This tests the pre-LMR1 version because currently none of the tests involve multi-SIM,
     28  * but...
     29  * TODO: write tests to test multi-SIM functionality in TelecomCallLogCache.
     30  */
     31 public class TestTelecomCallLogCache extends CallLogCache {
     32     private CharSequence mVoicemailNumber;
     33     private String mAccountLabel;
     34 
     35     public TestTelecomCallLogCache(Context context, CharSequence voicemailNumber,
     36             String accountLabel) {
     37         super(context);
     38         mVoicemailNumber = voicemailNumber;
     39         mAccountLabel = accountLabel;
     40     }
     41 
     42     @Override
     43     public boolean isVoicemailNumber(PhoneAccountHandle accountHandle, CharSequence number) {
     44         return mVoicemailNumber.equals(number);
     45     }
     46 
     47     @Override
     48     public String getAccountLabel(PhoneAccountHandle accountHandle) {
     49         return mAccountLabel;
     50     }
     51 
     52     public void setAccountLabel(String accountLabel) {
     53         mAccountLabel = accountLabel;
     54     }
     55 
     56     @Override
     57     public int getAccountColor(PhoneAccountHandle accountHandle) {
     58         return PhoneAccount.NO_HIGHLIGHT_COLOR;
     59     }
     60 
     61     @Override
     62     public boolean doesAccountSupportCallSubject(PhoneAccountHandle accountHandle) {
     63         return false;
     64     }
     65 }
     66