Don't crash in TextUtil.concat() with paragraph spans

This switches TextUtils.concat() to use SpannableStringBuilder
if there are any spans in the input strings. As a result, we can
avoid crashes when concatenating two CharSequences can result in
paragraph spans that now don't happen to be at paragraph boundaries.

Also document the exact behavior of the method for edge cases based
on the previous implementation.

Change-Id: I9caffbe95ed729b9c10d63a9e7d22b1e8c7185a3
Fixes: 28271770
Test: CTS tests added and old CTS tests continue to pass.
Test: cts-tradefed run cts-dev --module CtsTextTestCases --test android.text.cts.TextUtilsTest
1 file changed