1 /* 2 * Copyright (C) 2016 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.settings.overlay; 18 19 import android.accounts.Account; 20 import android.annotation.IntDef; 21 import android.app.Activity; 22 import android.content.Context; 23 import android.content.Intent; 24 25 import com.android.settings.support.SupportPhone; 26 27 import java.lang.annotation.Retention; 28 import java.lang.annotation.RetentionPolicy; 29 import java.util.List; 30 31 /** 32 * Feature provider for support tab. 33 */ 34 public interface SupportFeatureProvider { 35 36 @IntDef({SupportType.EMAIL, SupportType.PHONE, SupportType.CHAT}) 37 @Retention(RetentionPolicy.SOURCE) 38 @interface SupportType { 39 int EMAIL = 1; 40 int PHONE = 2; 41 int CHAT = 3; 42 } 43 44 /** 45 * Returns a intent that will open help & feedback. 46 */ getHelpIntent(Context context)47 Intent getHelpIntent(Context context); 48 49 /** 50 * Whether or not a support type is enabled. 51 */ isSupportTypeEnabled(Context context, @SupportType int type)52 boolean isSupportTypeEnabled(Context context, @SupportType int type); 53 54 /** 55 * Refreshes all operation rules. 56 */ refreshOperationRules()57 void refreshOperationRules(); 58 59 /** 60 * Whether or not a support type is in operation 24/7. If country is null, use 61 * current country. 62 */ isAlwaysOperating(@upportType int type, String countryCode)63 boolean isAlwaysOperating(@SupportType int type, String countryCode); 64 65 /** 66 * Whether or not a support type is operating now. 67 */ isOperatingNow(@upportType int type)68 boolean isOperatingNow(@SupportType int type); 69 70 /** 71 * Returns the current country code if it has a operation config, otherwise returns null. 72 */ getCurrentCountryCodeIfHasConfig(@upportType int type)73 String getCurrentCountryCodeIfHasConfig(@SupportType int type); 74 75 /** 76 * Returns localized string for operation hours in specified country. If country is null, use 77 * current country to figure out operation hours. 78 */ getOperationHours(Context context, @SupportType int type, String countryCode, boolean hasInternet)79 CharSequence getOperationHours(Context context, @SupportType int type, String countryCode, 80 boolean hasInternet); 81 82 /** 83 * Returns a localized string indicating estimated wait time for a support time. 84 */ getEstimatedWaitTime(Context context, @SupportType int type)85 String getEstimatedWaitTime(Context context, @SupportType int type); 86 87 /** 88 * Returns a list of country codes that have phone support. 89 */ getPhoneSupportCountryCodes()90 List<String> getPhoneSupportCountryCodes(); 91 92 /** 93 * Returns a list of countries that have phone support. 94 */ getPhoneSupportCountries()95 List<String> getPhoneSupportCountries(); 96 97 /** 98 * Returns a support phone for specified country. 99 */ getSupportPhones(String countryCode, boolean isTollfree)100 SupportPhone getSupportPhones(String countryCode, boolean isTollfree); 101 102 /** 103 * Whether or not a disclaimer dialog should be displayed. 104 */ shouldShowDisclaimerDialog(Context context)105 boolean shouldShowDisclaimerDialog(Context context); 106 107 /** 108 * Sets whether or not a disclaimer dialog should be displayed. 109 */ setShouldShowDisclaimerDialog(Context context, boolean shouldShow)110 void setShouldShowDisclaimerDialog(Context context, boolean shouldShow); 111 112 /** 113 * Returns an {@link Account} that's eligible for support options. 114 */ getSupportEligibleAccount(Context context)115 Account getSupportEligibleAccount(Context context); 116 117 /** 118 * Starts support activity of specified type 119 * 120 * @param activity Calling activity 121 * @param account A account returned by {@link #getSupportEligibleAccount} 122 * @param type The type of support account needs. 123 */ startSupport(Activity activity, Account account, @SupportType int type)124 void startSupport(Activity activity, Account account, @SupportType int type); 125 126 /** 127 * Returns an {@link Intent} that opens help and allow user get help on sign in. 128 */ getSignInHelpIntent(Context context)129 Intent getSignInHelpIntent(Context context); 130 131 /** 132 * Returns an intent that will start the add account UI. 133 */ getAccountLoginIntent()134 Intent getAccountLoginIntent(); 135 136 /** 137 * Returns an intent that will launch the tips and tricks UI. 138 */ getTipsAndTricksIntent(Context context)139 Intent getTipsAndTricksIntent(Context context); 140 } 141