Merge "libvndksupport: Add android_is_in_vendor_process()"
This commit is contained in:
commit
4f5625d9c7
3 changed files with 22 additions and 0 deletions
|
|
@ -20,6 +20,16 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns whether the current process is a vendor process.
|
||||||
|
*
|
||||||
|
* Note that this is only checking what process is running and has nothing to
|
||||||
|
* do with what namespace the caller is loaded at. For example, a VNDK-SP
|
||||||
|
* library loaded by SP-HAL calling this function may still get a 'false',
|
||||||
|
* because it is running in a system process.
|
||||||
|
*/
|
||||||
|
int android_is_in_vendor_process();
|
||||||
|
|
||||||
void* android_load_sphal_library(const char* name, int flag);
|
void* android_load_sphal_library(const char* name, int flag);
|
||||||
|
|
||||||
int android_unload_sphal_library(void* handle);
|
int android_unload_sphal_library(void* handle);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
LIBVNDKSUPPORT {
|
LIBVNDKSUPPORT {
|
||||||
global:
|
global:
|
||||||
|
android_is_in_vendor_process; # vndk apex
|
||||||
android_load_sphal_library; # vndk apex
|
android_load_sphal_library; # vndk apex
|
||||||
android_unload_sphal_library; # vndk apex
|
android_unload_sphal_library; # vndk apex
|
||||||
local:
|
local:
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,17 @@ static struct android_namespace_t* get_vendor_namespace() {
|
||||||
return vendor_namespace;
|
return vendor_namespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int android_is_in_vendor_process() {
|
||||||
|
if (android_get_exported_namespace == NULL) {
|
||||||
|
ALOGD("android_get_exported_namespace() not available. Assuming system process.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In vendor process, 'vndk' namespace is not visible, whereas in system
|
||||||
|
// process, it is.
|
||||||
|
return android_get_exported_namespace("vndk") == NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void* android_load_sphal_library(const char* name, int flag) {
|
void* android_load_sphal_library(const char* name, int flag) {
|
||||||
struct android_namespace_t* vendor_namespace = get_vendor_namespace();
|
struct android_namespace_t* vendor_namespace = get_vendor_namespace();
|
||||||
if (vendor_namespace != NULL) {
|
if (vendor_namespace != NULL) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue