Rewrite UTF-8 encoding.

Create a templated implementation to serve all the UTF-8
related encodings. Use it for `CharsetUtils.toUtf8Bytes()`
and the JNI `GetStringUTFChars()`. Do not use it yet for
the internal `ConvertUtf16ToModifiedUtf8()` which shall be
switched to actual Modified UTF-8 in a separate change.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: atest CtsLibcoreTestCases:libcore.java.lang.StringTest
Bug: 192935764
Change-Id: Id3ec3a0bc2638becdf4181d9c2b6794c91a75314
5 files changed