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