UI dock mode support from 4.1 and lower

Change-Id: I659bf5ae3de7b1ba46a09eac854fd103b29da2a8
Revert "use utf8_length() instead of local function, isValidUtf8()"

This reverts commit 1a8b6c29aaa5a1591097daca0876808cc029cbda

Reason for revert: utf8_length handles a slightly different range than the checkjni code, so it's possible for a given string to pass the utf8_length check, but then fail the jni  check.

Change-Id: I81e15c95edd8f89782d8ad9025e68502b9340f22