Santos Cordon | a0e5f1a | 2014-03-31 21:43:00 -0700 | [diff] [blame] | 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 | |
Tyler Gunn | 7cc70b4 | 2014-09-12 22:17:27 -0700 | [diff] [blame] | 17 | package com.android.server.telecom; |
Santos Cordon | a0e5f1a | 2014-03-31 21:43:00 -0700 | [diff] [blame] | 18 | |
Hall Liu | 3037ac6 | 2016-09-22 14:40:03 -0700 | [diff] [blame] | 19 | import android.net.Uri; |
Tony Mak | a993094 | 2016-01-15 10:57:14 +0000 | [diff] [blame] | 20 | import android.os.UserHandle; |
Hall Liu | 3037ac6 | 2016-09-22 14:40:03 -0700 | [diff] [blame] | 21 | import android.telecom.PhoneAccountHandle; |
| 22 | |
| 23 | import com.android.internal.telephony.CallerInfo; |
Tony Mak | a993094 | 2016-01-15 10:57:14 +0000 | [diff] [blame] | 24 | |
Santos Cordon | a0e5f1a | 2014-03-31 21:43:00 -0700 | [diff] [blame] | 25 | /** |
| 26 | * Creates a notification for calls that the user missed (neither answered nor rejected). |
Santos Cordon | a0e5f1a | 2014-03-31 21:43:00 -0700 | [diff] [blame] | 27 | */ |
Ihab Awad | 8de7691 | 2015-02-17 12:25:52 -0800 | [diff] [blame] | 28 | public interface MissedCallNotifier extends CallsManager.CallsManagerListener { |
Hall Liu | 3037ac6 | 2016-09-22 14:40:03 -0700 | [diff] [blame] | 29 | 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 Cordon | a0e5f1a | 2014-03-31 21:43:00 -0700 | [diff] [blame] | 85 | |
Tony Mak | a993094 | 2016-01-15 10:57:14 +0000 | [diff] [blame] | 86 | void clearMissedCalls(UserHandle userHandle); |
Yorke Lee | 0c1e4f6 | 2014-10-14 16:56:45 -0700 | [diff] [blame] | 87 | |
Hall Liu | 3037ac6 | 2016-09-22 14:40:03 -0700 | [diff] [blame] | 88 | void showMissedCallNotification(CallInfo call); |
Ihab Awad | 8d5d9dd | 2015-03-12 11:11:06 -0700 | [diff] [blame] | 89 | |
Hall Liu | 3037ac6 | 2016-09-22 14:40:03 -0700 | [diff] [blame] | 90 | void reloadAfterBootComplete(CallerInfoLookupHelper callerInfoLookupHelper, |
| 91 | CallInfoFactory callInfoFactory); |
| 92 | |
| 93 | void reloadFromDatabase(CallerInfoLookupHelper callerInfoLookupHelper, |
| 94 | CallInfoFactory callInfoFactory, UserHandle userHandle); |
Tony Mak | a993094 | 2016-01-15 10:57:14 +0000 | [diff] [blame] | 95 | |
| 96 | void setCurrentUserHandle(UserHandle userHandle); |
Santos Cordon | a0e5f1a | 2014-03-31 21:43:00 -0700 | [diff] [blame] | 97 | } |