/** * Called by an application that is administering the device to set the minimum allowed password * length. After setting this, the user will not be able to enter a new password that is not at * least as restrictive as what has been set. Note that the current password will remain until the * user has set a new one, so the change does not take place immediately. To prompt the user for a * new password, use {@link #ACTION_SET_NEW_PASSWORD} after setting this value. This constraint is * only imposed if the administrator has also requested either {@link #PASSWORD_QUALITY_NUMERIC}, * {@link #PASSWORD_QUALITY_ALPHABETIC}, or {@link #PASSWORD_QUALITY_ALPHANUMERIC} with {@link * #setPasswordQuality}. * * <p>The calling device admin must have requested {@link * DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has not, a * security exception will be thrown. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param length The new desired minimum password length. A value of 0 means there is no * restriction. */ public void setPasswordMinimumLength(ComponentName admin, int length) { if (mService != null) { try { mService.setPasswordMinimumLength(admin, length); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } }