[DataStore] Migrate LocaleNotification SharedPreferences to BackupRestoreStorage

Bug: 325144964
Test: Manual tests
Change-Id: I195ee91f29030fcfe7176ed0c18fb2e2d0d40257
This commit is contained in:
Jacky Wang
2024-02-29 22:39:33 +08:00
parent 46369353ed
commit cc0a94d732
3 changed files with 14 additions and 6 deletions

View File

@@ -19,8 +19,11 @@ package com.android.settings.localepicker;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import com.android.settingslib.datastore.SharedPreferencesStorage;
import com.google.gson.Gson;
import java.util.HashMap;
@@ -43,6 +46,12 @@ public class LocaleNotificationDataManager {
this.mContext = context;
}
/** Returns the underlying {@link SharedPreferences} storage. */
@NonNull
public static SharedPreferencesStorage getSharedPreferencesStorage(@NonNull Context context) {
return new SharedPreferencesStorage(context, LOCALE_NOTIFICATION, Context.MODE_PRIVATE);
}
private static SharedPreferences getSharedPreferences(Context context) {
return context.getSharedPreferences(LOCALE_NOTIFICATION, Context.MODE_PRIVATE);
}