From c857f90590e7d7fcffa89511982eb33afd34805f Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Mon, 15 May 2017 14:05:33 -0700 Subject: Update Dialer to v10 RC32 This release was created following the instructions at: go/dialer-aosp-release Subsequent dialer releases will follow as O bugs are fixed, until we reach our final RC. Version: 10 Candidate: RC32 Branch: dialer-android_release_branch/153304843.1 dialer-android_20170416.00/dialer-android_20170416.00_RC32 This release contains the following bug fixes since RC17: Bug: 33176679 33272455 3646510 36773894 37297649 37413780 37513689 37640315 37680595 37698062 37873639 37901752 37919295 37953423 38062852 38069600 38137349 38173549 38180252 38191514 Test: make, on device Change-Id: I4e4bb630082758e418ff24892b7db3142c6eb09a --- .../incallui/answer/impl/hint/AnswerHintFactory.java | 15 ++++----------- .../incallui/answer/impl/hint/PawImageLoaderImpl.java | 5 +++-- 2 files changed, 7 insertions(+), 13 deletions(-) (limited to 'java/com/android/incallui/answer/impl') diff --git a/java/com/android/incallui/answer/impl/hint/AnswerHintFactory.java b/java/com/android/incallui/answer/impl/hint/AnswerHintFactory.java index eaf5b74e5..77b45ec71 100644 --- a/java/com/android/incallui/answer/impl/hint/AnswerHintFactory.java +++ b/java/com/android/incallui/answer/impl/hint/AnswerHintFactory.java @@ -20,13 +20,13 @@ import android.content.Context; import android.content.SharedPreferences; import android.graphics.drawable.Drawable; import android.os.Build; -import android.preference.PreferenceManager; import android.support.annotation.NonNull; import android.support.annotation.VisibleForTesting; import com.android.dialer.common.Assert; import com.android.dialer.common.ConfigProvider; import com.android.dialer.common.ConfigProviderBindings; import com.android.dialer.common.LogUtil; +import com.android.dialer.util.DialerUtils; import com.android.incallui.util.AccessibilityUtil; /** @@ -62,7 +62,7 @@ public class AnswerHintFactory { if (shouldShowAnswerHint( context, ConfigProviderBindings.get(context), - getDeviceProtectedPreferences(context), + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context), Build.PRODUCT)) { return new DotAnswerHint(context, puckUpDuration, puckUpDelay); } @@ -77,7 +77,8 @@ public class AnswerHintFactory { } public static void increaseAnsweredCount(Context context) { - SharedPreferences sharedPreferences = getDeviceProtectedPreferences(context); + SharedPreferences sharedPreferences = + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context); int answeredCount = sharedPreferences.getInt(ANSWERED_COUNT_PREFERENCE_KEY, 0); sharedPreferences.edit().putInt(ANSWERED_COUNT_PREFERENCE_KEY, answeredCount + 1).apply(); } @@ -119,12 +120,4 @@ public class AnswerHintFactory { .getString(CONFIG_ANSWER_HINT_WHITELISTED_DEVICES_KEY, DEFAULT_WHITELISTED_DEVICES_CSV) .contains("/" + device + "/"); } - - private static SharedPreferences getDeviceProtectedPreferences(Context context) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { - return PreferenceManager.getDefaultSharedPreferences(context); - } - return PreferenceManager.getDefaultSharedPreferences( - context.createDeviceProtectedStorageContext()); - } } diff --git a/java/com/android/incallui/answer/impl/hint/PawImageLoaderImpl.java b/java/com/android/incallui/answer/impl/hint/PawImageLoaderImpl.java index 485a9ae37..21154cade 100644 --- a/java/com/android/incallui/answer/impl/hint/PawImageLoaderImpl.java +++ b/java/com/android/incallui/answer/impl/hint/PawImageLoaderImpl.java @@ -21,10 +21,10 @@ import android.content.Context; import android.content.SharedPreferences; import android.graphics.drawable.Drawable; import android.os.Build.VERSION_CODES; -import android.preference.PreferenceManager; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import com.android.dialer.common.Assert; +import com.android.dialer.util.DialerUtils; /** Decrypt the event payload to be shown if in a specific time range and the key is received. */ @TargetApi(VERSION_CODES.M) @@ -35,7 +35,8 @@ public final class PawImageLoaderImpl implements PawImageLoader { public Drawable loadPayload(@NonNull Context context) { Assert.isNotNull(context); - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); + SharedPreferences preferences = + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context); if (!preferences.getBoolean(PawSecretCodeListener.PAW_ENABLED_WITH_SECRET_CODE_KEY, false)) { return null; } -- cgit v1.2.3