• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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)74   public boolean isVoicemailTranscriptionAvailable(Context context) {
75     return false;
76   }
77 
78   @Override
isVoicemailDonationAvailable(Context context)79   public boolean isVoicemailDonationAvailable(Context context) {
80     return false;
81   }
82 
83   @Override
isVoicemailDonationEnabled(Context context, PhoneAccountHandle account)84   public boolean isVoicemailDonationEnabled(Context context, PhoneAccountHandle account) {
85     return false;
86   }
87 
88   @Override
setVoicemailDonationEnabled( Context context, PhoneAccountHandle phoneAccountHandle, boolean enabled)89   public void setVoicemailDonationEnabled(
90       Context context, PhoneAccountHandle phoneAccountHandle, boolean enabled) {}
91 
92   @Override
isActivated(Context context, PhoneAccountHandle phoneAccountHandle)93   public boolean isActivated(Context context, PhoneAccountHandle phoneAccountHandle) {
94     return false;
95   }
96 
97   @Override
showConfigUi(@onNull Context context)98   public void showConfigUi(@NonNull Context context) {}
99 
100   @Override
getConfig( @onNull Context context, @Nullable PhoneAccountHandle phoneAccountHandle)101   public PersistableBundle getConfig(
102       @NonNull Context context, @Nullable PhoneAccountHandle phoneAccountHandle) {
103     return new PersistableBundle();
104   }
105 
106   @Override
onBoot(@onNull Context context)107   public void onBoot(@NonNull Context context) {}
108 
109   @Override
onShutdown(@onNull Context context)110   public void onShutdown(@NonNull Context context) {}
111 
112   @Override
addActivationStateListener(ActivationStateListener listener)113   public void addActivationStateListener(ActivationStateListener listener) {
114     // Do nothing
115   }
116 
117   @Override
removeActivationStateListener(ActivationStateListener listener)118   public void removeActivationStateListener(ActivationStateListener listener) {
119     // Do nothing
120   }
121 
122   @Override
hasCarrierSupport(Context context, PhoneAccountHandle phoneAccountHandle)123   public boolean hasCarrierSupport(Context context, PhoneAccountHandle phoneAccountHandle) {
124     return false;
125   }
126 
127   @Override
createPinChanger(Context context, PhoneAccountHandle phoneAccountHandle)128   public PinChanger createPinChanger(Context context, PhoneAccountHandle phoneAccountHandle) {
129     throw Assert.createAssertionFailException("should never be called on stub.");
130   }
131 
132   @Override
onTosAccepted(Context context, PhoneAccountHandle account)133   public void onTosAccepted(Context context, PhoneAccountHandle account) {}
134 
135   @Override
hasAcceptedTos(Context context, PhoneAccountHandle phoneAccountHandle)136   public boolean hasAcceptedTos(Context context, PhoneAccountHandle phoneAccountHandle) {
137     return false;
138   }
139 
140   @Override
141   @Nullable
getCarrierConfigString(Context context, PhoneAccountHandle account, String key)142   public String getCarrierConfigString(Context context, PhoneAccountHandle account, String key) {
143     return null;
144   }
145 }
146