summaryrefslogtreecommitdiff
path: root/libnativebridge/tests/NativeBridge7CriticalNative_lib.cpp
diff options
context:
space:
mode:
author dimitry <dimitry@google.com> 2024-03-27 11:55:07 +0100
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-04-05 13:26:56 +0000
commit5fe81fd246fe073c5d903a4cb50182fb7132a939 (patch)
tree9aafbad282304a2edfe6886166d82d2f79586214 /libnativebridge/tests/NativeBridge7CriticalNative_lib.cpp
parent4e6db6efb36ab9cb9a5990346e77d7976e1b3c66 (diff)
Add getTrampolineForFunctionPointer method to native bridge
Add a function to native bridge that generates trampolines for guest pointers and call it for native-bridged namespaces. Bug: http://b/330367443 Test: art/libnativebridge/tests/runtests.sh --skip-target Test: ./android-cts/tools/cts-tradefed run cts -m CtsJniTestCases Change-Id: I02cab5ea6c87cb4d5065033a4b6793eb57fe0f52
Diffstat (limited to 'libnativebridge/tests/NativeBridge7CriticalNative_lib.cpp')
-rw-r--r--libnativebridge/tests/NativeBridge7CriticalNative_lib.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/libnativebridge/tests/NativeBridge7CriticalNative_lib.cpp b/libnativebridge/tests/NativeBridge7CriticalNative_lib.cpp
index 6446182487..cfd0dc9fef 100644
--- a/libnativebridge/tests/NativeBridge7CriticalNative_lib.cpp
+++ b/libnativebridge/tests/NativeBridge7CriticalNative_lib.cpp
@@ -22,6 +22,9 @@ static bool g_legacy_get_trampoline_called = false;
static bool g_get_trampoline2_called = false;
static JNICallType g_jni_call_type = kJNICallTypeRegular;
+static bool g_get_trampoline_fn_ptr_called = false;
+static JNICallType g_fn_ptr_jni_call_type = kJNICallTypeRegular;
+
void ResetTrampolineCalledState() {
g_legacy_get_trampoline_called = false;
g_get_trampoline2_called = false;
@@ -41,4 +44,13 @@ bool IsGetTrampoline2Called() { return g_get_trampoline2_called; }
JNICallType GetTrampoline2JNICallType() { return g_jni_call_type; }
+void SetGetTrampolineFnPtrCalled(JNICallType jni_call_type) {
+ g_get_trampoline_fn_ptr_called = true;
+ g_fn_ptr_jni_call_type = jni_call_type;
+}
+
+bool IsGetTrampolineFnPtrCalled() { return g_get_trampoline_fn_ptr_called; }
+
+JNICallType GetTrampolineFnPtrJNICallType() { return g_fn_ptr_jni_call_type; }
+
} // namespace android