diff -Nru libhybris-0.1.0+git20151016+6d424c9/debian/changelog libhybris-0.1.0+git20151016+6d424c9/debian/changelog --- libhybris-0.1.0+git20151016+6d424c9/debian/changelog 2016-06-22 11:32:38.000000000 +0000 +++ libhybris-0.1.0+git20151016+6d424c9/debian/changelog 2016-08-10 06:28:10.000000000 +0000 @@ -1,4 +1,49 @@ -libhybris (0.1.0+git20151016+6d424c9-0ubuntu18~overlay1) vivid; urgency=medium +libhybris (0.1.0+git20151016+6d424c9-0ubuntu22~vivid1) vivid; urgency=medium + + * Backport to vivid stable overlay PPA + + -- Alfonso Sanchez-Beato (email Canonical) Wed, 10 Aug 2016 08:24:48 +0200 + +libhybris (0.1.0+git20151016+6d424c9-0ubuntu22~xenial1) xenial; urgency=medium + + [ You-Sheng Yang ] + * linker: disable linker probing when unavailable + * linker: remove /system/lib prefix from lib paths + * configure: use lib64 for DEFAULT_HYBRIS_LD_LIBRARY_PATH on arm64 + * compat: build arm64 flavor when available + + -- Simon Fels Fri, 05 Aug 2016 18:47:48 +0200 + +libhybris (0.1.0+git20151016+6d424c9-0ubuntu21) yakkety; urgency=medium + + [ Alfonso Sanchez-Beato ] + * compat: media: add bool macro definition + + -- Simon Fels Wed, 13 Jul 2016 08:35:49 +0200 + +libhybris (0.1.0+git20151016+6d424c9-0ubuntu20) yakkety; urgency=medium + + [ Alfonso Sanchez-Beato ] + * hybris: common: remove hooks for signal handling + + [ Simon Fels ] + * hybris: wifi: add new API method to send driver command + + -- Simon Fels Thu, 07 Jul 2016 10:40:38 +0200 + +libhybris (0.1.0+git20151016+6d424c9-0ubuntu19) yakkety; urgency=medium + + [ Bin Li ] + * hybris: common: Add hooks to support scandir + + [ Simon Fels ] + * hybris: common: remove old and unused gb and ics linkers + * hybris: common: mm: include strlcat/strlcpy to avoid linke time issues + * hybris: common: mm: drop unneeded compile time definitions + + -- Simon Fels Wed, 29 Jun 2016 17:41:10 +0200 + +libhybris (0.1.0+git20151016+6d424c9-0ubuntu18) yakkety; urgency=medium [ Boleslaw Tokarski ] * [properties] An off-by-one error in prop handling diff -Nru libhybris-0.1.0+git20151016+6d424c9/debian/patches/debian-changes libhybris-0.1.0+git20151016+6d424c9/debian/patches/debian-changes --- libhybris-0.1.0+git20151016+6d424c9/debian/patches/debian-changes 2016-06-22 11:32:41.000000000 +0000 +++ libhybris-0.1.0+git20151016+6d424c9/debian/patches/debian-changes 2016-08-10 06:28:18.000000000 +0000 @@ -30,23 +30,27 @@ HYBRIS_PATH := $(LOCAL_PATH)/../../hybris -@@ -7,6 +8,7 @@ LOCAL_SRC_FILES := camera_compatibility_ +@@ -7,6 +8,9 @@ LOCAL_SRC_FILES := camera_compatibility_ LOCAL_MODULE := libcamera_compat_layer LOCAL_MODULE_TAGS := optional -+LOCAL_32_BIT_ONLY := true ++ifneq ($(strip $(BOARD_HAS_64_BIT_MEDIA_SERVICE)),true) ++ LOCAL_32_BIT_ONLY := true ++endif LOCAL_C_INCLUDES := \ $(HYBRIS_PATH)/include -@@ -30,6 +32,7 @@ LOCAL_SRC_FILES := direct_camera_test.cp +@@ -30,6 +34,9 @@ LOCAL_SRC_FILES := direct_camera_test.cp LOCAL_MODULE := direct_camera_test LOCAL_MODULE_TAGS := optional -+LOCAL_32_BIT_ONLY := true ++ifneq ($(strip $(BOARD_HAS_64_BIT_MEDIA_SERVICE)),true) ++ LOCAL_32_BIT_ONLY := true ++endif LOCAL_C_INCLUDES := \ $(HYBRIS_PATH)/include \ -@@ -43,6 +46,7 @@ LOCAL_SHARED_LIBRARIES := \ +@@ -43,6 +50,7 @@ LOCAL_SHARED_LIBRARIES := \ libis_compat_layer \ libsf_compat_layer \ libcamera_compat_layer \ @@ -1291,15 +1295,17 @@ HYBRIS_PATH := $(LOCAL_PATH)/../../hybris -@@ -9,6 +10,7 @@ LOCAL_SRC_FILES:= input_compatibility_la +@@ -9,6 +10,9 @@ LOCAL_SRC_FILES:= input_compatibility_la LOCAL_MODULE:= libis_compat_layer LOCAL_MODULE_TAGS := optional -+LOCAL_32_BIT_ONLY := true ++ifneq ($(strip $(BOARD_HAS_64_BIT_MEDIA_SERVICE)),true) ++ LOCAL_32_BIT_ONLY := true ++endif LOCAL_SHARED_LIBRARIES := \ libinput \ -@@ -20,8 +22,24 @@ LOCAL_SHARED_LIBRARIES := \ +@@ -20,8 +24,24 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_C_INCLUDES := \ $(HYBRIS_PATH)/include \ @@ -1326,11 +1332,13 @@ include $(BUILD_SHARED_LIBRARY) -@@ -36,6 +54,7 @@ LOCAL_SRC_FILES:= \ +@@ -36,6 +56,9 @@ LOCAL_SRC_FILES:= \ LOCAL_MODULE:= direct_input_test LOCAL_MODULE_TAGS := optional -+LOCAL_32_BIT_ONLY := true ++ifneq ($(strip $(BOARD_HAS_64_BIT_MEDIA_SERVICE)),true) ++ LOCAL_32_BIT_ONLY := true ++endif LOCAL_C_INCLUDES := \ $(HYBRIS_PATH)/include \ @@ -1409,7 +1417,7 @@ int default_layer_for_touch_point_visualization; --- /dev/null +++ libhybris-0.1.0+git20151016+6d424c9/compat/media/Android.mk -@@ -0,0 +1,169 @@ +@@ -0,0 +1,179 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) +include $(LOCAL_PATH)/../Android.common.mk @@ -1446,7 +1454,9 @@ + +LOCAL_MODULE := camera_service + -+LOCAL_32_BIT_ONLY := true ++ifneq ($(strip $(BOARD_HAS_64_BIT_MEDIA_SERVICE)),true) ++ LOCAL_32_BIT_ONLY := true ++endif + +include $(BUILD_EXECUTABLE) + @@ -1490,7 +1500,9 @@ + +LOCAL_MODULE:= libmedia_compat_layer +LOCAL_MODULE_TAGS := optional -+LOCAL_32_BIT_ONLY := true ++ifneq ($(strip $(BOARD_HAS_64_BIT_MEDIA_SERVICE)),true) ++ LOCAL_32_BIT_ONLY := true ++endif + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ @@ -1538,7 +1550,9 @@ + $(TOP)/$(MTK_PATH_SOURCE)/frameworks/av/include +endif + -+LOCAL_32_BIT_ONLY := true ++ifneq ($(strip $(BOARD_HAS_64_BIT_MEDIA_SERVICE)),true) ++ LOCAL_32_BIT_ONLY := true ++endif + +include $(BUILD_SHARED_LIBRARY) + @@ -1552,7 +1566,9 @@ + +LOCAL_MODULE:= direct_media_test +LOCAL_MODULE_TAGS := optional -+LOCAL_32_BIT_ONLY := true ++ifneq ($(strip $(BOARD_HAS_64_BIT_MEDIA_SERVICE)),true) ++ LOCAL_32_BIT_ONLY := true ++endif + +LOCAL_C_INCLUDES := \ + $(HYBRIS_PATH)/include \ @@ -1576,7 +1592,9 @@ + libEGL \ + libGLESv2 + -+LOCAL_32_BIT_ONLY := true ++ifneq ($(strip $(BOARD_HAS_64_BIT_MEDIA_SERVICE)),true) ++ LOCAL_32_BIT_ONLY := true ++endif + +include $(BUILD_EXECUTABLE) --- /dev/null @@ -10730,19 +10748,23 @@ HYBRIS_PATH := $(LOCAL_PATH)/../../hybris -@@ -8,6 +9,7 @@ LOCAL_SRC_FILES:= \ +@@ -8,6 +9,9 @@ LOCAL_SRC_FILES:= \ LOCAL_MODULE:= libsf_compat_layer LOCAL_MODULE_TAGS := optional -+LOCAL_32_BIT_ONLY := true ++ifneq ($(strip $(BOARD_HAS_64_BIT_MEDIA_SERVICE)),true) ++ LOCAL_32_BIT_ONLY := true ++endif LOCAL_C_INCLUDES := \ $(HYBRIS_PATH)/include -@@ -30,6 +32,7 @@ LOCAL_SRC_FILES:= \ +@@ -30,6 +34,9 @@ LOCAL_SRC_FILES:= \ LOCAL_MODULE:= direct_sf_test LOCAL_MODULE_TAGS := optional -+LOCAL_32_BIT_ONLY := true ++ifneq ($(strip $(BOARD_HAS_64_BIT_MEDIA_SERVICE)),true) ++ LOCAL_32_BIT_ONLY := true ++endif LOCAL_C_INCLUDES := \ $(HYBRIS_PATH)/include @@ -10791,11 +10813,13 @@ HYBRIS_PATH := $(LOCAL_PATH)/../../hybris -@@ -8,6 +9,7 @@ LOCAL_SRC_FILES:= \ +@@ -8,6 +9,9 @@ LOCAL_SRC_FILES:= \ LOCAL_MODULE:= libui_compat_layer LOCAL_MODULE_TAGS := optional -+LOCAL_32_BIT_ONLY := true ++ifneq ($(strip $(BOARD_HAS_64_BIT_MEDIA_SERVICE)),true) ++ LOCAL_32_BIT_ONLY := true ++endif LOCAL_C_INCLUDES := \ $(HYBRIS_PATH)/include \ @@ -10852,7 +10876,13 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. -@@ -31,8 +31,11 @@ +@@ -26,13 +26,16 @@ + #include + #include + +-#define COMPAT_LIBRARY_PATH "/system/lib/libcamera_compat_layer.so" ++#define COMPAT_LIBRARY_PATH "libcamera_compat_layer.so" + HYBRIS_LIBRARY_INITIALIZE(camera, COMPAT_LIBRARY_PATH); HYBRIS_IMPLEMENT_FUNCTION0(camera, int, android_camera_get_number_of_devices); @@ -10939,7 +10969,7 @@ + struct CameraControl*, PreviewCallbackMode); --- libhybris-0.1.0+git20151016+6d424c9.orig/hybris/common/Makefile.am +++ libhybris-0.1.0+git20151016+6d424c9/hybris/common/Makefile.am -@@ -1,44 +1,45 @@ +@@ -1,44 +1,51 @@ lib_LTLIBRARIES = \ libhybris-common.la @@ -10996,6 +11026,12 @@ +endif +if WANT_UBUNTU_LINKER_OVERRIDES +libhybris_common_la_CPPFLAGS += -DUBUNTU_LINKER_OVERRIDES ++endif ++if !WANT_ARCH_ARM64 ++libhybris_common_la_CPPFLAGS += -DWANT_LINKER_JB ++endif ++if WANT_EXPERIMENTAL ++libhybris_common_la_CPPFLAGS += -DWANT_LINKER_MM endif libhybris_common_la_LDFLAGS = \ -ldl \ @@ -12425,14 +12461,20 @@ int res = readdir_r(dir, &entry_r, &result_r); if (res == 0) { -@@ -1255,87 +1694,538 @@ static int my_readdir_r(DIR *dir, struct +@@ -1255,89 +1694,612 @@ static int my_readdir_r(DIR *dir, struct return res; } -extern long my_sysconf(int name); -- ++static int _hybris_hook_alphasort(struct bionic_dirent **a, ++ struct bionic_dirent **b) ++{ ++ return strcoll((*a)->d_name, (*b)->d_name); ++} + -FP_ATTRIB static double my_strtod(const char *nptr, char **endptr) -+static inline void swap(void **a, void **b) ++static int _hybris_hook_versionsort(struct bionic_dirent **a, ++ struct bionic_dirent **b) { - if (locale_inited == 0) - { @@ -12440,24 +12482,25 @@ - locale_inited = 1; - } - return strtod_l(nptr, endptr, hybris_locale); -+ void *tmp = *a; -+ *a = *b; -+ *b = tmp; ++ return strverscmp((*a)->d_name, (*b)->d_name); } -extern int __cxa_atexit(void (*)(void*), void*, void*); -extern void __cxa_finalize(void * d); -+static int _hybris_hook_getaddrinfo(const char *hostname, const char *servname, -+ const struct addrinfo *hints, struct addrinfo **res) -+{ -+ struct addrinfo *fixed_hints = NULL; ++static struct bionic_dirent *_hybris_hook_scandirat(int fd, DIR *dirp, struct bionic_dirent ***namelist, ++ int (*filter)(const struct bionic_dirent *), ++ int (*compar)(const struct bionic_dirent **, const struct bionic_dirent **)) ++{ ++ struct dirent **namelist_r; ++ static struct bionic_dirent **result; ++ struct bionic_dirent *filter_r; -struct open_redirect { - const char *from; - const char *to; -}; -+ TRACE_HOOK("hostname '%s' servname '%s' hints %p res %p", -+ hostname, servname, hints, res); ++ int i = 0; ++ size_t nItems = 0; -struct open_redirect open_redirects[] = { - { "/dev/log/main", "/dev/log_main" }, @@ -12466,31 +12509,10 @@ - { "/dev/log/events", "/dev/log_events" }, - { NULL, NULL } -}; -+ if (hints) { -+ fixed_hints = (struct addrinfo*) malloc(sizeof(struct addrinfo)); -+ memcpy(fixed_hints, hints, sizeof(struct addrinfo)); -+ // fix bionic -> glibc missmatch -+ swap((void**)&(fixed_hints->ai_canonname), (void**)&(fixed_hints->ai_addr)); -+ } ++ TRACE_HOOK("dirp %p", dirp); -int my_open(const char *pathname, int flags, ...) -+ int result = getaddrinfo(hostname, servname, fixed_hints, res); -+ -+ if (fixed_hints) -+ free(fixed_hints); -+ -+ // fix bionic <- glibc missmatch -+ struct addrinfo *it = *res; -+ while (it) { -+ swap((void**) &(it->ai_canonname), (void**) &(it->ai_addr)); -+ it = it->ai_next; -+ } -+ -+ return result; -+} -+ -+static void _hybris_hook_freeaddrinfo(struct addrinfo *__ai) - { +-{ - va_list ap; - mode_t mode = 0; - const char *target_path = pathname; @@ -12511,20 +12533,11 @@ - mode = va_arg(ap, mode_t); - va_end(ap); - } -+ TRACE_HOOK("ai %p", __ai); -+ -+ if (__ai == NULL) -+ return; -+ -+ struct addrinfo *it = __ai; -+ while (it) { -+ swap((void**) &(it->ai_canonname), (void**) &(it->ai_addr)); -+ it = it->ai_next; -+ } ++ int res = scandirat(fd, dirp, &namelist_r, NULL, NULL); - return open(target_path, flags, mode); -+ freeaddrinfo(__ai); - } +-} ++ if (res != 0 && namelist_r != NULL) { -/** - * NOTE: Normally we don't have to wrap __system_property_get (libc.so) as it is only used @@ -12533,18 +12546,126 @@ - * Therefore we have to hook __system_property_get too and just replace it with the - * implementation of our internal property handling - */ -+extern long _hybris_map_sysconf(int name); ++ result = malloc(res * sizeof(struct bionic_dirent)); ++ if (!result) ++ return -1; -int my_system_property_get(const char *name, const char *value) -+long _hybris_hook_sysconf(int name) - { +-{ - return property_get(name, value, NULL); -+ TRACE_HOOK("name %d", name); ++ for (i = 0; i < res; i++) { ++ filter_r = malloc(sizeof(struct bionic_dirent)); ++ if (!filter_r) { ++ while (i-- > 0) ++ free(result[i]); ++ free(result); ++ return -1; ++ } ++ filter_r->d_ino = namelist_r[i]->d_ino; ++ filter_r->d_off = namelist_r[i]->d_off; ++ filter_r->d_reclen = namelist_r[i]->d_reclen; ++ filter_r->d_type = namelist_r[i]->d_type; + -+ return _hybris_map_sysconf(name); ++ strcpy(filter_r->d_name, namelist_r[i]->d_name); ++ filter_r->d_name[sizeof(namelist_r[i]->d_name) - 1] = '\0'; ++ ++ if (filter != NULL && !(*filter)(filter_r)) {//apply filter ++ free(filter_r); ++ continue; ++ } ++ ++ result[nItems++] = filter_r; ++ } ++ if (nItems && compar != NULL) ++ qsort(result, nItems, sizeof(struct bionic_dirent *), compar); ++ ++ *namelist = result; ++ } ++ ++ return res; } -static __thread void *tls_hooks[16]; ++static struct bionic_dirent *_hybris_hook_scandir(DIR *dirp, struct bionic_dirent ***namelist, ++ int (*filter)(const struct bionic_dirent *), ++ int (*compar)(const struct bionic_dirent **, const struct bionic_dirent **)) ++{ ++ return _hybris_hook_scandirat(AT_FDCWD, dirp, namelist, filter, compar); ++} + +-void *__get_tls_hooks() ++static inline void swap(void **a, void **b) + { +- return tls_hooks; ++ void *tmp = *a; ++ *a = *b; ++ *b = tmp; + } + +-static struct _hook hooks[] = { +- {"property_get", property_get }, +- {"property_set", property_set }, +- {"__system_property_get", my_system_property_get }, +- {"getenv", getenv }, +- {"printf", printf }, +- {"malloc", my_malloc }, +- {"free", free }, +- {"calloc", calloc }, ++static int _hybris_hook_getaddrinfo(const char *hostname, const char *servname, ++ const struct addrinfo *hints, struct addrinfo **res) ++{ ++ struct addrinfo *fixed_hints = NULL; ++ ++ TRACE_HOOK("hostname '%s' servname '%s' hints %p res %p", ++ hostname, servname, hints, res); ++ ++ if (hints) { ++ fixed_hints = (struct addrinfo*) malloc(sizeof(struct addrinfo)); ++ memcpy(fixed_hints, hints, sizeof(struct addrinfo)); ++ // fix bionic -> glibc missmatch ++ swap((void**)&(fixed_hints->ai_canonname), (void**)&(fixed_hints->ai_addr)); ++ } ++ ++ int result = getaddrinfo(hostname, servname, fixed_hints, res); ++ ++ if (fixed_hints) ++ free(fixed_hints); ++ ++ // fix bionic <- glibc missmatch ++ struct addrinfo *it = *res; ++ while (it) { ++ swap((void**) &(it->ai_canonname), (void**) &(it->ai_addr)); ++ it = it->ai_next; ++ } ++ ++ return result; ++} ++ ++static void _hybris_hook_freeaddrinfo(struct addrinfo *__ai) ++{ ++ TRACE_HOOK("ai %p", __ai); ++ ++ if (__ai == NULL) ++ return; ++ ++ struct addrinfo *it = __ai; ++ while (it) { ++ swap((void**) &(it->ai_canonname), (void**) &(it->ai_addr)); ++ it = it->ai_next; ++ } ++ ++ freeaddrinfo(__ai); ++} ++ ++extern long _hybris_map_sysconf(int name); ++ ++long _hybris_hook_sysconf(int name) ++{ ++ TRACE_HOOK("name %d", name); ++ ++ return _hybris_map_sysconf(name); ++} ++ +FP_ATTRIB static double _hybris_hook_strtod(const char *nptr, char **endptr) +{ + TRACE_HOOK("nptr '%s' endptr %p", nptr, endptr); @@ -12556,21 +12677,14 @@ + + return strtod_l(nptr, endptr, hybris_locale); +} - --void *__get_tls_hooks() ++ +static long int _hybris_hook_strtol(const char* str, char** endptr, int base) - { -- return tls_hooks; ++{ + TRACE_HOOK("str '%s' endptr %p base %i", str, endptr, base); + + return strtol(str, endptr, base); - } - --static struct _hook hooks[] = { -- {"property_get", property_get }, -- {"property_set", property_set }, -- {"__system_property_get", my_system_property_get }, -- {"getenv", getenv }, ++} ++ +static int ___hybris_hook_system_property_read(const void *pi, char *name, char *value) +{ + TRACE_HOOK("pi %p name '%s' value '%s'", pi, name, value); @@ -13020,13 +13134,14 @@ + {"property_set", _hybris_hook_property_set }, + {"__system_property_get", _hybris_hook_system_property_get }, + {"getenv", _hybris_hook_getenv}, - {"printf", printf }, -- {"malloc", my_malloc }, ++ {"printf", printf }, + {"malloc", _hybris_hook_malloc }, - {"free", free }, - {"calloc", calloc }, ++ {"free", free }, ++ {"calloc", calloc }, {"cfree", cfree }, -@@ -1345,22 +2235,24 @@ static struct _hook hooks[] = { + {"realloc", realloc }, + {"memalign", memalign }, +@@ -1345,22 +2307,24 @@ static struct _hook hooks[] = { {"pvalloc", pvalloc }, {"fread", fread }, {"getxattr", getxattr}, @@ -13056,7 +13171,7 @@ {"strcpy",strcpy}, {"strcat",strcat}, {"strcasecmp",strcasecmp}, -@@ -1369,16 +2261,14 @@ static struct _hook hooks[] = { +@@ -1369,16 +2333,14 @@ static struct _hook hooks[] = { {"strstr",strstr}, {"strtok",strtok}, {"strtok_r",strtok_r}, @@ -13075,7 +13190,7 @@ {"strcspn",strcspn}, {"strpbrk",strpbrk}, {"strsep",strsep}, -@@ -1395,17 +2285,19 @@ static struct _hook hooks[] = { +@@ -1395,17 +2357,19 @@ static struct _hook hooks[] = { {"index",index}, {"rindex",rindex}, {"strcasecmp",strcasecmp}, @@ -13098,7 +13213,7 @@ {"pthread_exit", pthread_exit}, {"pthread_join", pthread_join}, {"pthread_detach", pthread_detach}, -@@ -1413,72 +2305,78 @@ static struct _hook hooks[] = { +@@ -1413,72 +2377,78 @@ static struct _hook hooks[] = { {"pthread_equal", pthread_equal}, {"pthread_getschedparam", pthread_getschedparam}, {"pthread_setschedparam", pthread_setschedparam}, @@ -13230,7 +13345,7 @@ {"fopen", fopen}, {"fdopen", fdopen}, {"popen", popen}, -@@ -1489,79 +2387,80 @@ static struct _hook hooks[] = { +@@ -1489,79 +2459,80 @@ static struct _hook hooks[] = { {"snprintf", snprintf}, {"vsprintf", vsprintf}, {"vsnprintf", vsnprintf}, @@ -13366,7 +13481,7 @@ {"sscanf", sscanf}, {"scanf", scanf}, {"vscanf", vscanf}, -@@ -1575,6 +2474,9 @@ static struct _hook hooks[] = { +@@ -1575,6 +2546,9 @@ static struct _hook hooks[] = { {"timer_gettime", timer_gettime}, {"timer_delete", timer_delete}, {"timer_getoverrun", timer_getoverrun}, @@ -13376,7 +13491,7 @@ {"abort", abort}, {"writev", writev}, /* unistd.h */ -@@ -1583,34 +2485,349 @@ static struct _hook hooks[] = { +@@ -1583,34 +2557,372 @@ static struct _hook hooks[] = { {"getgrgid", getgrgid}, {"__cxa_atexit", __cxa_atexit}, {"__cxa_finalize", __cxa_finalize}, @@ -13393,9 +13508,8 @@ + {"__system_property_find_nth", ___hybris_hook_system_property_find_nth}, + /* sys/prctl.h */ + {"prctl", _hybris_hook_prctl}, - }; - --void *get_hooked_symbol(char *sym) ++}; ++ +static struct _hook hooks_mm[] = { + {"strtol", _hybris_hook_strtol}, + {"strlcat",strlcat}, @@ -13468,6 +13582,11 @@ + {"getpwuid", getpwuid}, + {"getpwnam", getpwnam}, + /* signal.h */ ++ /* Hooks commented out for the moment as we need proper translations between ++ * bionic and glibc types for them to work (for instance, sigset_t has ++ * different definitions in each library). ++ */ ++#if 0 + {"sigaction", sigaction}, + {"sigaddset", sigaddset}, + {"sigaltstack", sigaltstack}, @@ -13491,8 +13610,16 @@ + {"sigtimedwait", sigtimedwait}, + {"sigwait", sigwait}, + {"sigwaitinfo", sigwaitinfo}, -+}; -+ ++#endif ++ /* dirent.h */ ++ {"scandir", _hybris_hook_scandir}, ++ {"scandirat", _hybris_hook_scandirat}, ++ {"alphasort,", _hybris_hook_alphasort}, ++ {"versionsort,", _hybris_hook_versionsort}, ++ {"scandir64", scandir}, + }; + +-void *get_hooked_symbol(char *sym) + +static int hook_cmp(const void *a, const void *b) +{ @@ -13505,7 +13632,8 @@ +} + +static int get_android_sdk_version() -+{ + { +- struct _hook *ptr = &hooks[0]; + static int sdk_version = -1; + + if (sdk_version > 0) @@ -13547,8 +13675,7 @@ + + +static void* __hybris_get_hooked_symbol(const char *sym, const char *requester) - { -- struct _hook *ptr = &hooks[0]; ++{ + static int sorted = 0; static int counter = -1; + void *found = NULL; @@ -13625,6 +13752,12 @@ +#define LINKER_NAME_JB "jb" +#define LINKER_NAME_MM "mm" + ++#if defined(WANT_LINKER_JB) ++#define LINKER_NAME_DEFAULT LINKER_NAME_JB ++#elif defined(WANT_LINKER_MM) ++#define LINKER_NAME_DEFAULT LINKER_NAME_MM ++#endif ++ +static int linker_initialized = 0; + +static void __hybris_linker_init() @@ -13634,14 +13767,19 @@ + int sdk_version = get_android_sdk_version(); + + char path[PATH_MAX]; -+ char *name = NULL; ++ const char *name = LINKER_NAME_DEFAULT; ++ + /* See https://source.android.com/source/build-numbers.html for + * an overview over available SDK version numbers and which + * Android version they relate to. */ ++#if defined(WANT_LINKER_MM) ++ if (sdk_version <= 23) ++ name = LINKER_NAME_MM; ++#endif ++#if defined(WANT_LINKER_JB) + if (sdk_version < 21) + name = LINKER_NAME_JB; -+ else -+ name = LINKER_NAME_MM; ++#endif + + const char *linker_dir = LINKER_PLUGIN_DIR; + const char *user_linker_dir = getenv("HYBRIS_LINKER_DIR"); @@ -14416,15 +14554,15 @@ + linker_memory.cpp \ + linker_phdr.cpp \ + linker_sdk_versions.cpp \ -+ rt.cpp ++ rt.cpp \ ++ ../strlcpy.c \ ++ ../strlcat.c +mm_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/common \ + -I$(bionic_libc)/ \ + -I$(bionic_libc)/include \ -+ -DLINKER_TEXT_BASE=0xB0000100 \ -+ -DLINKER_AREA_SIZE=0x01000000 \ + -DDEFAULT_HYBRIS_LD_LIBRARY_PATH="\"@DEFAULT_HYBRIS_LD_LIBRARY_PATH@\"" \ + $(ARCH_FLAGS) \ + $(ANDROID_HEADERS_CFLAGS) @@ -23761,7 +23899,20 @@ DEFAULT_EGL_PLATFORM="null" AC_ARG_WITH(default-egl-platform, -@@ -114,7 +138,10 @@ AC_ARG_WITH(android-headers, +@@ -100,7 +124,11 @@ AC_ARG_WITH(default-egl-platform, + [ ]) + AC_SUBST(DEFAULT_EGL_PLATFORM) + +-DEFAULT_HYBRIS_LD_LIBRARY_PATH="/vendor/lib:/system/lib" ++if test "x$arch" = "xarm" -o "x$arch" = "xx86"; then ++ DEFAULT_HYBRIS_LD_LIBRARY_PATH="/vendor/lib:/system/lib" ++else ++ DEFAULT_HYBRIS_LD_LIBRARY_PATH="/vendor/lib64:/system/lib64" ++fi + AC_ARG_WITH(default-hybris-ld-library-path, + [ --with-default-hybris-ld-library-path=PATH1:PATH2:... Use PATH1:PATH2 for default HYBRIS_LD_LIBRARY_PATH if not specified by environment ], + [ DEFAULT_HYBRIS_LD_LIBRARY_PATH="$withval" ], +@@ -114,7 +142,10 @@ AC_ARG_WITH(android-headers, AS_IF([test -f $withval/libnfc-nxp/phLibNfc.h], [ANDROID_HEADERS_CFLAGS="-I$withval -I$withval/libnfc-nxp"],[ANDROID_HEADERS_CFLAGS="-I$withval"]) AC_SUBST([ANDROID_HEADERS_CFLAGS]) ], @@ -23773,7 +23924,7 @@ ) CPPFLAGS="$CPPFLAGS $ANDROID_HEADERS_CFLAGS" -@@ -177,6 +204,17 @@ AM_CONDITIONAL([HAS_ANDROID_4_1_0], [tes +@@ -177,15 +208,26 @@ AM_CONDITIONAL([HAS_ANDROID_4_1_0], [tes AM_CONDITIONAL([HAS_ANDROID_4_0_0], [test $android_headers_major -ge 4 -a $android_headers_minor -ge 0 ]) AM_CONDITIONAL([HAS_ANDROID_2_3_0], [test $android_headers_major -ge 2 -a $android_headers_minor -ge 3 ]) @@ -23791,16 +23942,18 @@ AC_CONFIG_FILES([ Makefile -@@ -186,6 +224,8 @@ AC_CONFIG_FILES([ - common/gingerbread/Makefile - common/ics/Makefile + properties/Makefile + properties/libandroid-properties.pc + common/Makefile +- common/gingerbread/Makefile +- common/ics/Makefile common/jb/Makefile + common/stub/Makefile + common/mm/Makefile egl/egl.pc egl/Makefile egl/platforms/Makefile -@@ -217,6 +257,10 @@ AC_CONFIG_FILES([ +@@ -217,6 +259,10 @@ AC_CONFIG_FILES([ camera/libcamera.pc vibrator/Makefile vibrator/libvibrator.pc @@ -23811,7 +23964,7 @@ include/Makefile utils/Makefile tests/Makefile -@@ -236,16 +280,26 @@ echo " debug build.............: $debug +@@ -236,16 +282,26 @@ echo " debug build.............: $debug echo echo " trace...................: $trace" echo @@ -23853,6 +24006,28 @@ HYBRIS_TRACE_END("hybris-egl", "eglCreateWindowSurface", ""); return result; +--- libhybris-0.1.0+git20151016+6d424c9.orig/hybris/egl/platforms/null/eglplatform_null.c ++++ libhybris-0.1.0+git20151016+6d424c9/hybris/egl/platforms/null/eglplatform_null.c +@@ -16,7 +16,7 @@ static alloc_device_t *alloc = 0; + + static void _init_androidui() + { +- _libui = (void *) android_dlopen("/system/lib/libui.so", RTLD_LAZY); ++ _libui = (void *) android_dlopen("libui.so", RTLD_LAZY); + } + + #define UI_DLSYM(fptr, sym) do { if (_libui == NULL) { _init_androidui(); }; if (*(fptr) == NULL) { *(fptr) = (void *) android_dlsym(_libui, sym); } } while (0) +--- libhybris-0.1.0+git20151016+6d424c9.orig/hybris/glesv1/glesv1_cm.c ++++ libhybris-0.1.0+git20151016+6d424c9/hybris/glesv1/glesv1_cm.c +@@ -26,7 +26,7 @@ + + #include + +-#define GLESV1_CM_LIBRARY_PATH "/system/lib/libGLESv1_CM.so" ++#define GLESV1_CM_LIBRARY_PATH "libGLESv1_CM.so" + + HYBRIS_LIBRARY_INITIALIZE(glesv1_cm, GLESV1_CM_LIBRARY_PATH); + --- libhybris-0.1.0+git20151016+6d424c9.orig/hybris/glesv2/glesv2.c +++ libhybris-0.1.0+git20151016+6d424c9/hybris/glesv2/glesv2.c @@ -22,404 +22,1028 @@ @@ -25974,7 +26149,7 @@ +#endif // MEDIA_FORMAT_LAYER_H_ --- /dev/null +++ libhybris-0.1.0+git20151016+6d424c9/hybris/include/hybris/media/media_message_layer.h -@@ -0,0 +1,56 @@ +@@ -0,0 +1,57 @@ +/* + * Copyright (C) 2016 Canonical Ltd + * @@ -25999,6 +26174,7 @@ +#include + +#include ++#include +#include + +#ifdef __cplusplus @@ -26472,7 +26648,12 @@ --- libhybris-0.1.0+git20151016+6d424c9.orig/hybris/input/is.c +++ libhybris-0.1.0+git20151016+6d424c9/hybris/input/is.c -@@ -28,6 +28,14 @@ +@@ -24,10 +24,18 @@ + #include + #include + +-#define COMPAT_LIBRARY_PATH "/system/lib/libis_compat_layer.so" ++#define COMPAT_LIBRARY_PATH "libis_compat_layer.so" HYBRIS_LIBRARY_INITIALIZE(is, COMPAT_LIBRARY_PATH); @@ -26487,6 +26668,28 @@ HYBRIS_IMPLEMENT_VOID_FUNCTION2(is, android_input_stack_initialize, struct AndroidEventListener*, struct InputStackConfiguration*); HYBRIS_IMPLEMENT_VOID_FUNCTION0(is, android_input_stack_start); +--- libhybris-0.1.0+git20151016+6d424c9.orig/hybris/libnfc_ndef_nxp/libnfc_ndef_nxp.c ++++ libhybris-0.1.0+git20151016+6d424c9/hybris/libnfc_ndef_nxp/libnfc_ndef_nxp.c +@@ -34,7 +34,7 @@ + + #include + +-HYBRIS_LIBRARY_INITIALIZE(libnfc_ndef_so, "/system/lib/libnfc_ndef.so"); ++HYBRIS_LIBRARY_INITIALIZE(libnfc_ndef_so, "libnfc_ndef.so"); + + HYBRIS_IMPLEMENT_FUNCTION5(libnfc_ndef_so, NFCSTATUS, phFriNfc_NdefRecord_GetRecords, uint8_t *, uint32_t, uint8_t **, uint8_t *, uint32_t *); + HYBRIS_IMPLEMENT_FUNCTION1(libnfc_ndef_so, uint32_t, phFriNfc_NdefRecord_GetLength, phFriNfc_NdefRecord_t *); +--- libhybris-0.1.0+git20151016+6d424c9.orig/hybris/libnfc_nxp/libnfc_nxp.c ++++ libhybris-0.1.0+git20151016+6d424c9/hybris/libnfc_nxp/libnfc_nxp.c +@@ -56,7 +56,7 @@ typedef void (*pphDal4Nfc_DeferFuncPoi + + #include + +-HYBRIS_LIBRARY_INITIALIZE(libnfc_so, "/system/lib/libnfc.so"); ++HYBRIS_LIBRARY_INITIALIZE(libnfc_so, "libnfc.so"); + + HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLibNfc_Mgt_ConfigureDriver, pphLibNfc_sConfig_t, void **); + HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phDal4Nfc_Config, pphDal4Nfc_sConfig_t, void **); --- /dev/null +++ libhybris-0.1.0+git20151016+6d424c9/hybris/media/Makefile.am @@ -0,0 +1,17 @@ @@ -26558,7 +26761,7 @@ +#include +#include + -+#define COMPAT_LIBRARY_PATH "/system/lib/libmedia_compat_layer.so" ++#define COMPAT_LIBRARY_PATH "libmedia_compat_layer.so" + +#ifdef __ARM_PCS_VFP +#define FP_ATTRIB __attribute__((pcs("aapcs"))) @@ -27240,6 +27443,17 @@ + runtime_cache_ensure_initialized(); + runtime_cache_insert_impl(key, value); +} +--- libhybris-0.1.0+git20151016+6d424c9.orig/hybris/sf/sf.c ++++ libhybris-0.1.0+git20151016+6d424c9/hybris/sf/sf.c +@@ -24,7 +24,7 @@ + #include + #include + +-#define COMPAT_LIBRARY_PATH "/system/lib/libsf_compat_layer.so" ++#define COMPAT_LIBRARY_PATH "libsf_compat_layer.so" + + HYBRIS_LIBRARY_INITIALIZE(sf, COMPAT_LIBRARY_PATH); + --- libhybris-0.1.0+git20151016+6d424c9.orig/hybris/tests/Makefile.am +++ libhybris-0.1.0+git20151016+6d424c9/hybris/tests/Makefile.am @@ -1,4 +1,5 @@ @@ -28424,6 +28638,15 @@ +// vim:ts=4:sw=4:noexpandtab --- libhybris-0.1.0+git20151016+6d424c9.orig/hybris/ui/ui.c +++ libhybris-0.1.0+git20151016+6d424c9/hybris/ui/ui.c +@@ -20,7 +20,7 @@ + #include + #include + +-#define COMPAT_LIBRARY_PATH "/system/lib/libui_compat_layer.so" ++#define COMPAT_LIBRARY_PATH "libui_compat_layer.so" + + HYBRIS_LIBRARY_INITIALIZE(ui, COMPAT_LIBRARY_PATH); + @@ -48,9 +48,11 @@ HYBRIS_IMPLEMENT_FUNCTION1(ui, uint32_t, struct graphic_buffer*); HYBRIS_IMPLEMENT_FUNCTION1(ui, void*, graphic_buffer_get_native_buffer, @@ -28436,6 +28659,17 @@ +#endif HYBRIS_IMPLEMENT_FUNCTION1(ui, int, graphic_buffer_init_check, struct graphic_buffer*); +--- libhybris-0.1.0+git20151016+6d424c9.orig/hybris/vibrator/vibrator.c ++++ libhybris-0.1.0+git20151016+6d424c9/hybris/vibrator/vibrator.c +@@ -22,7 +22,7 @@ + + #include + +-HYBRIS_LIBRARY_INITIALIZE(vibrator, "/system/lib/libhardware_legacy.so"); ++HYBRIS_LIBRARY_INITIALIZE(vibrator, "libhardware_legacy.so"); + + HYBRIS_IMPLEMENT_FUNCTION0(vibrator, int, vibrator_exists); + HYBRIS_IMPLEMENT_FUNCTION1(vibrator, int, vibrator_on, int); --- /dev/null +++ libhybris-0.1.0+git20151016+6d424c9/hybris/wifi/Makefile.am @@ -0,0 +1,17 @@ @@ -28471,7 +28705,7 @@ +Cflags: -I${includedir} --- /dev/null +++ libhybris-0.1.0+git20151016+6d424c9/hybris/wifi/wifi.c -@@ -0,0 +1,51 @@ +@@ -0,0 +1,53 @@ +/* + * Copyright (C) 2014 Canonical Ltd + * @@ -28496,7 +28730,7 @@ +#include +#include + -+#define COMPAT_LIBRARY_PATH "/system/lib/libhardware_legacy.so" ++#define COMPAT_LIBRARY_PATH "libhardware_legacy.so" + +HYBRIS_LIBRARY_INITIALIZE(wifi, COMPAT_LIBRARY_PATH); + @@ -28523,6 +28757,8 @@ +HYBRIS_IMPLEMENT_FUNCTION1(wifi, const char *, wifi_get_fw_path, int); +HYBRIS_IMPLEMENT_FUNCTION1(wifi, int, wifi_change_fw_path, const char *); +HYBRIS_IMPLEMENT_FUNCTION0(wifi, int, ensure_entropy_file_exists); ++HYBRIS_IMPLEMENT_FUNCTION4(wifi, int, wifi_send_driver_command, ++ char*, char*, char*, size_t); --- libhybris-0.1.0+git20151016+6d424c9.orig/utils/generate_wrapper_macros.py +++ libhybris-0.1.0+git20151016+6d424c9/utils/generate_wrapper_macros.py @@ -104,6 +104,12 @@ print """