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
StubVoicemailClient()35   public StubVoicemailClient() {}
36 
37   @Override
isVoicemailModuleEnabled()38   public boolean isVoicemailModuleEnabled() {
39     return false;
40   }
41 
42   @Override
isVoicemailEnabled(Context context, PhoneAccountHandle phoneAccountHandle)43   public boolean isVoicemailEnabled(Context context, PhoneAccountHandle phoneAccountHandle) {
44     return false;
45   }
46 
47   @Override
setVoicemailEnabled( Context context, PhoneAccountHandle phoneAccountHandle, boolean enabled)48   public void setVoicemailEnabled(
49       Context context, PhoneAccountHandle phoneAccountHandle, boolean enabled) {}
50 
51   @Override
appendOmtpVoicemailSelectionClause( Context context, StringBuilder where, List<String> selectionArgs)52   public void appendOmtpVoicemailSelectionClause(
53       Context context, StringBuilder where, List<String> selectionArgs) {}
54 
55   @Override
appendOmtpVoicemailStatusSelectionClause( Context context, StringBuilder where, List<String> selectionArgs)56   public void appendOmtpVoicemailStatusSelectionClause(
57       Context context, StringBuilder where, List<String> selectionArgs) {}
58 
59   @Override
isVoicemailArchiveEnabled(Context context, PhoneAccountHandle phoneAccountHandle)60   public boolean isVoicemailArchiveEnabled(Context context, PhoneAccountHandle phoneAccountHandle) {
61     return false;
62   }
63 
64   @Override
isVoicemailArchiveAvailable(Context context)65   public boolean isVoicemailArchiveAvailable(Context context) {
66     return false;
67   }
68 
69   @Override
setVoicemailArchiveEnabled( Context context, PhoneAccountHandle phoneAccountHandle, boolean value)70   public void setVoicemailArchiveEnabled(
71       Context context, PhoneAccountHandle phoneAccountHandle, boolean value) {}
72 
73   @Override
isVoicemailTranscriptionAvailable( Context context, PhoneAccountHandle phoneAccountHandle)74   public boolean isVoicemailTranscriptionAvailable(
75       Context context, PhoneAccountHandle phoneAccountHandle) {
76     return false;
77   }
78 
79   @Override
isVoicemailTranscriptionEnabled(Context context, PhoneAccountHandle account)80   public boolean isVoicemailTranscriptionEnabled(Context context, PhoneAccountHandle account) {
81     return false;
82   }
83 
84   @Override
isVoicemailDonationAvailable(Context context, PhoneAccountHandle account)85   public boolean isVoicemailDonationAvailable(Context context, PhoneAccountHandle account) {
86     return false;
87   }
88 
89   @Override
isVoicemailDonationEnabled(Context context, PhoneAccountHandle account)90   public boolean isVoicemailDonationEnabled(Context context, PhoneAccountHandle account) {
91     return false;
92   }
93 
94   @Override
setVoicemailTranscriptionEnabled( Context context, PhoneAccountHandle phoneAccountHandle, boolean enabled)95   public void setVoicemailTranscriptionEnabled(
96       Context context, PhoneAccountHandle phoneAccountHandle, boolean enabled) {}
97 
98   @Override
setVoicemailDonationEnabled( Context context, PhoneAccountHandle phoneAccountHandle, boolean enabled)99   public void setVoicemailDonationEnabled(
100       Context context, PhoneAccountHandle phoneAccountHandle, boolean enabled) {}
101 
102   @Override
isActivated(Context context, PhoneAccountHandle phoneAccountHandle)103   public boolean isActivated(Context context, PhoneAccountHandle phoneAccountHandle) {
104     return false;
105   }
106 
107   @Override
showConfigUi(@onNull Context context)108   public void showConfigUi(@NonNull Context context) {}
109 
110   @Override
getConfig( @onNull Context context, @Nullable PhoneAccountHandle phoneAccountHandle)111   public PersistableBundle getConfig(
112       @NonNull Context context, @Nullable PhoneAccountHandle phoneAccountHandle) {
113     return new PersistableBundle();
114   }
115 
116   @Override
onBoot(@onNull Context context)117   public void onBoot(@NonNull Context context) {}
118 
119   @Override
onShutdown(@onNull Context context)120   public void onShutdown(@NonNull Context context) {}
121 
122   @Override
addActivationStateListener(ActivationStateListener listener)123   public void addActivationStateListener(ActivationStateListener listener) {
124     // Do nothing
125   }
126 
127   @Override
removeActivationStateListener(ActivationStateListener listener)128   public void removeActivationStateListener(ActivationStateListener listener) {
129     // Do nothing
130   }
131 
132   @Override
hasCarrierSupport(Context context, PhoneAccountHandle phoneAccountHandle)133   public boolean hasCarrierSupport(Context context, PhoneAccountHandle phoneAccountHandle) {
134     return false;
135   }
136 
137   @Override
createPinChanger(Context context, PhoneAccountHandle phoneAccountHandle)138   public PinChanger createPinChanger(Context context, PhoneAccountHandle phoneAccountHandle) {
139     throw Assert.createAssertionFailException("should never be called on stub.");
140   }
141 
142   @Override
onTosAccepted(Context context, PhoneAccountHandle account)143   public void onTosAccepted(Context context, PhoneAccountHandle account) {}
144 
145   @Override
hasAcceptedTos(Context context, PhoneAccountHandle phoneAccountHandle)146   public boolean hasAcceptedTos(Context context, PhoneAccountHandle phoneAccountHandle) {
147     return false;
148   }
149 
150   @Override
151   @Nullable
getCarrierConfigString(Context context, PhoneAccountHandle account, String key)152   public String getCarrierConfigString(Context context, PhoneAccountHandle account, String key) {
153     return null;
154   }
155 }
156