package com.ritoq.quickphone.utils

import android.app.KeyguardManager
import android.content.Context
import android.os.PowerManager
import androidx.appcompat.app.AppCompatActivity.KEYGUARD_SERVICE
import androidx.appcompat.app.AppCompatActivity.POWER_SERVICE

object ManagerUtils {
    fun isScreenOff(context: Context):Boolean{
        val powerManager = context.getSystemService(POWER_SERVICE) as PowerManager
        val isScreenOff = !powerManager.isInteractive // API 20+
        return isScreenOff
    }

    fun isLocked(context: Context):Boolean{
        val keyguardManager = context.getSystemService(KEYGUARD_SERVICE) as KeyguardManager
        val isLocked = keyguardManager.isKeyguardLocked
        return isLocked
    }
}