summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libnativebridge/include/nativebridge/native_bridge.h31
-rw-r--r--libnativebridge/native_bridge.cc13
-rw-r--r--libnativebridge/tests/Android.bp1
-rw-r--r--libnativebridge/tests/NativeBridge3InitAnonymousNamespace_test.cpp37
-rw-r--r--libnativebridge/tests/NativeBridgeTestCase3.cpp10
-rw-r--r--libnativebridge/tests/NativeBridgeTestCase6.cpp10
-rw-r--r--libnativebridge/tests/NativeBridgeTestCase7.cpp10
-rw-r--r--test/115-native-bridge/nativebridge.cc45
8 files changed, 30 insertions, 127 deletions
diff --git a/libnativebridge/include/nativebridge/native_bridge.h b/libnativebridge/include/nativebridge/native_bridge.h
index b2e4d2219b..491521642c 100644
--- a/libnativebridge/include/nativebridge/native_bridge.h
+++ b/libnativebridge/include/nativebridge/native_bridge.h
@@ -146,18 +146,6 @@ struct native_bridge_namespace_t;
// Use NativeBridgeIsSupported() instead in non-namespace scenario.
bool NativeBridgeIsPathSupported(const char* path);
-// Initializes anonymous namespace.
-// NativeBridge's peer of android_init_anonymous_namespace() of dynamic linker.
-//
-// The anonymous namespace is used in the case when a NativeBridge implementation
-// cannot identify the caller of dlopen/dlsym which happens for the code not loaded
-// by dynamic linker; for example calls from the mono-compiled code.
-//
-// Starting with v3, NativeBridge has two scenarios: with/without namespace.
-// Should not use in non-namespace scenario.
-bool NativeBridgeInitAnonymousNamespace(const char* public_ns_sonames,
- const char* anon_ns_library_path);
-
// Create new namespace in which native libraries will be loaded.
// NativeBridge's peer of android_create_namespace() of dynamic linker.
//
@@ -314,23 +302,8 @@ struct NativeBridgeCallbacks {
// Use isSupported instead in non-namespace scenario.
bool (*isPathSupported)(const char* library_path);
- // Initializes anonymous namespace at native bridge side.
- // NativeBridge's peer of android_init_anonymous_namespace() of dynamic linker.
- //
- // The anonymous namespace is used in the case when a NativeBridge implementation
- // cannot identify the caller of dlopen/dlsym which happens for the code not loaded
- // by dynamic linker; for example calls from the mono-compiled code.
- //
- // Parameters:
- // public_ns_sonames [IN] the name of "public" libraries.
- // anon_ns_library_path [IN] the library search path of (anonymous) namespace.
- // Returns:
- // true if the pass is ok.
- // Otherwise, false.
- //
- // Starting with v3, NativeBridge has two scenarios: with/without namespace.
- // Should not use in non-namespace scenario.
- bool (*initAnonymousNamespace)(const char* public_ns_sonames, const char* anon_ns_library_path);
+ // No longer used.
+ bool (*unused_initAnonymousNamespace)(const char*, const char*);
// Create new namespace in which native libraries will be loaded.
// NativeBridge's peer of android_create_namespace() of dynamic linker.
diff --git a/libnativebridge/native_bridge.cc b/libnativebridge/native_bridge.cc
index 4ead5ada2d..4461f79919 100644
--- a/libnativebridge/native_bridge.cc
+++ b/libnativebridge/native_bridge.cc
@@ -668,19 +668,6 @@ bool NativeBridgeIsPathSupported(const char* path) {
return false;
}
-bool NativeBridgeInitAnonymousNamespace(const char* public_ns_sonames,
- const char* anon_ns_library_path) {
- if (NativeBridgeInitialized()) {
- if (isCompatibleWith(NAMESPACE_VERSION)) {
- return callbacks->initAnonymousNamespace(public_ns_sonames, anon_ns_library_path);
- } else {
- ALOGE("not compatible with version %d, cannot init namespace", NAMESPACE_VERSION);
- }
- }
-
- return false;
-}
-
native_bridge_namespace_t* NativeBridgeCreateNamespace(const char* name,
const char* ld_library_path,
const char* default_library_path,
diff --git a/libnativebridge/tests/Android.bp b/libnativebridge/tests/Android.bp
index 100e79545a..93ef6feded 100644
--- a/libnativebridge/tests/Android.bp
+++ b/libnativebridge/tests/Android.bp
@@ -126,7 +126,6 @@ cc_test {
"NativeBridge3UnloadLibrary_test.cpp",
"NativeBridge3GetError_test.cpp",
"NativeBridge3IsPathSupported_test.cpp",
- "NativeBridge3InitAnonymousNamespace_test.cpp",
"NativeBridge3CreateNamespace_test.cpp",
"NativeBridge3LoadLibraryExt_test.cpp",
"NativeBridge6PreZygoteFork_test.cpp",
diff --git a/libnativebridge/tests/NativeBridge3InitAnonymousNamespace_test.cpp b/libnativebridge/tests/NativeBridge3InitAnonymousNamespace_test.cpp
deleted file mode 100644
index 5267bb2244..0000000000
--- a/libnativebridge/tests/NativeBridge3InitAnonymousNamespace_test.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-#include "NativeBridgeTest.h"
-
-namespace android {
-
-TEST_F(NativeBridgeTest, V3_InitAnonymousNamespace) {
- // Init
- ASSERT_TRUE(LoadNativeBridge(kNativeBridgeLibrary3, nullptr));
- ASSERT_TRUE(NativeBridgeAvailable());
- ASSERT_TRUE(PreInitializeNativeBridge(AppDataDir(), "isa"));
- ASSERT_TRUE(NativeBridgeAvailable());
- ASSERT_TRUE(InitializeNativeBridge(nullptr, nullptr));
- ASSERT_TRUE(NativeBridgeAvailable());
-
- ASSERT_EQ(3U, NativeBridgeGetVersion());
- ASSERT_EQ(true, NativeBridgeInitAnonymousNamespace(nullptr, nullptr));
-
- // Clean-up code_cache
- ASSERT_EQ(0, rmdir(CodeCache()));
-}
-
-} // namespace android
diff --git a/libnativebridge/tests/NativeBridgeTestCase3.cpp b/libnativebridge/tests/NativeBridgeTestCase3.cpp
index c5bd032cef..398d762ff6 100644
--- a/libnativebridge/tests/NativeBridgeTestCase3.cpp
+++ b/libnativebridge/tests/NativeBridgeTestCase3.cpp
@@ -76,11 +76,6 @@ extern "C" bool native_bridge3_isPathSupported(const char* /* path */) {
return true;
}
-extern "C" bool native_bridge3_initAnonymousNamespace(const char* /* public_ns_sonames */,
- const char* /* anon_ns_library_path */) {
- return true;
-}
-
extern "C" android::native_bridge_namespace_t*
native_bridge3_createNamespace(const char* /* name */,
const char* /* ld_library_path */,
@@ -118,7 +113,8 @@ android::NativeBridgeCallbacks NativeBridgeItf{
.unloadLibrary = &native_bridge3_unloadLibrary,
.getError = &native_bridge3_getError,
.isPathSupported = &native_bridge3_isPathSupported,
- .initAnonymousNamespace = &native_bridge3_initAnonymousNamespace,
+ .unused_initAnonymousNamespace = nullptr,
.createNamespace = &native_bridge3_createNamespace,
.linkNamespaces = &native_bridge3_linkNamespaces,
- .loadLibraryExt = &native_bridge3_loadLibraryExt};
+ .loadLibraryExt = &native_bridge3_loadLibraryExt,
+};
diff --git a/libnativebridge/tests/NativeBridgeTestCase6.cpp b/libnativebridge/tests/NativeBridgeTestCase6.cpp
index 2b9fba51eb..351a7ea643 100644
--- a/libnativebridge/tests/NativeBridgeTestCase6.cpp
+++ b/libnativebridge/tests/NativeBridgeTestCase6.cpp
@@ -67,11 +67,6 @@ extern "C" bool native_bridge6_isPathSupported(const char* /* path */) {
return true;
}
-extern "C" bool native_bridge6_initAnonymousNamespace(const char* /* public_ns_sonames */,
- const char* /* anon_ns_library_path */) {
- return true;
-}
-
extern "C" android::native_bridge_namespace_t*
native_bridge6_createNamespace(const char* /* name */,
const char* /* ld_library_path */,
@@ -121,7 +116,7 @@ android::NativeBridgeCallbacks NativeBridgeItf{
.unloadLibrary = &native_bridge6_unloadLibrary,
.getError = &native_bridge6_getError,
.isPathSupported = &native_bridge6_isPathSupported,
- .initAnonymousNamespace = &native_bridge6_initAnonymousNamespace,
+ .unused_initAnonymousNamespace = nullptr,
.createNamespace = &native_bridge6_createNamespace,
.linkNamespaces = &native_bridge6_linkNamespaces,
.loadLibraryExt = &native_bridge6_loadLibraryExt,
@@ -130,4 +125,5 @@ android::NativeBridgeCallbacks NativeBridgeItf{
// v5
&native_bridge6_getExportedNamespace,
// v6
- &native_bridge6_preZygoteFork};
+ &native_bridge6_preZygoteFork,
+};
diff --git a/libnativebridge/tests/NativeBridgeTestCase7.cpp b/libnativebridge/tests/NativeBridgeTestCase7.cpp
index f84930c71b..6f4c5e4f8b 100644
--- a/libnativebridge/tests/NativeBridgeTestCase7.cpp
+++ b/libnativebridge/tests/NativeBridgeTestCase7.cpp
@@ -79,11 +79,6 @@ extern "C" const char* native_bridge7_getError() { return nullptr; }
extern "C" bool native_bridge7_isPathSupported(const char* /* path */) { return true; }
-extern "C" bool native_bridge7_initAnonymousNamespace(const char* /* public_ns_sonames */,
- const char* /* anon_ns_library_path */) {
- return true;
-}
-
extern "C" android::native_bridge_namespace_t* native_bridge7_createNamespace(
const char* /* name */,
const char* /* ld_library_path */,
@@ -132,7 +127,7 @@ android::NativeBridgeCallbacks NativeBridgeItf{
.unloadLibrary = &native_bridge7_unloadLibrary,
.getError = &native_bridge7_getError,
.isPathSupported = &native_bridge7_isPathSupported,
- .initAnonymousNamespace = &native_bridge7_initAnonymousNamespace,
+ .unused_initAnonymousNamespace = nullptr,
.createNamespace = &native_bridge7_createNamespace,
.linkNamespaces = &native_bridge7_linkNamespaces,
.loadLibraryExt = &native_bridge7_loadLibraryExt,
@@ -144,4 +139,5 @@ android::NativeBridgeCallbacks NativeBridgeItf{
&native_bridge7_preZygoteFork,
// v7
&native_bridge7_getTrampoline2,
- &native_bridge7_getTrampolineForFunctionPointer};
+ &native_bridge7_getTrampolineForFunctionPointer,
+};
diff --git a/test/115-native-bridge/nativebridge.cc b/test/115-native-bridge/nativebridge.cc
index be3a2011d9..1d89997711 100644
--- a/test/115-native-bridge/nativebridge.cc
+++ b/test/115-native-bridge/nativebridge.cc
@@ -628,13 +628,6 @@ extern "C" bool native_bridge_isPathSupported([[maybe_unused]] const char* libra
return false;
}
-extern "C" bool native_bridge_initAnonymousNamespace(
- [[maybe_unused]] const char* public_ns_sonames,
- [[maybe_unused]] const char* anon_ns_library_path) {
- printf("Initializing anonymous namespace in native bridge.\n");
- return false;
-}
-
extern "C" android::native_bridge_namespace_t*
native_bridge_createNamespace([[maybe_unused]] const char* name,
[[maybe_unused]] const char* ld_library_path,
@@ -664,23 +657,23 @@ extern "C" void* native_bridge_loadLibraryExt(
// "NativeBridgeItf" is effectively an API (it is the name of the symbol that will be loaded
// by the native bridge library).
-android::NativeBridgeCallbacks NativeBridgeItf {
- // v1
- .version = 3,
- .initialize = &native_bridge_initialize,
- .loadLibrary = &native_bridge_loadLibrary,
- .getTrampoline = &native_bridge_getTrampoline,
- .isSupported = &native_bridge_isSupported,
- .getAppEnv = &native_bridge_getAppEnv,
- // v2
- .isCompatibleWith = &native_bridge_isCompatibleWith,
- .getSignalHandler = &native_bridge_getSignalHandler,
- // v3
- .unloadLibrary = &native_bridge_unloadLibrary,
- .getError = &native_bridge_getError,
- .isPathSupported = &native_bridge_isPathSupported,
- .initAnonymousNamespace = &native_bridge_initAnonymousNamespace,
- .createNamespace = &native_bridge_createNamespace,
- .linkNamespaces = &native_bridge_linkNamespaces,
- .loadLibraryExt = &native_bridge_loadLibraryExt
+android::NativeBridgeCallbacks NativeBridgeItf{
+ // v1
+ .version = 3,
+ .initialize = &native_bridge_initialize,
+ .loadLibrary = &native_bridge_loadLibrary,
+ .getTrampoline = &native_bridge_getTrampoline,
+ .isSupported = &native_bridge_isSupported,
+ .getAppEnv = &native_bridge_getAppEnv,
+ // v2
+ .isCompatibleWith = &native_bridge_isCompatibleWith,
+ .getSignalHandler = &native_bridge_getSignalHandler,
+ // v3
+ .unloadLibrary = &native_bridge_unloadLibrary,
+ .getError = &native_bridge_getError,
+ .isPathSupported = &native_bridge_isPathSupported,
+ .unused_initAnonymousNamespace = nullptr,
+ .createNamespace = &native_bridge_createNamespace,
+ .linkNamespaces = &native_bridge_linkNamespaces,
+ .loadLibraryExt = &native_bridge_loadLibraryExt,
};