aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Stjernholm <mast@google.com>2024-02-02 14:31:08 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2024-02-02 14:31:08 +0000
commit05087690dc00b8156d90ad882df31196a0da173b (patch)
tree70dfa295d99133f67aa5009ef99a4326e7e0c51d
parent2830ad755ddea88771f7e8659ffee24c31709af7 (diff)
parentd762036b49779560ad9ef9e1d7b5d5eed53d2302 (diff)
downloadlibnativehelper-05087690dc00b8156d90ad882df31196a0da173b.tar.gz
Merge "Make libnativehelper_compat_libc++ public." into main am: d762036b49
Original change: https://android-review.googlesource.com/c/platform/libnativehelper/+/2943829 Change-Id: I85d4820d2f6c08d0264ec76440017b18178ac1f5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--Android.bp39
-rw-r--r--README.md55
2 files changed, 30 insertions, 64 deletions
diff --git a/Android.bp b/Android.bp
index 9f0152f..4eb6643 100644
--- a/Android.bp
+++ b/Android.bp
@@ -98,7 +98,7 @@ cc_library_headers {
"com.android.art",
"com.android.art.debug",
],
- min_sdk_version: "S",
+ min_sdk_version: "S", // 31
}
cc_library_shared {
@@ -132,7 +132,7 @@ cc_library_shared {
"com.android.art",
"com.android.art.debug",
],
- min_sdk_version: "S",
+ min_sdk_version: "S", // 31
}
// Lazy loading version of libnativehelper that can be used by code
@@ -159,56 +159,37 @@ cc_library_static {
},
}
-//
-// NDK-only build for the target (device), using libc++.
+// NDK-only build for the target (device).
// - Relies only on NDK exposed functionality.
// - This doesn't include JniInvocation.
-//
-
+// - This library is less than 20 KB - it is recommended that callers link it statically.
+// - Used to link libc++ (hence the name) but no longer does.
cc_library {
name: "libnativehelper_compat_libc++",
defaults: ["libnativehelper_defaults"],
- header_libs: ["jni_headers"],
+ host_supported: true,
cflags: ["-Werror"],
+
+ header_libs: ["jni_headers"],
export_header_lib_headers: ["jni_headers"],
export_include_dirs: [
"header_only_include",
"include",
],
- host_supported: true,
local_include_dirs: [
- "header_only_include",
"include_platform_header_only",
],
srcs: [
"ExpandableString.c",
"JNIHelp.c",
],
+
min_sdk_version: "29",
sdk_version: "19",
stl: "none",
apex_available: [
+ "//apex_available:anyapex",
"//apex_available:platform",
- "com.android.art",
- "com.android.art.debug",
- "com.android.extservices",
- "com.android.tethering",
- ],
- visibility: [
- "//art:__subpackages__",
- "//cts:__subpackages__",
- "//external/perfetto:__subpackages__",
- "//frameworks/base/packages/Connectivity/tests/integration:__pkg__",
- "//frameworks/base/packages/ConnectivityT:__subpackages__", // TODO: remove after code move
- "//frameworks/base/packages/Tethering:__subpackages__",
- "//frameworks/libs/net/common/native/bpfmapjni",
- "//frameworks/libs/net/common/native/bpfutiljni",
- "//libcore:__subpackages__",
- "//packages/modules/Connectivity:__subpackages__",
- "//packages/modules/ExtServices:__subpackages__",
- "//packages/modules/NetworkStack:__subpackages__",
- "//packages/modules/Permission/tests/cts:__subpackages__",
- ":__subpackages__",
],
}
diff --git a/README.md b/README.md
index d9cae65..4f495f3 100644
--- a/README.md
+++ b/README.md
@@ -13,9 +13,8 @@ benefits everyone with smaller downloads and a stable ABI.
### jni_headers
-This is a header library that contains provides the API represented in
-the JNI Specification 1.6. Any project in Android that depends on
-`jni.h` should depend on this.
+This is a header library that provides the API in the JNI Specification 1.6.
+Any project in Android that includes `jni.h` should depend on this.
See:
@@ -23,19 +22,17 @@ See:
### libnativehelper_header_only
-These headers provide utilities that defined entirely within the
-headers. There are scoped resource classes that make common JNI
-patterns of acquiring and releasing resources safer to use than the
-JNI specification equivalents. Examples being `ScopedLocalRef` to
-manage the lifetime of local references and `ScopedUtfChars` to manage
-the lifetime of Java strings in native code and provide access to utf8
-characters.
+Header library that provide utilities defined entirely within the headers. There
+are scoped resource classes that make common JNI patterns of acquiring and
+releasing resources safer to use than the JNI specification equivalents.
+Examples being `ScopedLocalRef` to manage the lifetime of local references and
+`ScopedUtfChars` to manage the lifetime of Java strings in native code and
+provide access to utf8 characters.
See:
* [nativehelper/nativehelper_utils.h](header_only_include/nativehelper/nativehelper_utils.h)
* [nativehelper/scoped_utf_chars.h](header_only_include/nativehelper/scoped_utf_chars.h)
-* [nativehelper/scoped_bytes.h](header_only_include/nativehelper/scoped_bytes.h)
* [nativehelper/scoped_string_chars.h](header_only_include/nativehelper/scoped_string_chars.h)
* [nativehelper/scoped_primitive_array.h](header_only_include/nativehelper/scoped_primitive_array.h)
* [nativehelper/scoped_local_ref.h](header_only_include/nativehelper/scoped_local_ref.h)
@@ -56,44 +53,32 @@ See:
### libnativehelper
-A shared library distributed in the ART module that provides helper
-routines built on Java APIs. This library depends on details that are
-private to libcore and use should be restricted to platform code and
-within the ART module.
-
-This library also contains the JNI invocation API from the JNI
-Specification and the glue that connects the ART runtime to the API
-implementation. The glue logic is platform only as it is used with the
-Zygote and the standalone dalvikvm.
+A shared library distributed in the ART module. It provides the JNI invocation
+API from the JNI Specification, which is part of the public NDK. It also
+contains the glue that connects the API implementation to the ART runtime, which
+is platform only and is used with the Zygote and the standalone dalvikvm.
See:
-* [nativehelper/JNIHelp.h](include/nativehelper/JNIHelp.h)
+
* [nativehelper/JniInvocation.h](include_platform/nativehelper/JniInvocation.h)
* [nativehelper/JNIPlatformHelp.h](include_platform/nativehelper/JNIPlatformHelp.h)
-* [nativehelper/ScopedBytes.h](include/nativehelper/ScopedBytes.h)
-* [nativehelper/ScopedUtfChars.h](include/nativehelper/ScopedUtfChars.h)
-* [nativehelper/ScopedLocalFrame.h](include/nativehelper/ScopedLocalFrame.h)
-* [nativehelper/ScopedLocalRef.h](include/nativehelper/ScopedLocalRef.h)
-* [nativehelper/ScopedPrimitiveArray.h](include/nativehelper/ScopedPrimitiveArray.h)
-* [nativehelper/ScopedStringChars.h](include/nativehelper/ScopedStringChars.h)
-* [nativehelper/toStringArray.h](include/nativehelper/toStringArray.h)
-* [nativehelper/Utils.h](include/nativehelper/Utils.h)
+* libnativehelper_compat_libc++ headers below
### libnativehelper_compat_libc++
-This shared and static library contains a subset of the helper
-routines in libnativehelper based on public Java API. This code can be
-statically linked as the Java APIs it depends on are considered
-stable. The name of this library is a misnomer since it contains no
-C++ code.
+This shared and static library contains a subset of the helper routines in
+libnativehelper based only on public stable JNI APIs. It gets distributed with
+the caller code and is preferrably linked statically since it is very thin (less
+than 20 KB). The name of this library is a misnomer since it contains no C++
+code.
See:
* [nativehelper/JNIHelp.h](include/nativehelper/JNIHelp.h)
-* [nativehelper/ScopedBytes.h](include/nativehelper/ScopedBytes.h)
* [nativehelper/ScopedUtfChars.h](include/nativehelper/ScopedUtfChars.h)
* [nativehelper/ScopedLocalFrame.h](include/nativehelper/ScopedLocalFrame.h)
* [nativehelper/ScopedLocalRef.h](include/nativehelper/ScopedLocalRef.h)
* [nativehelper/ScopedPrimitiveArray.h](include/nativehelper/ScopedPrimitiveArray.h)
* [nativehelper/ScopedStringChars.h](include/nativehelper/ScopedStringChars.h)
* [nativehelper/toStringArray.h](include/nativehelper/toStringArray.h)
+* [nativehelper/Utils.h](include/nativehelper/Utils.h)