Fix stack overflow in libcore.java.lang.StringTest#testFormat_invalidLocale

The infinite rescursion happens in this loop, i.e. LocaleData ->
Compatilibity -> String.format() -> LocaleData. Point fixing can
probably fix the issue now, but a future change could cause an issue
again. Also, there is no easy and reliable way to write a regression test because
various caches in libcore and the compatiblity framework could hide the
issue from the test, but could possibly be triggered in production.

This CL changes from using compatability framework to plain
targetSdkVersion. Facilities, e.g. logging, overrides, provided
by the compatability framework are lost, but it avoids such app crash.

Bug: 160912695
Bug: 159514442
Test: atest CtsLibcoreTestCases:libcore.java.lang.StringTest
Test: atest CtsLibcoreTestCases
Change-Id: Id33ba5433050e17828239e6ea3b3a46766f268c7
2 files changed