0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-27 05:23:00 +00:00

service tests

This commit is contained in:
X1nto 2020-08-08 22:58:22 +04:00
parent 985999899b
commit 7bdbf6e9b5

View file

@ -25,10 +25,9 @@ object AppUtils {
private fun isServiceRunning(cls: Class<out Service>, context: Context): Boolean { private fun isServiceRunning(cls: Class<out Service>, context: Context): Boolean {
val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val runningServices = activityManager.getRunningServices(Int.MAX_VALUE) val runningServices = activityManager.getRunningServices(Int.MAX_VALUE)
runningServices.forEach { info -> return runningServices.any { info ->
return info.service.className == cls.name info.service.className == cls.name
} }
return false
} }
fun sendFailure(status: Int, context: Context) { fun sendFailure(status: Int, context: Context) {