android.app.KeyguardManager#isDeviceLocked ( )源码实例Demo

下面列出了android.app.KeyguardManager#isDeviceLocked ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android_9.0.0_r45   文件: ClipboardService.java
private boolean isDeviceLocked() {
    int callingUserId = UserHandle.getCallingUserId();
    final long token = Binder.clearCallingIdentity();
    try {
        final KeyguardManager keyguardManager = getContext().getSystemService(
                KeyguardManager.class);
        return keyguardManager != null && keyguardManager.isDeviceLocked(callingUserId);
    } finally {
        Binder.restoreCallingIdentity(token);
    }
}
 
源代码2 项目: android_9.0.0_r45   文件: UserController.java
/**
 * Returns whether the given user requires credential entry at this time. This is used to
 * intercept activity launches for work apps when the Work Challenge is present.
 */
protected boolean shouldConfirmCredentials(int userId) {
    synchronized (mLock) {
        if (mStartedUsers.get(userId) == null) {
            return false;
        }
    }
    if (!mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) {
        return false;
    }
    final KeyguardManager km = mInjector.getKeyguardManager();
    return km.isDeviceLocked(userId) && km.isDeviceSecure(userId);
}
 
源代码3 项目: AcDisplay   文件: KeyguardUtils.java
/**
 * Returns whether the device is currently locked and requires a PIN,
 * pattern or password to unlock.
 */
@SuppressLint("NewApi")
public static boolean isDeviceLocked(@NonNull KeyguardManager km) {
    return Device.hasLollipopMR1Api() ? km.isDeviceLocked() : km.isKeyguardSecure();
}