Home | History | Annotate | Download | only in stub
      1 /*
      2  * Copyright (C) 2017 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.voicemail.stub;
     18 
     19 import android.content.Context;
     20 import android.os.PersistableBundle;
     21 import android.support.annotation.NonNull;
     22 import android.support.annotation.Nullable;
     23 import android.telecom.PhoneAccountHandle;
     24 import com.android.dialer.common.Assert;
     25 import com.android.voicemail.PinChanger;
     26 import com.android.voicemail.VoicemailClient;
     27 import java.util.List;
     28 import javax.inject.Inject;
     29 
     30 /**
     31  * A no-op version of the voicemail module for build targets that don't support the new OTMP client.
     32  */
     33 public final class StubVoicemailClient implements VoicemailClient {
     34   @Inject
     35   public StubVoicemailClient() {}
     36 
     37   @Override
     38   public boolean isVoicemailModuleEnabled() {
     39     return false;
     40   }
     41 
     42   @Override
     43   public boolean isVoicemailEnabled(Context context, PhoneAccountHandle phoneAccountHandle) {
     44     return false;
     45   }
     46 
     47   @Override
     48   public void setVoicemailEnabled(
     49       Context context, PhoneAccountHandle phoneAccountHandle, boolean enabled) {}
     50 
     51   @Override
     52   public void appendOmtpVoicemailSelectionClause(
     53       Context context, StringBuilder where, List<String> selectionArgs) {}
     54 
     55   @Override
     56   public void appendOmtpVoicemailStatusSelectionClause(
     57       Context context, StringBuilder where, List<String> selectionArgs) {}
     58 
     59   @Override
     60   public boolean isVoicemailArchiveEnabled(Context context, PhoneAccountHandle phoneAccountHandle) {
     61     return false;
     62   }
     63 
     64   @Override
     65   public boolean isVoicemailArchiveAvailable(Context context) {
     66     return false;
     67   }
     68 
     69   @Override
     70   public void setVoicemailArchiveEnabled(
     71       Context context, PhoneAccountHandle phoneAccountHandle, boolean value) {}
     72 
     73   @Override
     74   public boolean isVoicemailTranscriptionAvailable(Context context) {
     75     return false;
     76   }
     77 
     78   @Override
     79   public boolean isVoicemailDonationAvailable(Context context) {
     80     return false;
     81   }
     82 
     83   @Override
     84   public boolean isVoicemailDonationEnabled(Context context, PhoneAccountHandle account) {
     85     return false;
     86   }
     87 
     88   @Override
     89   public void setVoicemailDonationEnabled(
     90       Context context, PhoneAccountHandle phoneAccountHandle, boolean enabled) {}
     91 
     92   @Override
     93   public boolean isActivated(Context context, PhoneAccountHandle phoneAccountHandle) {
     94     return false;
     95   }
     96 
     97   @Override
     98   public void showConfigUi(@NonNull Context context) {}
     99 
    100   @Override
    101   public PersistableBundle getConfig(
    102       @NonNull Context context, @Nullable PhoneAccountHandle phoneAccountHandle) {
    103     return new PersistableBundle();
    104   }
    105 
    106   @Override
    107   public void onBoot(@NonNull Context context) {}
    108 
    109   @Override
    110   public void onShutdown(@NonNull Context context) {}
    111 
    112   @Override
    113   public void addActivationStateListener(ActivationStateListener listener) {
    114     // Do nothing
    115   }
    116 
    117   @Override
    118   public void removeActivationStateListener(ActivationStateListener listener) {
    119     // Do nothing
    120   }
    121 
    122   @Override
    123   public boolean hasCarrierSupport(Context context, PhoneAccountHandle phoneAccountHandle) {
    124     return false;
    125   }
    126 
    127   @Override
    128   public PinChanger createPinChanger(Context context, PhoneAccountHandle phoneAccountHandle) {
    129     throw Assert.createAssertionFailException("should never be called on stub.");
    130   }
    131 
    132   @Override
    133   public void onTosAccepted(Context context, PhoneAccountHandle account) {}
    134 
    135   @Override
    136   public boolean hasAcceptedTos(Context context, PhoneAccountHandle phoneAccountHandle) {
    137     return false;
    138   }
    139 
    140   @Override
    141   @Nullable
    142   public String getCarrierConfigString(Context context, PhoneAccountHandle account, String key) {
    143     return null;
    144   }
    145 }
    146