public class ScreenLockController extends Object
Your application can call the methods to unlock the device screen and check whether the screen is locked or unlocked.
SystemCapability.Miscservices#SCREENLOCK| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static ScreenLockController |
getInstance() |
Obtains the
ScreenLockController singleton instance. |
boolean |
isScreenLocked() |
Checks whether the screen is currently locked.
|
boolean |
isSecureMode() |
Checks whether the screen lock of the current device is secure.
|
void |
unlockScreen(Context abilityContext,
UnlockScreenCallback callback) |
Unlocks the screen.
|
public static ScreenLockController getInstance()
ScreenLockController singleton instance.
Before calling any ScreenLockController method, you must call this method to obtain an instance.
Each application process has only one ScreenLockController instance.
public boolean isScreenLocked()
true if the device screen is locked; returns false otherwise.public void unlockScreen(Context abilityContext, UnlockScreenCallback callback)
If the device screen is currently locked, call this method to unlock the screen.
abilityContext - Indicates the application ability context.callback - Indicates the callback invoked when the screen is unlocked.public boolean isSecureMode()
The secure screen lock means that unlocking the screen requires a password, fingerprint ID, face recognition, or other identification of the user.
true if the screen lock is secure; returns false otherwise.