1a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon/*
2a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon * Copyright 2014, The Android Open Source Project
3a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon *
4a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon * Licensed under the Apache License, Version 2.0 (the "License");
5a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon * you may not use this file except in compliance with the License.
6a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon * You may obtain a copy of the License at
7a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon *
8a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon *     http://www.apache.org/licenses/LICENSE-2.0
9a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon *
10a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon * Unless required by applicable law or agreed to in writing, software
11a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon * distributed under the License is distributed on an "AS IS" BASIS,
12a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon * See the License for the specific language governing permissions and
14a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon * limitations under the License.
15a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon */
16a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon
177cc70b4f0ad1064a4a0dce6056ad82b205887160Tyler Gunnpackage com.android.server.telecom;
18a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon
193037ac6f171b6a3627494bb10042ab7adb34366aHall Liuimport android.net.Uri;
20a993094840386163e9c2aa65a05e14b49d122318Tony Makimport android.os.UserHandle;
213037ac6f171b6a3627494bb10042ab7adb34366aHall Liuimport android.telecom.PhoneAccountHandle;
223037ac6f171b6a3627494bb10042ab7adb34366aHall Liu
233037ac6f171b6a3627494bb10042ab7adb34366aHall Liuimport com.android.internal.telephony.CallerInfo;
24a993094840386163e9c2aa65a05e14b49d122318Tony Mak
25a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon/**
26a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon * Creates a notification for calls that the user missed (neither answered nor rejected).
27a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon */
288de76915ea2772faeb41705aaaeb65f5b3478ac4Ihab Awadpublic interface MissedCallNotifier extends CallsManager.CallsManagerListener {
293037ac6f171b6a3627494bb10042ab7adb34366aHall Liu    class CallInfoFactory {
303037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        public CallInfo makeCallInfo(CallerInfo callerInfo, PhoneAccountHandle phoneAccountHandle,
313037ac6f171b6a3627494bb10042ab7adb34366aHall Liu                Uri handle, long creationTimeMillis) {
323037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            return new CallInfo(callerInfo, phoneAccountHandle, handle, creationTimeMillis);
333037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        }
343037ac6f171b6a3627494bb10042ab7adb34366aHall Liu    }
353037ac6f171b6a3627494bb10042ab7adb34366aHall Liu
363037ac6f171b6a3627494bb10042ab7adb34366aHall Liu    class CallInfo {
373037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        private CallerInfo mCallerInfo;
383037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        private PhoneAccountHandle mPhoneAccountHandle;
393037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        private Uri mHandle;
403037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        private long mCreationTimeMillis;
413037ac6f171b6a3627494bb10042ab7adb34366aHall Liu
423037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        public CallInfo(CallerInfo callerInfo, PhoneAccountHandle phoneAccountHandle, Uri handle,
433037ac6f171b6a3627494bb10042ab7adb34366aHall Liu                long creationTimeMillis) {
443037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            mCallerInfo = callerInfo;
453037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            mPhoneAccountHandle = phoneAccountHandle;
463037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            mHandle = handle;
473037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            mCreationTimeMillis = creationTimeMillis;
483037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        }
493037ac6f171b6a3627494bb10042ab7adb34366aHall Liu
503037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        public CallInfo(Call call) {
513037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            mCallerInfo = call.getCallerInfo();
523037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            mPhoneAccountHandle = call.getTargetPhoneAccount();
533037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            mHandle = call.getHandle();
543037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            mCreationTimeMillis = call.getCreationTimeMillis();
553037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        }
563037ac6f171b6a3627494bb10042ab7adb34366aHall Liu
573037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        public CallerInfo getCallerInfo() {
583037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            return mCallerInfo;
593037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        }
603037ac6f171b6a3627494bb10042ab7adb34366aHall Liu
613037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        public PhoneAccountHandle getPhoneAccountHandle() {
623037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            return mPhoneAccountHandle;
633037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        }
643037ac6f171b6a3627494bb10042ab7adb34366aHall Liu
653037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        public Uri getHandle() {
663037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            return mHandle;
673037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        }
683037ac6f171b6a3627494bb10042ab7adb34366aHall Liu
693037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        public String getHandleSchemeSpecificPart() {
703037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            return mHandle == null ? null : mHandle.getSchemeSpecificPart();
713037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        }
723037ac6f171b6a3627494bb10042ab7adb34366aHall Liu
733037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        public long getCreationTimeMillis() {
743037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            return mCreationTimeMillis;
753037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        }
763037ac6f171b6a3627494bb10042ab7adb34366aHall Liu
773037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        public String getPhoneNumber() {
783037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            return mCallerInfo == null ? null : mCallerInfo.phoneNumber;
793037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        }
803037ac6f171b6a3627494bb10042ab7adb34366aHall Liu
813037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        public String getName() {
823037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            return mCallerInfo == null ? null : mCallerInfo.name;
833037ac6f171b6a3627494bb10042ab7adb34366aHall Liu        }
843037ac6f171b6a3627494bb10042ab7adb34366aHall Liu    }
85546710be97b3adb8274233208eb8f63debff3f50Yorke Lee
86a993094840386163e9c2aa65a05e14b49d122318Tony Mak    void clearMissedCalls(UserHandle userHandle);
8764c7e965de50c6321415942ab4a84d22514b39a1Santos Cordon
883037ac6f171b6a3627494bb10042ab7adb34366aHall Liu    void showMissedCallNotification(CallInfo call);
893037ac6f171b6a3627494bb10042ab7adb34366aHall Liu
903037ac6f171b6a3627494bb10042ab7adb34366aHall Liu    void reloadAfterBootComplete(CallerInfoLookupHelper callerInfoLookupHelper,
913037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            CallInfoFactory callInfoFactory);
928d5d9ddc66b55b6906364ab3c0e244dab4d58f13Ihab Awad
933037ac6f171b6a3627494bb10042ab7adb34366aHall Liu    void reloadFromDatabase(CallerInfoLookupHelper callerInfoLookupHelper,
943037ac6f171b6a3627494bb10042ab7adb34366aHall Liu            CallInfoFactory callInfoFactory, UserHandle userHandle);
95a993094840386163e9c2aa65a05e14b49d122318Tony Mak
96a993094840386163e9c2aa65a05e14b49d122318Tony Mak    void setCurrentUserHandle(UserHandle userHandle);
97a0e5f1aa917decf6921e372a3fd5a43da51adecbSantos Cordon}
98