From 147e86270e70bf090cfc8ebb4bc5903a17a9ef10 Mon Sep 17 00:00:00 2001 From: Android Dialer Date: Thu, 17 May 2018 16:13:38 -0700 Subject: Use StorageComponent to get SharedPreference in SpamBlockingPromoHelper Test: SpamBlockingPromoHelperTest PiperOrigin-RevId: 197068358 Change-Id: Ic4b69781d0b32035c7d12d91d27e85d99e7d3732 --- .../com/android/dialer/spam/promo/SpamBlockingPromoHelper.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'java') diff --git a/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java b/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java index 42fb39f38..e9f7cc6c1 100644 --- a/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java +++ b/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java @@ -23,7 +23,6 @@ import android.app.Notification.Builder; import android.app.PendingIntent; import android.content.Context; import android.content.DialogInterface.OnDismissListener; -import android.preference.PreferenceManager; import android.support.design.widget.Snackbar; import android.support.v4.os.BuildCompat; import android.view.View; @@ -35,6 +34,7 @@ import com.android.dialer.notification.DialerNotificationManager; import com.android.dialer.notification.NotificationChannelId; import com.android.dialer.spam.SpamSettings; import com.android.dialer.spam.promo.SpamBlockingPromoDialogFragment.OnEnableListener; +import com.android.dialer.storage.StorageComponent; /** Helper class for showing spam blocking on-boarding promotions. */ public class SpamBlockingPromoHelper { @@ -71,7 +71,8 @@ public class SpamBlockingPromoHelper { } long lastShowMillis = - PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()) + StorageComponent.get(context) + .unencryptedSharedPrefs() .getLong(SPAM_BLOCKING_PROMO_LAST_SHOW_MILLIS, 0); long showPeriodMillis = ConfigProviderBindings.get(context) @@ -103,10 +104,11 @@ public class SpamBlockingPromoHelper { } private void updateLastShowSpamTimestamp() { - PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()) + StorageComponent.get(context) + .unencryptedSharedPrefs() .edit() .putLong(SPAM_BLOCKING_PROMO_LAST_SHOW_MILLIS, System.currentTimeMillis()) - .commit(); + .apply(); } /** -- cgit v1.2.3