Ignore target sdk version for the public namespace
This fixes the bug with using the libraries loaded
prior to android_set_target_sdk_version call.
Bug: http://b/22548808
Change-Id: I3ca2d367b0fa930a437bbb65f780834803d2ef0a
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp
index 83bd5cc..a56c771 100644
--- a/tests/dlext_test.cpp
+++ b/tests/dlext_test.cpp
@@ -707,6 +707,8 @@
dlclose(handle2);
}
+extern "C" void android_set_application_target_sdk_version(uint32_t target);
+
TEST(dlext, ns_isolated) {
static const char* root_lib = "libnstest_root_not_isolated.so";
std::string path = std::string("libc.so:libc++.so:libdl.so:libm.so:") + g_public_lib;
@@ -715,6 +717,8 @@
void* handle_public = dlopen((lib_path + "/public_namespace_libs/" + g_public_lib).c_str(), RTLD_NOW);
ASSERT_TRUE(handle_public != nullptr) << dlerror();
+ android_set_application_target_sdk_version(42U); // something > 23
+
ASSERT_TRUE(android_init_public_namespace(path.c_str())) << dlerror();
android_namespace_t* ns_not_isolated = android_create_namespace("private", nullptr, (lib_path + "/private_namespace_libs").c_str(), false);