From c165ca166dd592ce3e46a027a42bec223d74e6e1 Mon Sep 17 00:00:00 2001 From: Android Dialer Date: Thu, 17 May 2018 20:37:31 -0700 Subject: Show spam blocking promo notification in place of after call notification instead of canceling it and recreating a new notification. Test: ManuallyTested PiperOrigin-RevId: 197093375 Change-Id: I5214acd160d10a191d66c95798b2a44cdd3a9c7e --- java/com/android/incallui/spam/SpamNotificationService.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'java') diff --git a/java/com/android/incallui/spam/SpamNotificationService.java b/java/com/android/incallui/spam/SpamNotificationService.java index 82a943da7..f7deae1a8 100644 --- a/java/com/android/incallui/spam/SpamNotificationService.java +++ b/java/com/android/incallui/spam/SpamNotificationService.java @@ -103,11 +103,18 @@ public class SpamNotificationService extends Service { ContactLookupResult.Type contactLookupResultType = ContactLookupResult.Type.forNumber(intent.getIntExtra(EXTRA_CONTACT_LOOKUP_RESULT_TYPE, 0)); - DialerNotificationManager.cancel(this, notificationTag, notificationId); - SpamSettings spamSettings = SpamComponent.get(this).spamSettings(); SpamBlockingPromoHelper spamBlockingPromoHelper = new SpamBlockingPromoHelper(this, SpamComponent.get(this).spamSettings()); + boolean shouldShowSpamBlockingPromo = + SpamNotificationActivity.ACTION_MARK_NUMBER_AS_SPAM.equals(intent.getAction()) + && spamBlockingPromoHelper.shouldShowAfterCallSpamBlockingPromo(); + + // Cancel notification only if we are not showing spam blocking promo. Otherwise we will show + // spam blocking promo notification in place. + if (!shouldShowSpamBlockingPromo) { + DialerNotificationManager.cancel(this, notificationTag, notificationId); + } switch (intent.getAction()) { case SpamNotificationActivity.ACTION_MARK_NUMBER_AS_SPAM: @@ -122,7 +129,7 @@ public class SpamNotificationService extends Service { ReportingLocation.Type.FEEDBACK_PROMPT, contactLookupResultType); new FilteredNumberAsyncQueryHandler(this).blockNumber(null, number, countryIso); - if (spamBlockingPromoHelper.shouldShowAfterCallSpamBlockingPromo()) { + if (shouldShowSpamBlockingPromo) { spamBlockingPromoHelper.showSpamBlockingPromoNotification( notificationTag, notificationId, -- cgit v1.2.3