Allow different namespace types for different classloaders
An app should be able to make cross-arch calls to different apps
via other app's Context.getClassLoader()
Bug: 32542970
Test: Boot fugu. Check that there are no linker-namespace
related errors in the log.
Change-Id: I1593f4688bcde0121a5e24a707441a4935fa7dc4
diff --git a/libnativebridge/native_bridge.cc b/libnativebridge/native_bridge.cc
index 43e6c0a..eafc53d 100644
--- a/libnativebridge/native_bridge.cc
+++ b/libnativebridge/native_bridge.cc
@@ -551,15 +551,15 @@
return -1;
}
-char* NativeBridgeGetError() {
+const char* NativeBridgeGetError() {
if (NativeBridgeInitialized()) {
if (isCompatibleWith(NAMESPACE_VERSION)) {
return callbacks->getError();
} else {
- ALOGE("not compatible with version %d, cannot get message", NAMESPACE_VERSION);
+ return "native bridge implementation is not compatible with version 3, cannot get message";
}
}
- return nullptr;
+ return "native bridge is not initialized";
}
bool NativeBridgeIsPathSupported(const char* path) {
diff --git a/libnativebridge/tests/DummyNativeBridge3.cpp b/libnativebridge/tests/DummyNativeBridge3.cpp
index c538fa0..13fce85 100644
--- a/libnativebridge/tests/DummyNativeBridge3.cpp
+++ b/libnativebridge/tests/DummyNativeBridge3.cpp
@@ -68,7 +68,7 @@
return 0;
}
-extern "C" char* native_bridge3_getError() {
+extern "C" const char* native_bridge3_getError() {
return nullptr;
}