Fix clean clipboard after killing app by swap

This commit is contained in:
J-Jamet
2019-10-26 08:58:36 +02:00
parent ef7387f2f3
commit 3732ff1ebc

View File

@@ -72,11 +72,7 @@ class ClipboardEntryNotificationService : EntryNotificationService() {
}
ACTION_CLEAN_CLIPBOARD == intent.action -> {
stopTask(cleanCopyNotificationTimerTask)
try {
clipboardHelper?.cleanClipboard()
} catch (e: SamsungClipboardException) {
Log.e(TAG, "Clipboard can't be cleaned", e)
}
cleanClipboard()
stopNotificationAndSendLockIfNeeded()
}
else -> for (actionKey in ClipboardEntryNotificationField.allActionKeys) {
@@ -204,11 +200,7 @@ class ClipboardEntryNotificationService : EntryNotificationService() {
notificationManager?.cancel(myNotificationId)
// Clean password only if no next field
if (nextFields.size <= 0)
try {
clipboardHelper?.cleanClipboard()
} catch (e: SamsungClipboardException) {
Log.e(TAG, "Clipboard can't be cleaned", e)
}
cleanClipboard()
}
cleanCopyNotificationTimerTask?.start()
} else {
@@ -222,6 +214,20 @@ class ClipboardEntryNotificationService : EntryNotificationService() {
}
private fun cleanClipboard() {
try {
clipboardHelper?.cleanClipboard()
} catch (e: SamsungClipboardException) {
Log.e(TAG, "Clipboard can't be cleaned", e)
}
}
override fun onTaskRemoved(rootIntent: Intent?) {
cleanClipboard()
super.onTaskRemoved(rootIntent)
}
override fun onDestroy() {
stopTask(cleanCopyNotificationTimerTask)