• 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.dialer.duo.stub;
18 
19 import android.content.Context;
20 import android.content.Intent;
21 import android.support.annotation.MainThread;
22 import android.support.annotation.NonNull;
23 import android.support.annotation.Nullable;
24 import android.support.annotation.StringRes;
25 import android.telecom.Call;
26 import android.telecom.PhoneAccountHandle;
27 import com.android.dialer.common.Assert;
28 import com.android.dialer.duo.Duo;
29 import com.android.dialer.duo.DuoListener;
30 import com.google.common.base.Optional;
31 import java.util.List;
32 import javax.inject.Inject;
33 
34 public class DuoStub implements Duo {
35 
36   @Inject
DuoStub()37   public DuoStub() {}
38 
39   @Override
isEnabled(@onNull Context context)40   public boolean isEnabled(@NonNull Context context) {
41     return false;
42   }
43 
44   @Override
isInstalled(@onNull Context context)45   public boolean isInstalled(@NonNull Context context) {
46     return false;
47   }
48 
49   @Override
isActivated(@onNull Context context)50   public boolean isActivated(@NonNull Context context) {
51     return false;
52   }
53 
54   @MainThread
55   @Override
isReachable(@onNull Context context, @Nullable String number)56   public boolean isReachable(@NonNull Context context, @Nullable String number) {
57     Assert.isMainThread();
58     Assert.isNotNull(context);
59     return false;
60   }
61 
62   @MainThread
63   @Override
supportsUpgrade( @onNull Context context, @Nullable String number, @Nullable PhoneAccountHandle phoneAccountHandle)64   public Optional<Boolean> supportsUpgrade(
65       @NonNull Context context,
66       @Nullable String number,
67       @Nullable PhoneAccountHandle phoneAccountHandle) {
68     Assert.isMainThread();
69     Assert.isNotNull(context);
70     return Optional.of(false);
71   }
72 
73   @Override
updateReachability(@onNull Context context, @NonNull List<String> numbers)74   public void updateReachability(@NonNull Context context, @NonNull List<String> numbers) {
75     Assert.isMainThread();
76     Assert.isNotNull(context);
77     Assert.isNotNull(numbers);
78   }
79 
80   @Override
reloadReachability(@onNull Context context)81   public void reloadReachability(@NonNull Context context) {}
82 
83   @MainThread
84   @Override
getIntent(@onNull Context context, @NonNull String number)85   public Intent getIntent(@NonNull Context context, @NonNull String number) {
86     Assert.isMainThread();
87     Assert.isNotNull(context);
88     Assert.isNotNull(number);
89     return null;
90   }
91 
92   @MainThread
93   @Override
requestUpgrade(@onNull Context context, Call call)94   public void requestUpgrade(@NonNull Context context, Call call) {
95     Assert.isMainThread();
96     Assert.isNotNull(call);
97   }
98 
99   @MainThread
100   @Override
registerListener(DuoListener listener)101   public void registerListener(DuoListener listener) {
102     Assert.isMainThread();
103     Assert.isNotNull(listener);
104   }
105 
106   @MainThread
107   @Override
unregisterListener(DuoListener listener)108   public void unregisterListener(DuoListener listener) {
109     Assert.isMainThread();
110     Assert.isNotNull(listener);
111   }
112 
113   @StringRes
114   @Override
getOutgoingCallTypeText()115   public int getOutgoingCallTypeText() {
116     return -1;
117   }
118 
119   @StringRes
120   @Override
getIncomingCallTypeText()121   public int getIncomingCallTypeText() {
122     return -1;
123   }
124 }
125