From 3b995bac4550982c62f805d7c334fbc7ed34b113 Mon Sep 17 00:00:00 2001 From: Android Dialer Date: Tue, 10 Apr 2018 15:22:02 -0700 Subject: Add a flag to control whether to show spam blocking promotion Test: SpamBlockingPromoHelperTest PiperOrigin-RevId: 192355809 Change-Id: Id9fc792b6e4649af4df588a523299a8fcf7727f0 --- java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java b/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java index cba94e00d..56143ce7f 100644 --- a/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java +++ b/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java @@ -32,6 +32,7 @@ public class SpamBlockingPromoHelper { static final String SPAM_BLOCKING_PROMO_PERIOD_MILLIS = "spam_blocking_promo_period_millis"; static final String SPAM_BLOCKING_PROMO_LAST_SHOW_MILLIS = "spam_blocking_promo_last_show_millis"; + static final String ENABLE_SPAM_BLOCKING_PROMO = "enable_spam_blocking_promo"; private final Context context; private final SpamSettings spamSettings; @@ -64,14 +65,15 @@ public class SpamBlockingPromoHelper { * Returns true if we should show a spam blocking promo. * *

Should show spam blocking promo only when all of the following criteria meet 1. Spam - * blocking setting is available. 2. Spam blocking setting is not yet enabled. 3. Time since last - * spam blocking promo exceeds the threshold. + * blocking promo is enabled by flag. 2. Spam blocking setting is available. 3. Spam blocking + * setting is not yet enabled. 4. Time since last spam blocking promo exceeds the threshold. * * @return true if we should show a spam blocking promo. */ @VisibleForTesting boolean shouldShowSpamBlockingPromo() { - if (!spamSettings.isSpamEnabled() + if (!ConfigProviderBindings.get(context).getBoolean(ENABLE_SPAM_BLOCKING_PROMO, false) + || !spamSettings.isSpamEnabled() || !spamSettings.isSpamBlockingEnabledByFlag() || spamSettings.isSpamBlockingEnabledByUser()) { return false; -- cgit v1.2.3