2 * Copyright (C) 2016 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.android.settings.overlay;
19 import android.accounts.Account;
20 import android.annotation.IntDef;
21 import android.annotation.NonNull;
22 import android.annotation.StringRes;
23 import android.app.Activity;
24 import android.app.FragmentManager;
25 import android.content.Context;
26 import android.content.Intent;
28 import android.os.Bundle;
29 import com.android.settings.support.SupportPhone;
31 import java.lang.annotation.Retention;
32 import java.lang.annotation.RetentionPolicy;
33 import java.util.List;
36 * Feature provider for support tab.
38 public interface SupportFeatureProvider {
40 @IntDef({SupportType.EMAIL, SupportType.PHONE, SupportType.CHAT})
41 @Retention(RetentionPolicy.SOURCE)
42 @interface SupportType {
49 * Returns a intent that will open help & feedback.
51 Intent getHelpIntent(Context context);
54 * Whether or not a support type is enabled.
56 boolean isSupportTypeEnabled(Context context, @SupportType int type);
59 * Refreshes all operation rules.
61 void refreshOperationRules();
64 * Whether or not a support type is in operation 24/7. If country is null, use
67 boolean isAlwaysOperating(@SupportType int type, String countryCode);
70 * Whether or not a support type is operating now.
72 boolean isOperatingNow(@SupportType int type);
75 * Returns the current country code if it has a operation config, otherwise returns null.
77 String getCurrentCountryCodeIfHasConfig(@SupportType int type);
80 * Returns localized string for operation hours in specified country. If country is null, use
81 * current country to figure out operation hours.
83 CharSequence getOperationHours(Context context, @SupportType int type, String countryCode,
87 * Returns a localized string indicating estimated wait time for a support time.
89 String getEstimatedWaitTime(Context context, @SupportType int type);
92 * Returns a list of country codes that have phone support.
94 List<String> getPhoneSupportCountryCodes();
97 * Returns a list of countries that have phone support.
99 List<String> getPhoneSupportCountries();
102 * Returns a support phone for specified country.
104 SupportPhone getSupportPhones(String countryCode, boolean isTollfree);
107 * Whether or not a disclaimer dialog should be displayed.
109 boolean shouldShowDisclaimerDialog(Context context);
112 * Sets whether or not a disclaimer dialog should be displayed.
114 void setShouldShowDisclaimerDialog(Context context, boolean shouldShow);
117 * Returns array of {@link Account} that's eligible for support options.
120 Account[] getSupportEligibleAccounts(Context context);
123 * Starts support activity of specified type
125 * @param activity Calling activity
126 * @param account A account that selected by user
127 * @param type The type of support account needs.
129 void startSupport(Activity activity, Account account, @SupportType int type);
132 * Starts support v2, invokes the support home page. Will no-op if support v2 is not enabled.
134 * @param activity Calling activity.
136 void startSupportV2(Activity activity);
139 * Checks if support v2 is enabled for this device.
140 * @return a boolean indicating if support v2 is enabled.
142 boolean isSupportV2Enabled();
145 * Returns an {@link Intent} that opens help and allow user get help on sign in.
147 Intent getSignInHelpIntent(Context context);
150 * Returns an intent that will start the add account UI.
152 Intent getAccountLoginIntent();
155 * Returns an intent that will launch the tips and tricks UI.
157 Intent getTipsAndTricksIntent(Context context);
160 * Returns the string for the disclaimer in the Support dialog.
163 int getDisclaimerStringResId();
166 * launches the fragment that displays the system information being sent to support agents.
168 void launchSystemInfoFragment(Bundle args, FragmentManager manager);