summaryrefslogtreecommitdiff
path: root/src/com/android/deskclock/DeskClockApplication.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/deskclock/DeskClockApplication.java')
-rw-r--r--src/com/android/deskclock/DeskClockApplication.java22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/com/android/deskclock/DeskClockApplication.java b/src/com/android/deskclock/DeskClockApplication.java
index 395d38518..784bc6f1d 100644
--- a/src/com/android/deskclock/DeskClockApplication.java
+++ b/src/com/android/deskclock/DeskClockApplication.java
@@ -16,7 +16,6 @@
package com.android.deskclock;
-import android.annotation.TargetApi;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
@@ -46,20 +45,17 @@ public class DeskClockApplication extends Application {
/**
* Returns the default {@link SharedPreferences} instance from the underlying storage context.
*/
- @TargetApi(Build.VERSION_CODES.N)
private static SharedPreferences getDefaultSharedPreferences(Context context) {
final Context storageContext;
- if (Utils.isNOrLater()) {
- // All N devices have split storage areas. Migrate the existing preferences into the new
- // device encrypted storage area if that has not yet occurred.
- final String name = PreferenceManager.getDefaultSharedPreferencesName(context);
- storageContext = context.createDeviceProtectedStorageContext();
- if (!storageContext.moveSharedPreferencesFrom(context, name)) {
- LogUtils.wtf("Failed to migrate shared preferences");
- }
- } else {
- storageContext = context;
+
+ // All N devices have split storage areas. Migrate the existing preferences into the new
+ // device encrypted storage area if that has not yet occurred.
+ final String name = PreferenceManager.getDefaultSharedPreferencesName(context);
+ storageContext = context.createDeviceProtectedStorageContext();
+ if (!storageContext.moveSharedPreferencesFrom(context, name)) {
+ LogUtils.wtf("Failed to migrate shared preferences");
}
+
return PreferenceManager.getDefaultSharedPreferences(storageContext);
}
-} \ No newline at end of file
+}