Added in API level 1
Deprecated in API level 15

KeyguardLock


open class KeyguardLock
kotlin.Any
   ↳ android.app.KeyguardManager.KeyguardLock

Handle returned by KeyguardManager.newKeyguardLock that allows you to temporarily disable / reenable the keyguard (lock screen).

Summary

Public methods
open Unit

Disable the keyguard from showing.

open Unit

Reenable the keyguard.

Public methods

disableKeyguard

Added in API level 1
open fun disableKeyguard(): Unit

Deprecated: Deprecated in Java.

Disable the keyguard from showing. If the keyguard is currently showing, hide it. The keyguard will be prevented from showing again until reenableKeyguard() is called.

This only works if the keyguard is not secure.

A good place to call this is from android.app.Activity#onResume()
Requires android.Manifest.permission#DISABLE_KEYGUARD

reenableKeyguard

Added in API level 1
open fun reenableKeyguard(): Unit

Deprecated: Deprecated in Java.

Reenable the keyguard. The keyguard will reappear if the previous call to disableKeyguard() caused it to be hidden. A good place to call this is from android.app.Activity#onPause()
Requires android.Manifest.permission#DISABLE_KEYGUARD