• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2014, 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.server.telecom;
18 
19 import android.net.Uri;
20 import android.os.UserHandle;
21 import android.telecom.PhoneAccountHandle;
22 
23 import android.telecom.CallerInfo;
24 
25 /**
26  * Creates a notification for calls that the user missed (neither answered nor rejected).
27  */
28 public interface MissedCallNotifier extends CallsManager.CallsManagerListener {
29     class CallInfoFactory {
makeCallInfo(CallerInfo callerInfo, PhoneAccountHandle phoneAccountHandle, Uri handle, long creationTimeMillis)30         public CallInfo makeCallInfo(CallerInfo callerInfo, PhoneAccountHandle phoneAccountHandle,
31                 Uri handle, long creationTimeMillis) {
32             return new CallInfo(callerInfo, phoneAccountHandle, handle, creationTimeMillis);
33         }
34     }
35 
36     class CallInfo {
37         private CallerInfo mCallerInfo;
38         private PhoneAccountHandle mPhoneAccountHandle;
39         private Uri mHandle;
40         private long mCreationTimeMillis;
41 
CallInfo(CallerInfo callerInfo, PhoneAccountHandle phoneAccountHandle, Uri handle, long creationTimeMillis)42         public CallInfo(CallerInfo callerInfo, PhoneAccountHandle phoneAccountHandle, Uri handle,
43                 long creationTimeMillis) {
44             mCallerInfo = callerInfo;
45             mPhoneAccountHandle = phoneAccountHandle;
46             mHandle = handle;
47             mCreationTimeMillis = creationTimeMillis;
48         }
49 
CallInfo(Call call)50         public CallInfo(Call call) {
51             mCallerInfo = call.getCallerInfo();
52             mPhoneAccountHandle = call.getTargetPhoneAccount();
53             mHandle = call.getHandle();
54             mCreationTimeMillis = call.getCreationTimeMillis();
55         }
56 
getCallerInfo()57         public CallerInfo getCallerInfo() {
58             return mCallerInfo;
59         }
60 
getPhoneAccountHandle()61         public PhoneAccountHandle getPhoneAccountHandle() {
62             return mPhoneAccountHandle;
63         }
64 
getHandle()65         public Uri getHandle() {
66             return mHandle;
67         }
68 
getHandleSchemeSpecificPart()69         public String getHandleSchemeSpecificPart() {
70             return mHandle == null ? null : mHandle.getSchemeSpecificPart();
71         }
72 
getCreationTimeMillis()73         public long getCreationTimeMillis() {
74             return mCreationTimeMillis;
75         }
76 
getPhoneNumber()77         public String getPhoneNumber() {
78             return mCallerInfo == null ? null : mCallerInfo.getPhoneNumber();
79         }
80 
getName()81         public String getName() {
82             return mCallerInfo == null ? null : mCallerInfo.getName();
83         }
84     }
85 
clearMissedCalls(UserHandle userHandle)86     void clearMissedCalls(UserHandle userHandle);
87 
showMissedCallNotification(CallInfo call)88     void showMissedCallNotification(CallInfo call);
89 
reloadAfterBootComplete(CallerInfoLookupHelper callerInfoLookupHelper, CallInfoFactory callInfoFactory)90     void reloadAfterBootComplete(CallerInfoLookupHelper callerInfoLookupHelper,
91             CallInfoFactory callInfoFactory);
92 
reloadFromDatabase(CallerInfoLookupHelper callerInfoLookupHelper, CallInfoFactory callInfoFactory, UserHandle userHandle)93     void reloadFromDatabase(CallerInfoLookupHelper callerInfoLookupHelper,
94             CallInfoFactory callInfoFactory, UserHandle userHandle);
95 
setCurrentUserHandle(UserHandle userHandle)96     void setCurrentUserHandle(UserHandle userHandle);
97 }
98