diff options
Diffstat (limited to 'java/com/android/incallui/spam')
3 files changed, 23 insertions, 16 deletions
diff --git a/java/com/android/incallui/spam/SpamCallListListener.java b/java/com/android/incallui/spam/SpamCallListListener.java index cf545c071..fa3dd6e01 100644 --- a/java/com/android/incallui/spam/SpamCallListListener.java +++ b/java/com/android/incallui/spam/SpamCallListListener.java @@ -47,7 +47,7 @@ import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.notification.DialerNotificationManager; import com.android.dialer.notification.NotificationChannelId; -import com.android.dialer.spam.Spam; +import com.android.dialer.spam.SpamComponent; import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.util.PermissionsUtil; import com.android.incallui.call.CallList; @@ -205,7 +205,7 @@ public class SpamCallListListener implements CallList.Listener { /** Determines if the after call notification should be shown for the specified call. */ private boolean shouldShowAfterCallNotification(DialerCall call) { - if (!Spam.get(context).isSpamNotificationEnabled()) { + if (!SpamComponent.get(context).spam().isSpamNotificationEnabled()) { return false; } @@ -304,7 +304,7 @@ public class SpamCallListListener implements CallList.Listener { private boolean shouldThrottleSpamNotification() { int randomNumber = random.nextInt(100); - int thresholdForShowing = Spam.get(context).percentOfSpamNotificationsToShow(); + int thresholdForShowing = SpamComponent.get(context).spam().percentOfSpamNotificationsToShow(); if (thresholdForShowing == 0) { LogUtil.d( "SpamCallListListener.shouldThrottleSpamNotification", @@ -327,7 +327,8 @@ public class SpamCallListListener implements CallList.Listener { private boolean shouldThrottleNonSpamNotification() { int randomNumber = random.nextInt(100); - int thresholdForShowing = Spam.get(context).percentOfNonSpamNotificationsToShow(); + int thresholdForShowing = + SpamComponent.get(context).spam().percentOfNonSpamNotificationsToShow(); if (thresholdForShowing == 0) { LogUtil.d( "SpamCallListListener.shouldThrottleNonSpamNotification", @@ -419,7 +420,7 @@ public class SpamCallListListener implements CallList.Listener { */ private PendingIntent createBlockReportSpamPendingIntent(DialerCall call) { String action = SpamNotificationActivity.ACTION_MARK_NUMBER_AS_SPAM; - return Spam.get(context).isDialogEnabledForSpamNotification() + return SpamComponent.get(context).spam().isDialogEnabledForSpamNotification() ? createActivityPendingIntent(call, action) : createServicePendingIntent(call, action); } @@ -430,7 +431,7 @@ public class SpamCallListListener implements CallList.Listener { */ private PendingIntent createNotSpamPendingIntent(DialerCall call) { String action = SpamNotificationActivity.ACTION_MARK_NUMBER_AS_NOT_SPAM; - return Spam.get(context).isDialogEnabledForSpamNotification() + return SpamComponent.get(context).spam().isDialogEnabledForSpamNotification() ? createActivityPendingIntent(call, action) : createServicePendingIntent(call, action); } diff --git a/java/com/android/incallui/spam/SpamNotificationActivity.java b/java/com/android/incallui/spam/SpamNotificationActivity.java index f5ea73c73..ceb9ebb90 100644 --- a/java/com/android/incallui/spam/SpamNotificationActivity.java +++ b/java/com/android/incallui/spam/SpamNotificationActivity.java @@ -38,7 +38,7 @@ import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.logging.ReportingLocation; import com.android.dialer.notification.DialerNotificationManager; -import com.android.dialer.spam.Spam; +import com.android.dialer.spam.SpamComponent; import com.android.incallui.call.DialerCall; /** Creates the after call notification dialogs. */ @@ -188,7 +188,7 @@ public class SpamNotificationActivity extends FragmentActivity { /** Creates and displays the dialog for whitelisting a number. */ private void maybeShowNotSpamDialog( final String number, final ContactLookupResult.Type contactLookupResultType) { - if (Spam.get(this).isDialogEnabledForSpamNotification()) { + if (SpamComponent.get(this).spam().isDialogEnabledForSpamNotification()) { BlockReportSpamDialogs.ReportNotSpamDialogFragment.newInstance( getFormattedNumber(number), new BlockReportSpamDialogs.OnConfirmListener() { @@ -207,14 +207,16 @@ public class SpamNotificationActivity extends FragmentActivity { /** Creates and displays the dialog for blocking/reporting a number as spam. */ private void maybeShowBlockReportSpamDialog( final String number, final ContactLookupResult.Type contactLookupResultType) { - if (Spam.get(this).isDialogEnabledForSpamNotification()) { + if (SpamComponent.get(this).spam().isDialogEnabledForSpamNotification()) { maybeShowBlockNumberMigrationDialog( new BlockedNumbersMigrator.Listener() { @Override public void onComplete() { BlockReportSpamDialogs.BlockReportSpamDialogFragment.newInstance( getFormattedNumber(number), - Spam.get(SpamNotificationActivity.this).isDialogReportSpamCheckedByDefault(), + SpamComponent.get(SpamNotificationActivity.this) + .spam() + .isDialogReportSpamCheckedByDefault(), new BlockReportSpamDialogs.OnSpamDialogClickListener() { @Override public void onClick(boolean isSpamChecked) { @@ -263,7 +265,8 @@ public class SpamNotificationActivity extends FragmentActivity { String number, boolean reportAsSpam, ContactLookupResult.Type contactLookupResultType) { if (reportAsSpam) { logCallImpression(DialerImpression.Type.SPAM_AFTER_CALL_NOTIFICATION_MARKED_NUMBER_AS_SPAM); - Spam.get(this) + SpamComponent.get(this) + .spam() .reportSpamFromAfterCallNotification( number, getCountryIso(), @@ -282,7 +285,8 @@ public class SpamNotificationActivity extends FragmentActivity { private void reportNotSpamAndFinish( String number, ContactLookupResult.Type contactLookupResultType) { logCallImpression(DialerImpression.Type.SPAM_AFTER_CALL_NOTIFICATION_REPORT_NUMBER_AS_NOT_SPAM); - Spam.get(this) + SpamComponent.get(this) + .spam() .reportNotSpamFromAfterCallNotification( number, getCountryIso(), @@ -305,7 +309,7 @@ public class SpamNotificationActivity extends FragmentActivity { } private void assertDialogsEnabled() { - if (!Spam.get(this).isDialogEnabledForSpamNotification()) { + if (!SpamComponent.get(this).spam().isDialogEnabledForSpamNotification()) { throw new IllegalStateException( "Cannot start this activity with given action because dialogs are not enabled."); } diff --git a/java/com/android/incallui/spam/SpamNotificationService.java b/java/com/android/incallui/spam/SpamNotificationService.java index 3c1061af1..b85ab11a6 100644 --- a/java/com/android/incallui/spam/SpamNotificationService.java +++ b/java/com/android/incallui/spam/SpamNotificationService.java @@ -30,7 +30,7 @@ import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.logging.ReportingLocation; import com.android.dialer.notification.DialerNotificationManager; -import com.android.dialer.spam.Spam; +import com.android.dialer.spam.SpamComponent; import com.android.incallui.call.DialerCall; /** @@ -95,7 +95,8 @@ public class SpamNotificationService extends Service { case SpamNotificationActivity.ACTION_MARK_NUMBER_AS_SPAM: logCallImpression( intent, DialerImpression.Type.SPAM_NOTIFICATION_SERVICE_ACTION_MARK_NUMBER_AS_SPAM); - Spam.get(this) + SpamComponent.get(this) + .spam() .reportSpamFromAfterCallNotification( number, countryIso, @@ -107,7 +108,8 @@ public class SpamNotificationService extends Service { case SpamNotificationActivity.ACTION_MARK_NUMBER_AS_NOT_SPAM: logCallImpression( intent, DialerImpression.Type.SPAM_NOTIFICATION_SERVICE_ACTION_MARK_NUMBER_AS_NOT_SPAM); - Spam.get(this) + SpamComponent.get(this) + .spam() .reportNotSpamFromAfterCallNotification( number, countryIso, |