Home | History | Annotate | Download | only in suggestions
      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.settings.dashboard.suggestions;
     18 
     19 import android.content.ComponentName;
     20 import android.content.Context;
     21 import android.content.SharedPreferences;
     22 import android.service.settings.suggestions.Suggestion;
     23 import android.support.annotation.NonNull;
     24 import android.util.Pair;
     25 
     26 import com.android.settingslib.drawer.Tile;
     27 import com.android.settingslib.suggestions.SuggestionControllerMixin;
     28 
     29 import java.util.List;
     30 
     31 /** Interface should be implemented if you have added new suggestions */
     32 public interface SuggestionFeatureProvider {
     33 
     34     /**
     35      * Whether or not the whole suggestion feature is enabled.
     36      */
     37     boolean isSuggestionEnabled(Context context);
     38 
     39     /**
     40      * Returns the component name for SuggestionService.
     41      */
     42     ComponentName getSuggestionServiceComponent();
     43 
     44     /**
     45      * Returns true if smart suggestion should be used instead of xml based SuggestionParser.
     46      */
     47     boolean isSmartSuggestionEnabled(Context context);
     48 
     49     /** Return true if the suggestion has already been completed and does not need to be shown */
     50     boolean isSuggestionComplete(Context context, @NonNull ComponentName suggestion);
     51 
     52     /**
     53      * Returns the {@link SharedPreferences} that holds metadata for suggestions.
     54      */
     55     SharedPreferences getSharedPrefs(Context context);
     56 
     57     /**
     58      * Only keep top few suggestions from exclusive suggestions.
     59      */
     60     void filterExclusiveSuggestions(List<Tile> suggestions);
     61 
     62     /**
     63      * Dismisses a suggestion.
     64      */
     65     void dismissSuggestion(Context context, SuggestionControllerMixin suggestionMixin,
     66             Suggestion suggestion);
     67 
     68     /**
     69      * Returns common tagged data for suggestion logging.
     70      */
     71     Pair<Integer, Object>[] getLoggingTaggedData(Context context);
     72 }
     73