Pass component name into SuggestionFeatureProvider

So that the provider can be used for more than one suggestion.

Test: Robolectric test for implementation of the provider
Bug: 62039057
Change-Id: Ibea41ea6d98e67c55ec157556675e854f3ea31c4
This commit is contained in:
Maurice Lam
2017-05-24 17:51:06 -07:00
parent ee991f4956
commit 7551c80bc8
3 changed files with 14 additions and 8 deletions

View File

@@ -21,6 +21,7 @@ import android.app.KeyguardManager;
import android.app.NotificationManager;
import android.app.WallpaperManager;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
import android.hardware.fingerprint.FingerprintManager;
import android.provider.Settings;
@@ -56,7 +57,8 @@ public class SuggestionsChecks {
}
public boolean isSuggestionComplete(Tile suggestion) {
String className = suggestion.intent.getComponent().getClassName();
ComponentName component = suggestion.intent.getComponent();
String className = component.getClassName();
if (className.equals(ZenModeAutomationSuggestionActivity.class.getName())) {
return hasEnabledZenAutoRules();
} else if (className.equals(WallpaperSuggestionActivity.class.getName())) {
@@ -79,8 +81,8 @@ public class SuggestionsChecks {
SuggestionFeatureProvider provider =
FeatureFactory.getFactory(mContext).getSuggestionFeatureProvider(mContext);
if (provider != null && provider.isPresent(className)) {
return provider.isSuggestionCompleted(mContext);
if (provider != null && provider.isPresent(component)) {
return provider.isSuggestionCompleted(mContext, component);
}
return false;