fix: replace EncryptedSharedPreferences with plain MODE_PRIVATE for update survival

This commit is contained in:
eddy 2026-07-29 18:51:21 +02:00
commit 42b8092807

View file

@ -3,10 +3,7 @@ package com.eddy.atomrelay
import android.content.Context import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import android.util.Log
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import androidx.security.crypto.EncryptedSharedPreferences
import androidx.security.crypto.MasterKey
object PrefsHelper { object PrefsHelper {
@ -29,21 +26,6 @@ object PrefsHelper {
} }
fun getPrefs(context: Context): SharedPreferences { fun getPrefs(context: Context): SharedPreferences {
return try { return context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
val masterKey = MasterKey.Builder(context)
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
.build()
EncryptedSharedPreferences.create(
context,
PREFS_NAME,
masterKey,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
)
} catch (e: Exception) {
Log.e(TAG, "Failed to create EncryptedSharedPreferences", e)
context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
}
} }
} }