Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d05588c4 authored by Greg Ross's avatar Greg Ross Committed by Michael Bestas
Browse files

DeskClock: Remove shared preference migration

* The current code overwrites any preferences you set after DeskClock
  restarts as the migration of shared preferences code always runs as it
  never checks to see if local preferences exist.
* Since the migration is for Pre-N devices and from 2016, just remove
  the migration

Change-Id: I5e7882fd4c15fc341e3d87301bfb3a9310729ef2
parent b4ce2971
Loading
Loading
Loading
Loading
+5 −11
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 The Android Open Source Project
 * Copyright (C) 2022-2024 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -45,16 +46,9 @@ public class DeskClockApplication extends Application {
     * Returns the default {@link SharedPreferences} instance from the underlying storage context.
     */
    private static SharedPreferences getDefaultSharedPreferences(Context context) {
        final Context storageContext;

        // 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);
        final Context storageContext = context.createDeviceProtectedStorageContext();
        return storageContext.getSharedPreferences(
                PreferenceManager.getDefaultSharedPreferencesName(storageContext),
                Context.MODE_PRIVATE);
    }
}