Component used: Version used: implementation 'androidx.preference:preference-ktx:1.2.0'
Devices/Android versions reproduced on: Emulator API 33
If this is a bug in the library, we would appreciate if you could attach: - Sample project to trigger the issue. - A screenrecord or screenshots showing the issue (if UI related). Attached both.
The bug is that strictMode shows that the SharedPreferences reaches the storage on the UI thread, despite the fact I didn't write/read anything on the UI thread, and requested to perform an operation only on the background thread:
Description
Version used:
implementation 'androidx.preference:preference-ktx:1.2.0'
Devices/Android versions reproduced on:
Emulator API 33
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue.
- A screenrecord or screenshots showing the issue (if UI related).
Attached both.
The bug is that strictMode shows that the SharedPreferences reaches the storage on the UI thread, despite the fact I didn't write/read anything on the UI thread, and requested to perform an operation only on the background thread:
setThreadPolicy(
StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork()
.penaltyListener(Executors.newSingleThreadExecutor()) { violation ->
Log.d(
"AppLog",
"violation:${violation?.stackTrace?.joinToString(separator = "\n")}"
)
}
.build())
androidx.preference.PreferenceManager.getDefaultSharedPreferences(this).edit()
.remove("test").apply()