blob: 500122b2aa66a6f46b12a2ca3e5c4662379e40b0 [file] [log] [blame]
Santos Cordona0e5f1a2014-03-31 21:43:00 -07001/*
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
Tyler Gunn7cc70b42014-09-12 22:17:27 -070017package com.android.server.telecom;
Santos Cordona0e5f1a2014-03-31 21:43:00 -070018
Hall Liu3037ac62016-09-22 14:40:03 -070019import android.net.Uri;
Tony Maka9930942016-01-15 10:57:14 +000020import android.os.UserHandle;
Hall Liu3037ac62016-09-22 14:40:03 -070021import android.telecom.PhoneAccountHandle;
22
23import com.android.internal.telephony.CallerInfo;
Tony Maka9930942016-01-15 10:57:14 +000024
Santos Cordona0e5f1a2014-03-31 21:43:00 -070025/**
26 * Creates a notification for calls that the user missed (neither answered nor rejected).
Santos Cordona0e5f1a2014-03-31 21:43:00 -070027 */
Ihab Awad8de76912015-02-17 12:25:52 -080028public interface MissedCallNotifier extends CallsManager.CallsManagerListener {
Hall Liu3037ac62016-09-22 14:40:03 -070029 class CallInfoFactory {
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
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
50 public CallInfo(Call call) {
51 mCallerInfo = call.getCallerInfo();
52 mPhoneAccountHandle = call.getTargetPhoneAccount();
53 mHandle = call.getHandle();
54 mCreationTimeMillis = call.getCreationTimeMillis();
55 }
56
57 public CallerInfo getCallerInfo() {
58 return mCallerInfo;
59 }
60
61 public PhoneAccountHandle getPhoneAccountHandle() {
62 return mPhoneAccountHandle;
63 }
64
65 public Uri getHandle() {
66 return mHandle;
67 }
68
69 public String getHandleSchemeSpecificPart() {
70 return mHandle == null ? null : mHandle.getSchemeSpecificPart();
71 }
72
73 public long getCreationTimeMillis() {
74 return mCreationTimeMillis;
75 }
76
77 public String getPhoneNumber() {
78 return mCallerInfo == null ? null : mCallerInfo.phoneNumber;
79 }
80
81 public String getName() {
82 return mCallerInfo == null ? null : mCallerInfo.name;
83 }
84 }
Santos Cordona0e5f1a2014-03-31 21:43:00 -070085
Tony Maka9930942016-01-15 10:57:14 +000086 void clearMissedCalls(UserHandle userHandle);
Yorke Lee0c1e4f62014-10-14 16:56:45 -070087
Hall Liu3037ac62016-09-22 14:40:03 -070088 void showMissedCallNotification(CallInfo call);
Ihab Awad8d5d9dd2015-03-12 11:11:06 -070089
Hall Liu3037ac62016-09-22 14:40:03 -070090 void reloadAfterBootComplete(CallerInfoLookupHelper callerInfoLookupHelper,
91 CallInfoFactory callInfoFactory);
92
93 void reloadFromDatabase(CallerInfoLookupHelper callerInfoLookupHelper,
94 CallInfoFactory callInfoFactory, UserHandle userHandle);
Tony Maka9930942016-01-15 10:57:14 +000095
96 void setCurrentUserHandle(UserHandle userHandle);
Santos Cordona0e5f1a2014-03-31 21:43:00 -070097}