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 const val NOTIFICATION_ID = 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var unlockReceiver: UnlockReceiver
|
private val unlockReceiver = UnlockReceiver()
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
@ -28,7 +28,6 @@ class ForegroundService : Service() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun init() {
|
private fun init() {
|
||||||
unlockReceiver = UnlockReceiver()
|
|
||||||
registerReceiver(unlockReceiver, IntentFilter(Intent.ACTION_USER_PRESENT))
|
registerReceiver(unlockReceiver, IntentFilter(Intent.ACTION_USER_PRESENT))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,8 +55,8 @@ class ForegroundService : Service() {
|
||||||
private class UnlockReceiver : BroadcastReceiver() {
|
private class UnlockReceiver : BroadcastReceiver() {
|
||||||
override fun onReceive(context: Context?, intent: Intent?) {
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
if (context == null ||
|
if (context == null ||
|
||||||
context.getSystemService(KeyguardManager::class.java)?.isDeviceSecure != true)
|
context.getSystemService(KeyguardManager::class.java)?.isDeviceSecure != true ||
|
||||||
return
|
!Preferences(context).isWipeOnInactivity) return
|
||||||
Thread(Runner(context, goAsync())).start()
|
Thread(Runner(context, goAsync())).start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue