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
diff --git a/libicu/libicu.map.txt b/libicu/libicu.map.txt
new file mode 100644
index 0000000..8e46abb
--- /dev/null
+++ b/libicu/libicu.map.txt
@@ -0,0 +1,164 @@
+# GENERATED SOURCE. DO NOT MODIFY.
+# Run external/icu/tools/icu4c_srcgen/generate_libandroidicu.py to regenerate
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+LIBICU_31 { # introduced=31
+ global:
+ u_charAge;
+ u_charDigitValue;
+ u_charDirection;
+ u_charFromName;
+ u_charMirror;
+ u_charName;
+ u_charType;
+ u_countChar32;
+ u_digit;
+ u_enumCharNames;
+ u_enumCharTypes;
+ u_errorName;
+ u_foldCase;
+ u_forDigit;
+ u_getBidiPairedBracket;
+ u_getCombiningClass;
+ u_getIntPropertyMaxValue;
+ u_getIntPropertyMinValue;
+ u_getIntPropertyValue;
+ u_getNumericValue;
+ u_getPropertyEnum;
+ u_getPropertyName;
+ u_getPropertyValueEnum;
+ u_getPropertyValueName;
+ u_getUnicodeVersion;
+ u_getVersion;
+ u_hasBinaryProperty;
+ u_isIDIgnorable;
+ u_isIDPart;
+ u_isIDStart;
+ u_isISOControl;
+ u_isJavaIDPart;
+ u_isJavaIDStart;
+ u_isJavaSpaceChar;
+ u_isMirrored;
+ u_isUAlphabetic;
+ u_isULowercase;
+ u_isUUppercase;
+ u_isUWhiteSpace;
+ u_isWhitespace;
+ u_isalnum;
+ u_isalpha;
+ u_isbase;
+ u_isblank;
+ u_iscntrl;
+ u_isdefined;
+ u_isdigit;
+ u_isgraph;
+ u_islower;
+ u_isprint;
+ u_ispunct;
+ u_isspace;
+ u_istitle;
+ u_isupper;
+ u_isxdigit;
+ u_memcasecmp;
+ u_memchr;
+ u_memchr32;
+ u_memcmp;
+ u_memcmpCodePointOrder;
+ u_memcpy;
+ u_memmove;
+ u_memrchr;
+ u_memrchr32;
+ u_memset;
+ u_strCaseCompare;
+ u_strCompare;
+ u_strFindFirst;
+ u_strFindLast;
+ u_strFoldCase;
+ u_strFromUTF32;
+ u_strFromUTF32WithSub;
+ u_strFromUTF8;
+ u_strFromUTF8Lenient;
+ u_strFromUTF8WithSub;
+ u_strHasMoreChar32Than;
+ u_strToLower;
+ u_strToTitle;
+ u_strToUTF32;
+ u_strToUTF32WithSub;
+ u_strToUTF8;
+ u_strToUTF8WithSub;
+ u_strToUpper;
+ u_strcasecmp;
+ u_strcat;
+ u_strchr;
+ u_strchr32;
+ u_strcmp;
+ u_strcmpCodePointOrder;
+ u_strcpy;
+ u_strcspn;
+ u_strlen;
+ u_strncasecmp;
+ u_strncat;
+ u_strncmp;
+ u_strncmpCodePointOrder;
+ u_strncpy;
+ u_strpbrk;
+ u_strrchr;
+ u_strrchr32;
+ u_strrstr;
+ u_strspn;
+ u_strstr;
+ u_strtok_r;
+ u_tolower;
+ u_totitle;
+ u_toupper;
+ u_versionToString;
+ uloc_acceptLanguage;
+ uloc_addLikelySubtags;
+ uloc_canonicalize;
+ uloc_countAvailable;
+ uloc_forLanguageTag;
+ uloc_getAvailable;
+ uloc_getBaseName;
+ uloc_getCharacterOrientation;
+ uloc_getCountry;
+ uloc_getDisplayCountry;
+ uloc_getDisplayKeyword;
+ uloc_getDisplayKeywordValue;
+ uloc_getDisplayLanguage;
+ uloc_getDisplayName;
+ uloc_getDisplayScript;
+ uloc_getDisplayVariant;
+ uloc_getISO3Country;
+ uloc_getISO3Language;
+ uloc_getISOCountries;
+ uloc_getISOLanguages;
+ uloc_getKeywordValue;
+ uloc_getLanguage;
+ uloc_getLineOrientation;
+ uloc_getName;
+ uloc_getScript;
+ uloc_getVariant;
+ uloc_isRightToLeft;
+ uloc_minimizeSubtags;
+ uloc_openKeywords;
+ uloc_setKeywordValue;
+ uloc_toLanguageTag;
+ uloc_toLegacyKey;
+ uloc_toLegacyType;
+ uloc_toUnicodeLocaleKey;
+ uloc_toUnicodeLocaleType;
+ local:
+ *;
+};
\ No newline at end of file