mirror of https://github.com/x13a/Wasted.git
ref
This commit is contained in:
parent
33a6681052
commit
349c9af9e8
|
@ -15,7 +15,7 @@ class ForegroundService : Service() {
|
|||
private const val NOTIFICATION_ID = 1000
|
||||
}
|
||||
|
||||
private lateinit var unlockReceiver: UnlockReceiver
|
||||
private val unlockReceiver = UnlockReceiver()
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
@ -28,7 +28,6 @@ class ForegroundService : Service() {
|
|||
}
|
||||
|
||||
private fun init() {
|
||||
unlockReceiver = UnlockReceiver()
|
||||
registerReceiver(unlockReceiver, IntentFilter(Intent.ACTION_USER_PRESENT))
|
||||
}
|
||||
|
||||
|
@ -56,8 +55,8 @@ class ForegroundService : Service() {
|
|||
private class UnlockReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
if (context == null ||
|
||||
context.getSystemService(KeyguardManager::class.java)?.isDeviceSecure != true)
|
||||
return
|
||||
context.getSystemService(KeyguardManager::class.java)?.isDeviceSecure != true ||
|
||||
!Preferences(context).isWipeOnInactivity) return
|
||||
Thread(Runner(context, goAsync())).start()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue