Eric Erfanian | d5e47f6 | 2017-03-15 14:41:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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.voicemail; |
| 18 | |
| 19 | import android.content.Context; |
Eric Erfanian | d8046e5 | 2017-04-06 09:41:50 -0700 | [diff] [blame^] | 20 | import android.content.Intent; |
Eric Erfanian | d5e47f6 | 2017-03-15 14:41:07 -0700 | [diff] [blame] | 21 | import android.provider.VoicemailContract.Voicemails; |
| 22 | import android.support.annotation.Nullable; |
| 23 | import android.telecom.PhoneAccountHandle; |
| 24 | import android.telephony.TelephonyManager; |
| 25 | import java.util.List; |
| 26 | |
| 27 | /** Public interface for the voicemail module */ |
| 28 | public interface VoicemailClient { |
| 29 | |
| 30 | /** |
Eric Erfanian | 9050823 | 2017-03-24 09:31:16 -0700 | [diff] [blame] | 31 | * Whether the voicemail module is enabled (OS has support and not disabled by flags, etc.). This |
| 32 | * does not mean the carrier has support or user has enabled the feature. |
| 33 | */ |
| 34 | boolean isVoicemailModuleEnabled(); |
| 35 | |
| 36 | /** |
Eric Erfanian | d5e47f6 | 2017-03-15 14:41:07 -0700 | [diff] [blame] | 37 | * Broadcast to tell the client to upload local database changes to the server. Since the dialer |
| 38 | * UI and the client are in the same package, the {@link |
| 39 | * android.content.Intent#ACTION_PROVIDER_CHANGED} will always be a self-change even if the UI is |
| 40 | * external to the client. |
| 41 | */ |
| 42 | String ACTION_UPLOAD = "com.android.voicemailomtp.VoicemailClient.ACTION_UPLOAD"; |
| 43 | |
Eric Erfanian | d8046e5 | 2017-04-06 09:41:50 -0700 | [diff] [blame^] | 44 | /** Common key for passing {@link PhoneAccountHandle} in bundles. */ |
| 45 | String PARAM_PHONE_ACCOUNT_HANDLE = "phone_account_handle"; |
| 46 | |
Eric Erfanian | d5e47f6 | 2017-03-15 14:41:07 -0700 | [diff] [blame] | 47 | /** |
| 48 | * Appends the selection to ignore voicemails from non-active OMTP voicemail package. In OC there |
| 49 | * can be multiple packages handling OMTP voicemails which represents the same source of truth. |
| 50 | * These packages should mark their voicemails as {@link Voicemails#IS_OMTP_VOICEMAIL} and only |
| 51 | * the voicemails from {@link TelephonyManager#getVisualVoicemailPackageName()} should be shown. |
| 52 | * For example, the user synced voicemails with DialerA, and then switched to DialerB, voicemails |
| 53 | * from DialerA should be ignored as they are no longer current. Voicemails from {@link |
| 54 | * #OMTP_VOICEMAIL_BLACKLIST} will also be ignored as they are voicemail source only valid pre-OC. |
| 55 | */ |
| 56 | void appendOmtpVoicemailSelectionClause( |
| 57 | Context context, StringBuilder where, List<String> selectionArgs); |
Eric Erfanian | fc37b02 | 2017-03-21 10:11:17 -0700 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * Appends the selection to ignore voicemail status from non-active OMTP voicemail package. The |
| 61 | * {@link android.provider.VoicemailContract.Status#SOURCE_TYPE} is checked against a list of |
| 62 | * known OMTP types. Voicemails from {@link #OMTP_VOICEMAIL_BLACKLIST} will also be ignored as |
| 63 | * they are voicemail source only valid pre-OC. |
| 64 | * |
| 65 | * @see #appendOmtpVoicemailSelectionClause(Context, StringBuilder, List) |
| 66 | */ |
| 67 | void appendOmtpVoicemailStatusSelectionClause( |
| 68 | Context context, StringBuilder where, List<String> selectionArgs); |
| 69 | |
Eric Erfanian | d5e47f6 | 2017-03-15 14:41:07 -0700 | [diff] [blame] | 70 | /** |
| 71 | * @return the class name of the {@link android.preference.PreferenceFragment} for voicemail |
| 72 | * settings, or {@code null} if dialer cannot control voicemail settings. Always return {@code |
| 73 | * null} before OC. |
| 74 | */ |
| 75 | @Nullable |
| 76 | String getSettingsFragment(); |
| 77 | |
| 78 | boolean isVoicemailArchiveEnabled(Context context, PhoneAccountHandle phoneAccountHandle); |
| 79 | |
Eric Erfanian | d8046e5 | 2017-04-06 09:41:50 -0700 | [diff] [blame^] | 80 | /** |
| 81 | * @return if the voicemail archive feature is available on the current device. This depends on |
| 82 | * whether the server side flag is turned on for the feature, and if the OS meets the |
| 83 | * requirement for this feature. |
| 84 | */ |
| 85 | boolean isVoicemailArchiveAvailable(Context context); |
| 86 | |
Eric Erfanian | d5e47f6 | 2017-03-15 14:41:07 -0700 | [diff] [blame] | 87 | void setVoicemailArchiveEnabled( |
| 88 | Context context, PhoneAccountHandle phoneAccountHandle, boolean value); |
Eric Erfanian | d8046e5 | 2017-04-06 09:41:50 -0700 | [diff] [blame^] | 89 | |
| 90 | /** |
| 91 | * @return an intent that will launch the activity to change the voicemail PIN. The PIN is used |
| 92 | * when calling into the mailbox. |
| 93 | */ |
| 94 | Intent getSetPinIntent(Context context, PhoneAccountHandle phoneAccountHandle); |
Eric Erfanian | d5e47f6 | 2017-03-15 14:41:07 -0700 | [diff] [blame] | 95 | } |