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.DrawableRes; 22 import android.support.annotation.MainThread; 23 import android.support.annotation.NonNull; 24 import android.support.annotation.Nullable; 25 import android.support.annotation.StringRes; 26 import android.telecom.Call; 27 import android.telecom.PhoneAccountHandle; 28 import com.android.dialer.common.Assert; 29 import com.android.dialer.duo.Duo; 30 import com.android.dialer.duo.DuoListener; 31 import com.google.common.base.Optional; 32 import com.google.common.collect.ImmutableMap; 33 import com.google.common.util.concurrent.Futures; 34 import com.google.common.util.concurrent.ListenableFuture; 35 import java.util.List; 36 import javax.inject.Inject; 37 38 public class DuoStub implements Duo { 39 40 @Inject DuoStub()41 public DuoStub() {} 42 43 @Override isEnabled(@onNull Context context)44 public boolean isEnabled(@NonNull Context context) { 45 return false; 46 } 47 48 @Override isInstalled(@onNull Context context)49 public boolean isInstalled(@NonNull Context context) { 50 return false; 51 } 52 53 @Override isActivated(@onNull Context context)54 public boolean isActivated(@NonNull Context context) { 55 return false; 56 } 57 58 @MainThread 59 @Override isReachable(@onNull Context context, @Nullable String number)60 public boolean isReachable(@NonNull Context context, @Nullable String number) { 61 Assert.isMainThread(); 62 Assert.isNotNull(context); 63 return false; 64 } 65 66 @MainThread 67 @Override supportsUpgrade( @onNull Context context, @Nullable String number, @Nullable PhoneAccountHandle phoneAccountHandle)68 public Optional<Boolean> supportsUpgrade( 69 @NonNull Context context, 70 @Nullable String number, 71 @Nullable PhoneAccountHandle phoneAccountHandle) { 72 Assert.isMainThread(); 73 Assert.isNotNull(context); 74 return Optional.of(false); 75 } 76 77 @Override updateReachability( @onNull Context context, @NonNull List<String> numbers)78 public ListenableFuture<ImmutableMap<String, ReachabilityData>> updateReachability( 79 @NonNull Context context, @NonNull List<String> numbers) { 80 Assert.isMainThread(); 81 Assert.isNotNull(context); 82 Assert.isNotNull(numbers); 83 return Futures.immediateFuture(ImmutableMap.of()); 84 } 85 86 @Override reloadReachability(@onNull Context context)87 public void reloadReachability(@NonNull Context context) {} 88 89 @Override getPhoneAccountHandle()90 public Optional<PhoneAccountHandle> getPhoneAccountHandle() { 91 return Optional.absent(); 92 } 93 94 @Override isDuoAccount(PhoneAccountHandle phoneAccountHandle)95 public boolean isDuoAccount(PhoneAccountHandle phoneAccountHandle) { 96 return false; 97 } 98 99 @Override isDuoAccount(String componentName)100 public boolean isDuoAccount(String componentName) { 101 return false; 102 } 103 104 @MainThread 105 @Override getCallIntent(@onNull String number)106 public Optional<Intent> getCallIntent(@NonNull String number) { 107 Assert.isMainThread(); 108 Assert.isNotNull(number); 109 return Optional.absent(); 110 } 111 112 @Override getActivateIntent()113 public Optional<Intent> getActivateIntent() { 114 return Optional.absent(); 115 } 116 117 @Override getInviteIntent(String number)118 public Optional<Intent> getInviteIntent(String number) { 119 return Optional.absent(); 120 } 121 122 @Override getInstallDuoIntent()123 public Optional<Intent> getInstallDuoIntent() { 124 return null; 125 } 126 127 @MainThread 128 @Override requestUpgrade(@onNull Context context, Call call)129 public void requestUpgrade(@NonNull Context context, Call call) { 130 Assert.isMainThread(); 131 Assert.isNotNull(call); 132 } 133 134 @MainThread 135 @Override registerListener(DuoListener listener)136 public void registerListener(DuoListener listener) { 137 Assert.isMainThread(); 138 Assert.isNotNull(listener); 139 } 140 141 @MainThread 142 @Override unregisterListener(DuoListener listener)143 public void unregisterListener(DuoListener listener) { 144 Assert.isMainThread(); 145 Assert.isNotNull(listener); 146 } 147 148 @StringRes 149 @Override getOutgoingCallTypeText()150 public int getOutgoingCallTypeText() { 151 return -1; 152 } 153 154 @StringRes 155 @Override getIncomingCallTypeText()156 public int getIncomingCallTypeText() { 157 return -1; 158 } 159 160 @DrawableRes 161 @Override getLogo()162 public int getLogo() { 163 return -1; 164 } 165 } 166