优化:监听`Screen`事件细分`On/Off/Locked/Unlocked` #399

This commit is contained in:
pppscn 2024-02-17 08:23:39 +08:00
parent f4f6080b9a
commit ccd98ab2da
2 changed files with 3 additions and 0 deletions

View File

@ -43,6 +43,8 @@ data class LockScreenSetting(
timeAfterScreenOff = timeAfterOff
timeAfterScreenOn = timeAfterOn
timeAfterScreenLocked = timeAfterLocked
timeAfterScreenUnlocked = timeAfterUnlocked
}
fun getActionCheckId(): Int {

View File

@ -74,6 +74,7 @@ class LockScreenWorker(context: Context, params: WorkerParameters) : CoroutineWo
Intent.ACTION_USER_PRESENT -> lockScreenSetting.timeAfterScreenUnlocked
else -> lockScreenSetting.timeAfterScreenLocked
}
Log.d(TAG, "TASK-${task.id}duration = $duration minutes")
val actionRequest = OneTimeWorkRequestBuilder<ActionWorker>()
.setInitialDelay(duration.toLong(), TimeUnit.MINUTES)
.setInputData(actionData).build()