Java Code Examples for android.app.admin.DevicePolicyManager#PASSWORD_QUALITY_COMPLEX

The following examples show how to use android.app.admin.DevicePolicyManager#PASSWORD_QUALITY_COMPLEX . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LockSettingsService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the lowest password quality that still presents the same UI for entering it.
 *
 * For the FRP credential, we do not want to leak the actual quality of the password, only what
 * kind of UI it requires. However, when migrating, we only know the actual quality, not the
 * originally requested quality; since this is only used to determine what input variant to
 * present to the user, we just assume the lowest possible quality was requested.
 */
private int redactActualQualityToMostLenientEquivalentQuality(int quality) {
    switch (quality) {
        case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC:
        case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
        case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
            return DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC;
        case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
        case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
            return DevicePolicyManager.PASSWORD_QUALITY_NUMERIC;
        case DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED:
        case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
        case DevicePolicyManager.PASSWORD_QUALITY_MANAGED:
        case DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK:
        default:
            return quality;
    }
}
 
Example 2
Source File: KeyguardStateMonitor.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
public boolean keyguardEnforcedByDevicePolicy() {
    DevicePolicyManager dpm = (DevicePolicyManager)
            mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
    if (dpm != null) {
        int passwordQuality = dpm.getPasswordQuality(null);
        switch (passwordQuality) {
            case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC:
            case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
            case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
            case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
            case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
            case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
                return true;
        }
    }
    return false;
}