Clean up logic for dismissing suggestion
We no longer bring suggestions back after dismissing, so some logic is no longer necessary. Change-Id: I9d931fbbbc79bade191bebf6d057870d088a5fde Fixes: 64297191 Test: robotests
This commit is contained in:
@@ -25,7 +25,6 @@ import android.content.pm.PackageManager;
|
||||
import android.provider.Settings.Secure;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
@@ -55,12 +54,6 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider
|
||||
|
||||
private static final String SHARED_PREF_FILENAME = "suggestions";
|
||||
|
||||
// Suggestion category name and expiration threshold for first impression type. Needs to keep
|
||||
// in sync with suggestion_ordering.xml
|
||||
private static final String CATEGORY_FIRST_IMPRESSION =
|
||||
"com.android.settings.suggested.category.FIRST_IMPRESSION";
|
||||
private static final long FIRST_IMPRESSION_EXPIRE_DAY_IN_MILLIS = 14 * DateUtils.DAY_IN_MILLIS;
|
||||
|
||||
private final SuggestionRanker mSuggestionRanker;
|
||||
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
|
||||
@@ -141,12 +134,7 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider
|
||||
context, MetricsProto.MetricsEvent.ACTION_SETTINGS_DISMISS_SUGGESTION,
|
||||
getSuggestionIdentifier(context, suggestion));
|
||||
|
||||
boolean isSmartSuggestionEnabled = isSmartSuggestionEnabled(context);
|
||||
if (isSmartSuggestionEnabled) {
|
||||
// Disable smart suggestion if we are still showing first impression suggestions.
|
||||
isSmartSuggestionEnabled = !isShowingFirstImpressionSuggestion(context);
|
||||
}
|
||||
if (!parser.dismissSuggestion(suggestion, isSmartSuggestionEnabled)) {
|
||||
if (!parser.dismissSuggestion(suggestion)) {
|
||||
return;
|
||||
}
|
||||
context.getPackageManager().setComponentEnabledSetting(
|
||||
@@ -155,19 +143,6 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider
|
||||
PackageManager.DONT_KILL_APP);
|
||||
}
|
||||
|
||||
private boolean isShowingFirstImpressionSuggestion(Context context) {
|
||||
final String keySetupTime = CATEGORY_FIRST_IMPRESSION + SuggestionParser.SETUP_TIME;
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final SharedPreferences sharedPrefs = getSharedPrefs(context);
|
||||
if (!sharedPrefs.contains(keySetupTime)) {
|
||||
return true;
|
||||
}
|
||||
final long setupTime = sharedPrefs.getLong(keySetupTime, 0);
|
||||
final long elapsedTime = currentTime - setupTime;
|
||||
Log.d(TAG, "Day " + elapsedTime / DateUtils.DAY_IN_MILLIS + " for first impression");
|
||||
return elapsedTime <= FIRST_IMPRESSION_EXPIRE_DAY_IN_MILLIS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuggestionIdentifier(Context context, Tile suggestion) {
|
||||
if (suggestion.intent == null || suggestion.intent.getComponent() == null
|
||||
|
Reference in New Issue
Block a user