Clean up: remove unused SuggestionFeature api.
Test: robotests Change-Id: I91d06d93834674ca6019a86f8b3891198d424d7a
This commit is contained in:
@@ -23,11 +23,8 @@ import android.service.settings.suggestions.Suggestion;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.android.settingslib.drawer.Tile;
|
|
||||||
import com.android.settingslib.suggestions.SuggestionControllerMixinCompat;
|
import com.android.settingslib.suggestions.SuggestionControllerMixinCompat;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/** Interface should be implemented if you have added new suggestions */
|
/** Interface should be implemented if you have added new suggestions */
|
||||||
public interface SuggestionFeatureProvider {
|
public interface SuggestionFeatureProvider {
|
||||||
|
|
||||||
@@ -49,11 +46,6 @@ public interface SuggestionFeatureProvider {
|
|||||||
*/
|
*/
|
||||||
SharedPreferences getSharedPrefs(Context context);
|
SharedPreferences getSharedPrefs(Context context);
|
||||||
|
|
||||||
/**
|
|
||||||
* Only keep top few suggestions from exclusive suggestions.
|
|
||||||
*/
|
|
||||||
void filterExclusiveSuggestions(List<Tile> suggestions);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dismisses a suggestion.
|
* Dismisses a suggestion.
|
||||||
*/
|
*/
|
||||||
|
@@ -45,7 +45,6 @@ import java.util.List;
|
|||||||
public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider {
|
public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider {
|
||||||
|
|
||||||
private static final String TAG = "SuggestionFeature";
|
private static final String TAG = "SuggestionFeature";
|
||||||
private static final int EXCLUSIVE_SUGGESTION_MAX_COUNT = 3;
|
|
||||||
|
|
||||||
private static final String SHARED_PREF_FILENAME = "suggestions";
|
private static final String SHARED_PREF_FILENAME = "suggestions";
|
||||||
|
|
||||||
@@ -97,17 +96,6 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider
|
|||||||
.getMetricsFeatureProvider();
|
.getMetricsFeatureProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void filterExclusiveSuggestions(List<Tile> suggestions) {
|
|
||||||
if (suggestions == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int i = suggestions.size() - 1; i >= EXCLUSIVE_SUGGESTION_MAX_COUNT; i--) {
|
|
||||||
Log.d(TAG, "Removing exclusive suggestion");
|
|
||||||
suggestions.remove(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dismissSuggestion(Context context, SuggestionControllerMixinCompat mixin,
|
public void dismissSuggestion(Context context, SuggestionControllerMixinCompat mixin,
|
||||||
Suggestion suggestion) {
|
Suggestion suggestion) {
|
||||||
|
@@ -143,20 +143,4 @@ public class SuggestionFeatureProviderImplTest {
|
|||||||
anyString());
|
anyString());
|
||||||
verify(mSuggestionControllerMixin).dismissSuggestion(mSuggestion);
|
verify(mSuggestionControllerMixin).dismissSuggestion(mSuggestion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void filterExclusiveSuggestions_shouldOnlyKeepFirst3() {
|
|
||||||
final List<Tile> suggestions = new ArrayList<>();
|
|
||||||
suggestions.add(new Tile(mActivityInfo, CategoryKey.CATEGORY_APPS));
|
|
||||||
suggestions.add(new Tile(mActivityInfo, CategoryKey.CATEGORY_APPS));
|
|
||||||
suggestions.add(new Tile(mActivityInfo, CategoryKey.CATEGORY_APPS));
|
|
||||||
suggestions.add(new Tile(mActivityInfo, CategoryKey.CATEGORY_APPS));
|
|
||||||
suggestions.add(new Tile(mActivityInfo, CategoryKey.CATEGORY_APPS));
|
|
||||||
suggestions.add(new Tile(mActivityInfo, CategoryKey.CATEGORY_APPS));
|
|
||||||
suggestions.add(new Tile(mActivityInfo, CategoryKey.CATEGORY_APPS));
|
|
||||||
|
|
||||||
mProvider.filterExclusiveSuggestions(suggestions);
|
|
||||||
|
|
||||||
assertThat(suggestions).hasSize(3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user