Loading api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -4412,7 +4412,7 @@ package android.app { method public android.content.Intent createConfirmDeviceCredentialIntent(java.lang.CharSequence, java.lang.CharSequence); method public deprecated void exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult); method public boolean inKeyguardRestrictedInputMode(); method public boolean isKeyguardInTrustedState(); method public boolean isDeviceLocked(); method public boolean isKeyguardLocked(); method public boolean isKeyguardSecure(); method public deprecated android.app.KeyguardManager.KeyguardLock newKeyguardLock(java.lang.String); core/java/android/app/KeyguardManager.java +13 −13 Original line number Diff line number Diff line Loading @@ -225,28 +225,28 @@ public class KeyguardManager { } /** * Return whether unlocking the device is currently not requiring a password * because of a trust agent. * Returns whether the device is currently locked and requires a PIN, pattern or * password to unlock. * * @return true if the keyguard can currently be unlocked without entering credentials * because the device is in a trusted environment. * @return true if unlocking the device currently requires a PIN, pattern or * password. */ public boolean isKeyguardInTrustedState() { return isKeyguardInTrustedState(UserHandle.getCallingUserId()); public boolean isDeviceLocked() { return isDeviceLocked(UserHandle.getCallingUserId()); } /** * Return whether unlocking the device is currently not requiring a password * because of a trust agent. * Returns whether the device is currently locked and requires a PIN, pattern or * password to unlock. * * @param userId the user for which the trusted state should be reported. * @return true if the keyguard can currently be unlocked without entering credentials * because the device is in a trusted environment. * @param userId the user for which the locked state should be reported. * @return true if unlocking the device currently requires a PIN, pattern or * password. * @hide */ public boolean isKeyguardInTrustedState(int userId) { public boolean isDeviceLocked(int userId) { try { return mTrustManager.isTrusted(userId); return mTrustManager.isDeviceLocked(userId); } catch (RemoteException e) { return false; } Loading core/java/android/app/trust/ITrustManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -29,5 +29,5 @@ interface ITrustManager { void reportRequireCredentialEntry(int userId); void registerTrustListener(in ITrustListener trustListener); void unregisterTrustListener(in ITrustListener trustListener); boolean isTrusted(int userId); boolean isDeviceLocked(int userId); } core/java/com/android/internal/widget/LockPatternUtils.java +47 −12 Original line number Diff line number Diff line Loading @@ -384,8 +384,16 @@ public class LockPatternUtils { * @return Whether a saved pattern exists. */ public boolean savedPatternExists() { return savedPatternExists(getCurrentOrCallingUserId()); } /** * Check to see if the user has stored a lock pattern. * @return Whether a saved pattern exists. */ public boolean savedPatternExists(int userId) { try { return getLockSettings().havePattern(getCurrentOrCallingUserId()); return getLockSettings().havePattern(userId); } catch (RemoteException re) { return false; } Loading @@ -396,8 +404,16 @@ public class LockPatternUtils { * @return Whether a saved pattern exists. */ public boolean savedPasswordExists() { return savedPasswordExists(getCurrentOrCallingUserId()); } /** * Check to see if the user has stored a lock pattern. * @return Whether a saved pattern exists. */ public boolean savedPasswordExists(int userId) { try { return getLockSettings().havePassword(getCurrentOrCallingUserId()); return getLockSettings().havePassword(userId); } catch (RemoteException re) { return false; } Loading Loading @@ -955,8 +971,15 @@ public class LockPatternUtils { * @return true if the lockscreen method is set to biometric weak */ public boolean usingBiometricWeak() { int quality = (int) getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED); return usingBiometricWeak(getCurrentOrCallingUserId()); } /** * @return true if the lockscreen method is set to biometric weak */ public boolean usingBiometricWeak(int userId) { int quality = (int) getLong( PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userId); return quality == DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK; } Loading Loading @@ -1096,15 +1119,22 @@ public class LockPatternUtils { * @return Whether the lock pattern is enabled, or if it is set as a backup for biometric weak */ public boolean isLockPatternEnabled() { return isLockPatternEnabled(getCurrentOrCallingUserId()); } /** * @return Whether the lock pattern is enabled, or if it is set as a backup for biometric weak */ public boolean isLockPatternEnabled(int userId) { final boolean backupEnabled = getLong(PASSWORD_TYPE_ALTERNATE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userId) == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING; return getBoolean(Settings.Secure.LOCK_PATTERN_ENABLED, false) && (getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING || (usingBiometricWeak() && backupEnabled)); return getBoolean(Settings.Secure.LOCK_PATTERN_ENABLED, false, userId) && (getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userId) == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING || (usingBiometricWeak(userId) && backupEnabled)); } /** Loading Loading @@ -1485,15 +1515,20 @@ public class LockPatternUtils { } public boolean isSecure() { long mode = getKeyguardStoredPasswordQuality(); return isSecure(getCurrentOrCallingUserId()); } public boolean isSecure(int userId) { long mode = getKeyguardStoredPasswordQuality(userId); final boolean isPattern = mode == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING; final boolean isPassword = mode == DevicePolicyManager.PASSWORD_QUALITY_NUMERIC || mode == DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX || mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC || mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC || mode == DevicePolicyManager.PASSWORD_QUALITY_COMPLEX; final boolean secure = isPattern && isLockPatternEnabled() && savedPatternExists() || isPassword && savedPasswordExists(); final boolean secure = isPattern && isLockPatternEnabled(userId) && savedPatternExists(userId) || isPassword && savedPasswordExists(userId); return secure; } Loading packages/Keyguard/test/SampleTrustAgent/res/layout/sample_trust_agent_settings.xml +3 −3 Original line number Diff line number Diff line Loading @@ -48,11 +48,11 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:id="@+id/check_trusted" <Button android:id="@+id/check_device_locked" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Keyguard in trusted state?" /> <TextView android:id="@+id/check_trusted_result" android:text="Device locked?" /> <TextView android:id="@+id/check_device_locked_result" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" /> Loading Loading
api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -4412,7 +4412,7 @@ package android.app { method public android.content.Intent createConfirmDeviceCredentialIntent(java.lang.CharSequence, java.lang.CharSequence); method public deprecated void exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult); method public boolean inKeyguardRestrictedInputMode(); method public boolean isKeyguardInTrustedState(); method public boolean isDeviceLocked(); method public boolean isKeyguardLocked(); method public boolean isKeyguardSecure(); method public deprecated android.app.KeyguardManager.KeyguardLock newKeyguardLock(java.lang.String);
core/java/android/app/KeyguardManager.java +13 −13 Original line number Diff line number Diff line Loading @@ -225,28 +225,28 @@ public class KeyguardManager { } /** * Return whether unlocking the device is currently not requiring a password * because of a trust agent. * Returns whether the device is currently locked and requires a PIN, pattern or * password to unlock. * * @return true if the keyguard can currently be unlocked without entering credentials * because the device is in a trusted environment. * @return true if unlocking the device currently requires a PIN, pattern or * password. */ public boolean isKeyguardInTrustedState() { return isKeyguardInTrustedState(UserHandle.getCallingUserId()); public boolean isDeviceLocked() { return isDeviceLocked(UserHandle.getCallingUserId()); } /** * Return whether unlocking the device is currently not requiring a password * because of a trust agent. * Returns whether the device is currently locked and requires a PIN, pattern or * password to unlock. * * @param userId the user for which the trusted state should be reported. * @return true if the keyguard can currently be unlocked without entering credentials * because the device is in a trusted environment. * @param userId the user for which the locked state should be reported. * @return true if unlocking the device currently requires a PIN, pattern or * password. * @hide */ public boolean isKeyguardInTrustedState(int userId) { public boolean isDeviceLocked(int userId) { try { return mTrustManager.isTrusted(userId); return mTrustManager.isDeviceLocked(userId); } catch (RemoteException e) { return false; } Loading
core/java/android/app/trust/ITrustManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -29,5 +29,5 @@ interface ITrustManager { void reportRequireCredentialEntry(int userId); void registerTrustListener(in ITrustListener trustListener); void unregisterTrustListener(in ITrustListener trustListener); boolean isTrusted(int userId); boolean isDeviceLocked(int userId); }
core/java/com/android/internal/widget/LockPatternUtils.java +47 −12 Original line number Diff line number Diff line Loading @@ -384,8 +384,16 @@ public class LockPatternUtils { * @return Whether a saved pattern exists. */ public boolean savedPatternExists() { return savedPatternExists(getCurrentOrCallingUserId()); } /** * Check to see if the user has stored a lock pattern. * @return Whether a saved pattern exists. */ public boolean savedPatternExists(int userId) { try { return getLockSettings().havePattern(getCurrentOrCallingUserId()); return getLockSettings().havePattern(userId); } catch (RemoteException re) { return false; } Loading @@ -396,8 +404,16 @@ public class LockPatternUtils { * @return Whether a saved pattern exists. */ public boolean savedPasswordExists() { return savedPasswordExists(getCurrentOrCallingUserId()); } /** * Check to see if the user has stored a lock pattern. * @return Whether a saved pattern exists. */ public boolean savedPasswordExists(int userId) { try { return getLockSettings().havePassword(getCurrentOrCallingUserId()); return getLockSettings().havePassword(userId); } catch (RemoteException re) { return false; } Loading Loading @@ -955,8 +971,15 @@ public class LockPatternUtils { * @return true if the lockscreen method is set to biometric weak */ public boolean usingBiometricWeak() { int quality = (int) getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED); return usingBiometricWeak(getCurrentOrCallingUserId()); } /** * @return true if the lockscreen method is set to biometric weak */ public boolean usingBiometricWeak(int userId) { int quality = (int) getLong( PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userId); return quality == DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK; } Loading Loading @@ -1096,15 +1119,22 @@ public class LockPatternUtils { * @return Whether the lock pattern is enabled, or if it is set as a backup for biometric weak */ public boolean isLockPatternEnabled() { return isLockPatternEnabled(getCurrentOrCallingUserId()); } /** * @return Whether the lock pattern is enabled, or if it is set as a backup for biometric weak */ public boolean isLockPatternEnabled(int userId) { final boolean backupEnabled = getLong(PASSWORD_TYPE_ALTERNATE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userId) == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING; return getBoolean(Settings.Secure.LOCK_PATTERN_ENABLED, false) && (getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING || (usingBiometricWeak() && backupEnabled)); return getBoolean(Settings.Secure.LOCK_PATTERN_ENABLED, false, userId) && (getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userId) == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING || (usingBiometricWeak(userId) && backupEnabled)); } /** Loading Loading @@ -1485,15 +1515,20 @@ public class LockPatternUtils { } public boolean isSecure() { long mode = getKeyguardStoredPasswordQuality(); return isSecure(getCurrentOrCallingUserId()); } public boolean isSecure(int userId) { long mode = getKeyguardStoredPasswordQuality(userId); final boolean isPattern = mode == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING; final boolean isPassword = mode == DevicePolicyManager.PASSWORD_QUALITY_NUMERIC || mode == DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX || mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC || mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC || mode == DevicePolicyManager.PASSWORD_QUALITY_COMPLEX; final boolean secure = isPattern && isLockPatternEnabled() && savedPatternExists() || isPassword && savedPasswordExists(); final boolean secure = isPattern && isLockPatternEnabled(userId) && savedPatternExists(userId) || isPassword && savedPasswordExists(userId); return secure; } Loading
packages/Keyguard/test/SampleTrustAgent/res/layout/sample_trust_agent_settings.xml +3 −3 Original line number Diff line number Diff line Loading @@ -48,11 +48,11 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:id="@+id/check_trusted" <Button android:id="@+id/check_device_locked" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Keyguard in trusted state?" /> <TextView android:id="@+id/check_trusted_result" android:text="Device locked?" /> <TextView android:id="@+id/check_device_locked_result" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" /> Loading