• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.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;
27 import android.os.Bundle;
28 
29 import com.android.settings.support.SupportPhone;
30 
31 import java.lang.annotation.Retention;
32 import java.lang.annotation.RetentionPolicy;
33 import java.util.List;
34 
35 /**
36  * Feature provider for support tab.
37  */
38 public interface SupportFeatureProvider {
39 
40     @IntDef({SupportType.EMAIL, SupportType.PHONE, SupportType.CHAT})
41     @Retention(RetentionPolicy.SOURCE)
42     @interface SupportType {
43         int EMAIL = 1;
44         int PHONE = 2;
45         int CHAT = 3;
46     }
47 
48     /**
49      * Returns a intent that will open help & feedback.
50      */
getHelpIntent(Context context)51     Intent getHelpIntent(Context context);
52 
53     /**
54      * Whether or not a support type is enabled.
55      */
isSupportTypeEnabled(Context context, @SupportType int type)56     boolean isSupportTypeEnabled(Context context, @SupportType int type);
57 
58     /**
59      * Refreshes all operation rules.
60      */
refreshOperationRules()61     void refreshOperationRules();
62 
63     /**
64      * Whether or not a support type is in operation 24/7. If country is null, use
65      * current country.
66      */
isAlwaysOperating(@upportType int type, String countryCode)67     boolean isAlwaysOperating(@SupportType int type, String countryCode);
68 
69     /**
70      * Whether or not a support type is operating now.
71      */
isOperatingNow(@upportType int type)72     boolean isOperatingNow(@SupportType int type);
73 
74     /**
75      * Returns the current country code if it has a operation config, otherwise returns null.
76      */
getCurrentCountryCodeIfHasConfig(@upportType int type)77     String getCurrentCountryCodeIfHasConfig(@SupportType int type);
78 
79     /**
80      * Returns localized string for operation hours in specified country. If country is null, use
81      * current country to figure out operation hours.
82      */
getOperationHours(Context context, @SupportType int type, String countryCode, boolean hasInternet)83     CharSequence getOperationHours(Context context, @SupportType int type, String countryCode,
84             boolean hasInternet);
85 
86     /**
87      * Returns a localized string indicating estimated wait time for a support time.
88      */
getEstimatedWaitTime(Context context, @SupportType int type)89     String getEstimatedWaitTime(Context context, @SupportType int type);
90 
91     /**
92      * Returns a list of country codes that have phone support.
93      */
getPhoneSupportCountryCodes()94     List<String> getPhoneSupportCountryCodes();
95 
96     /**
97      * Returns a list of countries that have phone support.
98      */
getPhoneSupportCountries()99     List<String> getPhoneSupportCountries();
100 
101     /**
102      * Returns a support phone for specified country.
103      */
getSupportPhones(String countryCode, boolean isTollfree)104     SupportPhone getSupportPhones(String countryCode, boolean isTollfree);
105 
106     /**
107      * Whether or not a disclaimer dialog should be displayed.
108      */
shouldShowDisclaimerDialog(Context context)109     boolean shouldShowDisclaimerDialog(Context context);
110 
111     /**
112      * Sets whether or not a disclaimer dialog should be displayed.
113      */
setShouldShowDisclaimerDialog(Context context, boolean shouldShow)114     void setShouldShowDisclaimerDialog(Context context, boolean shouldShow);
115 
116     /**
117      * Returns array of {@link Account} that's eligible for support options.
118      */
119     @NonNull
getSupportEligibleAccounts(Context context)120     Account[] getSupportEligibleAccounts(Context context);
121 
122     /**
123      * Starts support activity of specified type
124      *
125      * @param activity Calling activity
126      * @param account  A account that selected by user
127      * @param type     The type of support account needs.
128      */
startSupport(Activity activity, Account account, @SupportType int type)129     void startSupport(Activity activity, Account account, @SupportType int type);
130 
131     /**
132      * Starts support v2, invokes the support home page. Will no-op if support v2 is not enabled.
133      *
134      * @param activity Calling activity.
135      */
startSupportV2(Activity activity)136     void startSupportV2(Activity activity);
137 
138     /**
139      * Checks if support v2 is enabled for this device.
140      *
141      * @return a boolean indicating if support v2 is enabled.
142      */
isSupportV2Enabled()143     boolean isSupportV2Enabled();
144 
145     /**
146      * Returns an {@link Intent} that opens help and allow user get help on sign in.
147      */
getSignInHelpIntent(Context context)148     Intent getSignInHelpIntent(Context context);
149 
150     /**
151      * Returns an intent that will start the add account UI.
152      */
getAccountLoginIntent()153     Intent getAccountLoginIntent();
154 
155     /**
156      * Returns an intent that will launch the tips and tricks UI.
157      */
getTipsAndTricksIntent(Context context)158     Intent getTipsAndTricksIntent(Context context);
159 
160     /**
161      * Returns the string for the disclaimer in the Support dialog.
162      */
163     @StringRes
getDisclaimerStringResId()164     int getDisclaimerStringResId();
165 
166     /**
167      * launches the fragment that displays the system information being sent to support agents.
168      */
launchSystemInfoFragment(Bundle args, FragmentManager manager)169     void launchSystemInfoFragment(Bundle args, FragmentManager manager);
170 
171     /**
172      * Returns a url with information to introduce user to new device.
173      */
getNewDeviceIntroUrl(Context context)174     String getNewDeviceIntroUrl(Context context);
175 }
176