InitialLockSetupHelper: fix chars <=> bytes conversion

InitialLockSetupService and KeyguardManager both expect the lockscreen
credential as a UTF-8 encoded byte[].  Yet, the byte[] being passed in
comes from InitialLockSetupHelper.charSequenceToByteArray(), which just
truncates 'chars' to 'bytes'.  Fix this to use a real UTF-8 conversion.

This is necessary for non-ASCII characters in lockscreen credentials to
be correctly rejected.  With the truncation bug, a non-ASCII character
could be truncated to an ASCII character and unexpectedly be accepted.

Bug: 219511761
Bug: 232900169
Bug: 243881358
Test: presubmit
Change-Id: I5c00186b3eeffac4f257247b889f8deed6f7a2bf
1 file changed