Generate NDK headers and a new public library libicu
Symbol selection
- Expose the C symbols listed in libicu_export.txt
- Currently, we focus on exposing the symbols used by the ART mainline
module, and selecting a logical set of symbols from uchar.h,
ustring.h, uloc.h, uversion.h and utypes.h.
- The symbols are further filtered by checking whether we have
provided the same functionality in Java by ICU4J/ICU4C via
android.icu.*/java.* classes. The Java APIs are reviewed/proved useful
and it could reduce the maintenance cost since ICU4J mostly mirrors
the behavior of ICU4C and code changes/bug fixes are often applied
in both places. But here is the exception:
1. uloc_setDefault
Many places in libcore assumes Locale, ULocale, and ICU4C has the same
default locale. App setting a different default locale in ICU4C will
likely break things.
2. uloc_getDefault
We could expose uloc_getDefault, but since uloc_setDefault is not
exposed, uloc_getDefault becomes a shortcut function to obtain
the default Locale from ULocale.getDefault or even framework's
getResources().getConfiguration().locale. Such behavior is not
well-documented in uloc_getDefault. Also, without ART managed
runtime, e.g. standalone executable binary, the behavior could be
undefined. Probably Android should provide JNI interop method/other
C API to get the Android system default locale, but not via
uloc_getDefault.
- Other symbols excluded from the above headers
u_UCharsToChars
u_austrcpy
u_austrncpy
u_charsToUChars
u_getFC_NFKC_Closure
u_strCompareIter
u_strFromJavaModifiedUTF8WithSub
u_strFromWCS
u_strToJavaModifiedUTF8
u_strToWCS
u_uastrcpy
u_uastrncpy
u_unescape
u_unescapeAt
u_versionFromString
u_versionFromUString
uloc_acceptLanguageFromHTTP
uloc_getLCID
uloc_getLocaleForLCID
uloc_getParent
Symbol name
- libicu.so will have symbols for the exact same functionality
as the symbols in libicuuc.so and libicui18n.so,
e.g. u_isalpha and u_isalpha_66. The ICU-version-specific symbol
u_isalpha_66 is kept for app compatability because many app has been
using it even though the version number increases for every platform
release. u_isalpha is implemented as a shim of u_isalpha_66 in
shim.cpp.
Code transformation
- shim.cpp, libicu.map.txt and the headers are generated by running
the new generate_ndk.py script
Test
- CTS will be in the next CL.
Bug: 160350521
Test: ./generate_ndk.py
Test: m droid
Change-Id: I2eb6d5a0968c72bb6922221a971414de20273041
32 files changed