diff options
author | Dimitry Ivanov <dimitry@google.com> | 2017-05-01 15:12:49 -0700 |
---|---|---|
committer | Dimitry Ivanov <dimitry@google.com> | 2017-05-25 10:30:55 -0700 |
commit | 882cad2d87fc003ced61ddf9d68f8810ec8c4b3f (patch) | |
tree | e8c320809a6b684cfaa5bb1174e6b514b4763a78 /libnativebridge | |
parent | 102eb90837d1e30fe9603b046e351c28cbaebbd9 (diff) | |
download | core-882cad2d87fc003ced61ddf9d68f8810ec8c4b3f.tar.gz core-882cad2d87fc003ced61ddf9d68f8810ec8c4b3f.tar.bz2 core-882cad2d87fc003ced61ddf9d68f8810ec8c4b3f.zip |
Load vendor public libraries to sphal namespace
Load vendor public libraries to sphal namespace
if it exists - preserve old behavior of loading
these libraries to default namespace if sphal
namespace is not present on the device.
Bug: http://b/37410104
Test: cts-tradefed run singleCommand cts --skip-preconditions -m CtsJniTestCases
on marlin (with enabled sphal configuration) and on angler where ld.config.txt
is not present.
Change-Id: Iaa3fa437ba2900acc2e5b9c78039fe1553e4c9dd
(cherry picked from commit af0264bbe9f5e1228eb8fb486fa3d0d8e6e8605e)
Diffstat (limited to 'libnativebridge')
-rw-r--r-- | libnativebridge/native_bridge.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/libnativebridge/native_bridge.cc b/libnativebridge/native_bridge.cc index 050373ae5..02b4fe7ad 100644 --- a/libnativebridge/native_bridge.cc +++ b/libnativebridge/native_bridge.cc @@ -85,12 +85,14 @@ static NativeBridgeState state = NativeBridgeState::kNotSetup; // Nativebridge implementation. // Used by isCompatibleWith() which is introduced in v2. enum NativeBridgeImplementationVersion { - // first version, not used. - DEFAULT_VERSION = 1, - // The version which signal semantic is introduced. - SIGNAL_VERSION = 2, - // The version which namespace semantic is introduced. - NAMESPACE_VERSION = 3, + // first version, not used. + DEFAULT_VERSION = 1, + // The version which signal semantic is introduced. + SIGNAL_VERSION = 2, + // The version which namespace semantic is introduced. + NAMESPACE_VERSION = 3, + // The version with vendor namespaces + VENDOR_NAMESPACE_VERSION = 4, }; // Whether we had an error at some point. @@ -621,6 +623,14 @@ bool NativeBridgeLinkNamespaces(native_bridge_namespace_t* from, native_bridge_n return false; } +native_bridge_namespace_t* NativeBridgeGetVendorNamespace() { + if (!NativeBridgeInitialized() || !isCompatibleWith(VENDOR_NAMESPACE_VERSION)) { + return nullptr; + } + + return callbacks->getVendorNamespace(); +} + void* NativeBridgeLoadLibraryExt(const char* libpath, int flag, native_bridge_namespace_t* ns) { if (NativeBridgeInitialized()) { if (isCompatibleWith(NAMESPACE_VERSION)) { |