1 /*
2  * Copyright (C) 2016 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.enrichedcall.stub;
18 
19 import android.content.BroadcastReceiver.PendingResult;
20 import android.support.annotation.MainThread;
21 import android.support.annotation.NonNull;
22 import android.support.annotation.Nullable;
23 import com.android.dialer.calldetails.CallDetailsEntries;
24 import com.android.dialer.calldetails.CallDetailsEntries.CallDetailsEntry;
25 import com.android.dialer.common.Assert;
26 import com.android.dialer.enrichedcall.EnrichedCallCapabilities;
27 import com.android.dialer.enrichedcall.EnrichedCallManager;
28 import com.android.dialer.enrichedcall.Session;
29 import com.android.dialer.enrichedcall.historyquery.proto.HistoryResult;
30 import com.android.dialer.enrichedcall.videoshare.VideoShareListener;
31 import com.android.dialer.enrichedcall.videoshare.VideoShareSession;
32 import com.android.dialer.multimedia.MultimediaData;
33 import java.util.Collections;
34 import java.util.List;
35 import java.util.Map;
36 
37 /** Stub implementation of {@link EnrichedCallManager}. */
38 public final class EnrichedCallManagerStub implements EnrichedCallManager {
39 
40   @Override
registerCapabilitiesListener(@onNull CapabilitiesListener listener)41   public void registerCapabilitiesListener(@NonNull CapabilitiesListener listener) {}
42 
43   @Override
requestCapabilities(@onNull String number)44   public void requestCapabilities(@NonNull String number) {}
45 
46   @Override
unregisterCapabilitiesListener(@onNull CapabilitiesListener listener)47   public void unregisterCapabilitiesListener(@NonNull CapabilitiesListener listener) {}
48 
49   @Override
getCapabilities(@onNull String number)50   public EnrichedCallCapabilities getCapabilities(@NonNull String number) {
51     return null;
52   }
53 
54   @Override
clearCachedData()55   public void clearCachedData() {}
56 
57   @Override
startCallComposerSession(@onNull String number)58   public long startCallComposerSession(@NonNull String number) {
59     return Session.NO_SESSION_ID;
60   }
61 
62   @Override
sendCallComposerData(long sessionId, @NonNull MultimediaData data)63   public void sendCallComposerData(long sessionId, @NonNull MultimediaData data) {}
64 
65   @Override
endCallComposerSession(long sessionId)66   public void endCallComposerSession(long sessionId) {}
67 
68   @Override
sendPostCallNote(@onNull String number, @NonNull String message)69   public void sendPostCallNote(@NonNull String number, @NonNull String message) {}
70 
71   @Override
onCapabilitiesReceived( @onNull String number, @NonNull EnrichedCallCapabilities capabilities)72   public void onCapabilitiesReceived(
73       @NonNull String number, @NonNull EnrichedCallCapabilities capabilities) {}
74 
75   @Override
registerStateChangedListener(@onNull StateChangedListener listener)76   public void registerStateChangedListener(@NonNull StateChangedListener listener) {}
77 
78   @Nullable
79   @Override
getSession( @onNull String uniqueCallId, @NonNull String number, @Nullable Filter filter)80   public Session getSession(
81       @NonNull String uniqueCallId, @NonNull String number, @Nullable Filter filter) {
82     return null;
83   }
84 
85   @Nullable
86   @Override
getSession(long sessionId)87   public Session getSession(long sessionId) {
88     return null;
89   }
90 
91   @MainThread
92   @NonNull
93   @Override
getAllSessionsForDisplay()94   public List<String> getAllSessionsForDisplay() {
95     Assert.isMainThread();
96     return Collections.emptyList();
97   }
98 
99   @NonNull
100   @Override
createIncomingCallComposerFilter()101   public Filter createIncomingCallComposerFilter() {
102     return session -> false;
103   }
104 
105   @NonNull
106   @Override
createOutgoingCallComposerFilter()107   public Filter createOutgoingCallComposerFilter() {
108     return session -> false;
109   }
110 
111   @Override
registerHistoricalDataChangedListener( @onNull HistoricalDataChangedListener listener)112   public void registerHistoricalDataChangedListener(
113       @NonNull HistoricalDataChangedListener listener) {}
114 
115   @Override
unregisterHistoricalDataChangedListener( @onNull HistoricalDataChangedListener listener)116   public void unregisterHistoricalDataChangedListener(
117       @NonNull HistoricalDataChangedListener listener) {}
118 
119   @Nullable
120   @Override
121   @MainThread
getAllHistoricalData( @onNull String number, @NonNull CallDetailsEntries entries)122   public Map<CallDetailsEntry, List<HistoryResult>> getAllHistoricalData(
123       @NonNull String number, @NonNull CallDetailsEntries entries) {
124     Assert.isMainThread();
125     return null;
126   }
127 
128   @Override
hasStoredData()129   public boolean hasStoredData() {
130     Assert.isMainThread();
131     return false;
132   }
133 
134   @MainThread
135   @Override
requestAllHistoricalData( @onNull String number, @NonNull CallDetailsEntries entries)136   public void requestAllHistoricalData(
137       @NonNull String number, @NonNull CallDetailsEntries entries) {
138     Assert.isMainThread();
139   }
140 
141   @Override
unregisterStateChangedListener(@onNull StateChangedListener listener)142   public void unregisterStateChangedListener(@NonNull StateChangedListener listener) {}
143 
144   @Override
onSessionStatusUpdate(long sessionId, @NonNull String number, int state)145   public void onSessionStatusUpdate(long sessionId, @NonNull String number, int state) {}
146 
147   @Override
onMessageUpdate(long sessionId, @NonNull String messageId, int state)148   public void onMessageUpdate(long sessionId, @NonNull String messageId, int state) {}
149 
150   @Override
onIncomingCallComposerData(long sessionId, @NonNull MultimediaData multimediaData)151   public void onIncomingCallComposerData(long sessionId, @NonNull MultimediaData multimediaData) {}
152 
153   @Override
onIncomingPostCallData( @onNull PendingResult pendingResult, long sessionId, @NonNull MultimediaData multimediaData)154   public void onIncomingPostCallData(
155       @NonNull PendingResult pendingResult,
156       long sessionId,
157       @NonNull MultimediaData multimediaData) {
158     pendingResult.finish();
159   }
160 
161   @Override
registerVideoShareListener(@onNull VideoShareListener listener)162   public void registerVideoShareListener(@NonNull VideoShareListener listener) {}
163 
164   @Override
unregisterVideoShareListener(@onNull VideoShareListener listener)165   public void unregisterVideoShareListener(@NonNull VideoShareListener listener) {}
166 
167   @Override
onIncomingVideoShareInvite(long sessionId, @NonNull String number)168   public boolean onIncomingVideoShareInvite(long sessionId, @NonNull String number) {
169     return false;
170   }
171 
172   @Override
startVideoShareSession(String number)173   public long startVideoShareSession(String number) {
174     return Session.NO_SESSION_ID;
175   }
176 
177   @Override
acceptVideoShareSession(long sessionId)178   public boolean acceptVideoShareSession(long sessionId) {
179     return false;
180   }
181 
182   @Override
getVideoShareInviteSessionId(@onNull String number)183   public long getVideoShareInviteSessionId(@NonNull String number) {
184     return Session.NO_SESSION_ID;
185   }
186 
187   @MainThread
188   @Nullable
189   @Override
getVideoShareSession(long sessionId)190   public VideoShareSession getVideoShareSession(long sessionId) {
191     Assert.isMainThread();
192     return null;
193   }
194 
195   @Override
endVideoShareSession(long sessionId)196   public void endVideoShareSession(long sessionId) {}
197 }
198