mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix service starting #1025
This commit is contained in:
@@ -90,10 +90,6 @@ class FileDatabaseSelectActivity : SpecialModeActivity(),
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// TODO To move after refactoring
|
||||
if (DatabaseTaskNotificationService.isRunning(this))
|
||||
Database.getInstance().clearAndClose(this)
|
||||
|
||||
mFileDatabaseHistoryAction = FileDatabaseHistoryAction.getInstance(applicationContext)
|
||||
|
||||
setContentView(R.layout.activity_file_selection)
|
||||
|
||||
@@ -256,7 +256,6 @@ class ProgressDatabaseTaskProvider(private val activity: FragmentActivity) {
|
||||
|
||||
private fun start(bundle: Bundle? = null, actionTask: String) {
|
||||
try {
|
||||
activity.stopService(intentDatabaseTask)
|
||||
if (bundle != null)
|
||||
intentDatabaseTask.putExtras(bundle)
|
||||
intentDatabaseTask.action = actionTask
|
||||
|
||||
@@ -940,18 +940,6 @@ open class DatabaseTaskNotificationService : LockNotificationService(), Progress
|
||||
putParcelableArrayList(ENTRIES_ID_KEY, entriesId)
|
||||
}
|
||||
}
|
||||
|
||||
fun isRunning(context: Context): Boolean {
|
||||
// TODO remove by moving database instance in service
|
||||
(context.getSystemService(ACTIVITY_SERVICE) as? ActivityManager?)?.let { manager ->
|
||||
for (service in manager.getRunningServices(Int.MAX_VALUE)) {
|
||||
if (DatabaseTaskNotificationService::class.java.name == service.service.className) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user