aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-10-05 08:29:44 +0530
committerGitHub <noreply@github.com>2020-10-05 08:29:44 +0530
commit3ddd06679f1e666716391450adaa687db33332c7 (patch)
tree23c766dda568b513b3940200c9f7bcbc214591fa /app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt
parent8a4316067396e6a0a5490e727197cf843d3f4ec6 (diff)
downloadHardenedPass-3ddd06679f1e666716391450adaa687db33332c7.tar.gz
HardenedPass-3ddd06679f1e666716391450adaa687db33332c7.zip
Resolve lock contention from lazy delegates (#1135)
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt6
1 files changed, 2 insertions, 4 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt b/app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt
index 46c4ecd3..0f27e5ef 100644
--- a/app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt
@@ -10,7 +10,6 @@ import android.app.PendingIntent
import android.app.Service
import android.content.ClipData
import android.content.Intent
-import android.content.SharedPreferences
import android.os.Build
import android.os.IBinder
import androidx.core.app.NotificationCompat
@@ -32,7 +31,6 @@ import kotlinx.coroutines.withContext
class ClipboardService : Service() {
private val scope = CoroutineScope(Job() + Dispatchers.Main)
- private val settings: SharedPreferences by lazy { sharedPrefs }
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
if (intent != null) {
@@ -45,7 +43,7 @@ class ClipboardService : Service() {
}
ACTION_START -> {
- val time = settings.getString(PreferenceKeys.GENERAL_SHOW_TIME)?.toIntOrNull() ?: 45
+ val time = sharedPrefs.getString(PreferenceKeys.GENERAL_SHOW_TIME)?.toIntOrNull() ?: 45
if (time == 0) {
stopSelf()
@@ -80,7 +78,7 @@ class ClipboardService : Service() {
}
private fun clearClipboard() {
- val deepClear = settings.getBoolean(PreferenceKeys.CLEAR_CLIPBOARD_20X, false)
+ val deepClear = sharedPrefs.getBoolean(PreferenceKeys.CLEAR_CLIPBOARD_20X, false)
val clipboard = clipboard
if (clipboard != null) {