/** * Force a new device unlock password (the password needed to access the entire device, not for * individual accounts) on the user. This takes effect immediately. The given password must be * sufficient for the current password quality and length constraints as returned by {@link * #getPasswordQuality(ComponentName)} and {@link #getPasswordMinimumLength(ComponentName)}; if it * does not meet these constraints, then it will be rejected and false returned. Note that the * password may be a stronger quality (containing alphanumeric characters when the requested * quality is only numeric), in which case the currently active quality will be increased to * match. * * <p>The calling device admin must have requested {@link * DeviceAdminInfo#USES_POLICY_RESET_PASSWORD} to be able to call this method; if it has not, a * security exception will be thrown. * * @param password The new password for the user. * @param flags May be 0 or {@link #RESET_PASSWORD_REQUIRE_ENTRY}. * @return Returns true if the password was applied, or false if it is not acceptable for the * current constraints. */ public boolean resetPassword(String password, int flags) { if (mService != null) { try { return mService.resetPassword(password, flags); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } return false; }