Load suggestions through SettingsIntelligence.

- Add flag to switch between old/new implementation
- Add SuggestionLoader to load using Loader (instead of AsyncTask)
- Update DashboardAdapater/SuggestionAdapter to take List<Suggestion>
- Marked old getter/setters as @Deprecated and added comment
- Update tests to cover suggestionV2 adapter changes.

TODO:
- Handler for dismissing suggestion not set up yet.
- Suggestion data structure is incomplete (missing icon, remote view, etc)
- Need to extend Suggestion data strcture to support icon and
  remote view binding

Bug: 65065268
Test: robotests
Change-Id: I2378ef4c9edee972d5de93c3868068e2cde23f56
This commit is contained in:
Fan Zhang
2017-08-17 16:13:20 -07:00
parent c0f1c8f216
commit 82cb5a5cc8
14 changed files with 747 additions and 122 deletions

View File

@@ -19,6 +19,7 @@ package com.android.settings.dashboard.suggestions;
import android.content.ComponentName;
import android.content.Context;
import android.content.SharedPreferences;
import android.service.settings.suggestions.Suggestion;
import android.support.annotation.NonNull;
import com.android.settingslib.drawer.Tile;
@@ -31,9 +32,16 @@ public interface SuggestionFeatureProvider {
/**
* Whether or not the whole suggestion feature is enabled.
* @deprecated in favor of {@link #isSuggestionV2Enabled(Context)}
*/
@Deprecated
boolean isSuggestionEnabled(Context context);
/**
* Whether or not the suggestion v2 feature is enabled.
*/
boolean isSuggestionV2Enabled(Context context);
/**
* Returns true if smart suggestion should be used instead of xml based SuggestionParser.
*/
@@ -52,7 +60,9 @@ public interface SuggestionFeatureProvider {
*
* @param suggestions List of suggestion Tiles
* @param suggestionIds List of suggestion ids corresponding to the suggestion tiles.
* @deprecated in favor of SettingsIntelligence
*/
@Deprecated
void rankSuggestions(final List<Tile> suggestions, List<String> suggestionIds);
/**
@@ -62,9 +72,17 @@ public interface SuggestionFeatureProvider {
/**
* Dismisses a suggestion.
*
* @deprecated in favor of {@link #dismissSuggestion(Context, Suggestion)}
*/
@Deprecated
void dismissSuggestion(Context context, SuggestionParser parser, Tile suggestion);
/**
* Dismisses a suggestion.
*/
void dismissSuggestion(Context context, Suggestion suggestion);
/**
* Returns an identifier for the suggestion
*/