Skip to content

Commit

Permalink
Merge commit 'ad956b57f533a236d95af7dc5bbfc61c60ea68e6'
Browse files Browse the repository at this point in the history
  • Loading branch information
sledges committed Jul 30, 2015
2 parents 6bfe79a + ad956b5 commit 08fe019
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 27 deletions.
5 changes: 4 additions & 1 deletion libhybris/hybris/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ SUBDIRS = include properties common hardware
if HAS_ANDROID_4_2_0
SUBDIRS += libsync
endif

if HAS_ANDROID_5_0_0
SUBDIRS += libsync
endif
SUBDIRS += egl glesv1 glesv2 ui sf input camera vibrator

if HAS_LIBNFC_NXP_HEADERS
SUBDIRS += libnfc_nxp libnfc_ndef_nxp
endif
Expand Down
5 changes: 5 additions & 0 deletions libhybris/hybris/common/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ if HAS_ANDROID_4_0_0
SUBDIRS = jb
libhybris_common_la_LIBADD= jb/libandroid-linker.la
else
if HAS_ANDROID_5_0_0
SUBDIRS = jb
libhybris_common_la_LIBADD= jb/libandroid-linker.la
else
if HAS_ANDROID_2_3_0
SUBDIRS = gingerbread
libhybris_common_la_LIBADD= gingerbread/libandroid-linker.la
else
$(error No Android Version is defined)
endif
endif
endif

libhybris_common_la_SOURCES = \
hooks.c \
Expand Down
10 changes: 10 additions & 0 deletions libhybris/hybris/common/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#include <unistd.h>
#include <syslog.h>
#include <locale.h>
#include <sys/syscall.h>
#include <sys/auxv.h>

#include <hybris/properties/properties.h>

Expand Down Expand Up @@ -183,6 +185,11 @@ static size_t my_strlen(const char *s)
return strlen(s);
}

static pid_t my_gettid( void )
{
return syscall( __NR_gettid );
}

/*
* Main pthread functions
*
Expand Down Expand Up @@ -1393,6 +1400,9 @@ static struct _hook hooks[] = {
{"opendir", opendir},
{"closedir", closedir},
/* pthread.h */
{"getauxval", getauxval},
{"gettid", my_gettid},
{"getpid", getpid},
{"pthread_atfork", pthread_atfork},
{"pthread_create", my_pthread_create},
{"pthread_kill", pthread_kill},
Expand Down
27 changes: 15 additions & 12 deletions libhybris/hybris/common/jb/dlfcn.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,13 @@ int android_dlclose(void *handle)
return 0;
}

int android_dl_iterate_phdr(int (*cb)(struct dl_phdr_info *info, size_t size, void *data),void *data);

#if defined(ANDROID_ARM_LINKER)
// 0000000 00011111 111112 22222222 2333333 333344444444445555555
// 0123456 78901234 567890 12345678 9012345 678901234567890123456
#define ANDROID_LIBDL_STRTAB \
"dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_unwind_find_exidx\0"
"dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_unwind_find_exidx\0dl_iterate_phdr\0"

_Unwind_Ptr android_dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount);

Expand All @@ -178,9 +180,6 @@ _Unwind_Ptr android_dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount);
// 0123456 78901234 567890 12345678 9012345 6789012345678901
#define ANDROID_LIBDL_STRTAB \
"dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_iterate_phdr\0"

int android_dl_iterate_phdr(int (*cb)(struct dl_phdr_info *info, size_t size, void *data),void *data);

#elif defined(ANDROID_SH_LINKER)
// 0000000 00011111 111112 22222222 2333333 3333444444444455
// 0123456 78901234 567890 12345678 9012345 6789012345678901
Expand Down Expand Up @@ -230,19 +229,14 @@ static Elf32_Sym libdl_symtab[] = {
st_info: STB_GLOBAL << 4,
st_shndx: 1,
},
#elif defined(ANDROID_X86_LINKER)
{ st_name: 36,
st_value: (Elf32_Addr) &android_dl_iterate_phdr,
st_info: STB_GLOBAL << 4,
st_shndx: 1,
},
#elif defined(ANDROID_SH_LINKER)
{ st_name: 57,
#else
{ st_name: 36,
#endif
st_value: (Elf32_Addr) &android_dl_iterate_phdr,
st_info: STB_GLOBAL << 4,
st_shndx: 1,
},
#endif
};

/* Fake out a hash table with a single bucket.
Expand All @@ -265,7 +259,11 @@ static Elf32_Sym libdl_symtab[] = {
* stubbing them out in libdl.
*/
static unsigned libdl_buckets[1] = { 1 };
#if defined(ANDROID_ARM_LINKER)
static unsigned libdl_chains[8] = { 0, 2, 3, 4, 5, 6, 7, 0 };
#else
static unsigned libdl_chains[7] = { 0, 2, 3, 4, 5, 6, 0 };
#endif

soinfo libdl_info = {
name: "libdl.so",
Expand All @@ -274,8 +272,13 @@ soinfo libdl_info = {
strtab: ANDROID_LIBDL_STRTAB,
symtab: libdl_symtab,

refcount: 1,
nbucket: 1,
#if defined(ANDROID_ARM_LINKER)
nchain: 8,
#else
nchain: 7,
#endif
bucket: libdl_buckets,
chain: libdl_chains,
};
Expand Down
5 changes: 2 additions & 3 deletions libhybris/hybris/common/jb/linker.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ _Unwind_Ptr android_dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount)
*pcount = 0;
return NULL;
}
#elif defined(ANDROID_X86_LINKER)
#endif
/* Here, we only have to provide a callback to iterate across all the
* loaded libraries. gcc_eh does the rest. */
int
Expand All @@ -379,7 +379,6 @@ android_dl_iterate_phdr(int (*cb)(struct dl_phdr_info *info, size_t size, void *
}
return rv;
}
#endif

static Elf32_Sym *_elf_lookup(soinfo *si, unsigned hash, const char *name)
{
Expand Down Expand Up @@ -1340,7 +1339,7 @@ static int reloc_library(soinfo *si, Elf32_Rel *rel, unsigned count)
/* We only allow an undefined symbol if this is a weak
reference.. */
s = &symtab[sym];
if (ELF32_ST_BIND(s->st_info) != STB_WEAK) {
if (ELF32_ST_BIND(s->st_info) != STB_WEAK && strcmp(si->name, "libdsyscalls.so") != 0) {
DL_ERR("%5d cannot locate '%s'...\n", pid, sym_name);
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion libhybris/hybris/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ AC_SUBST(ANDROID_VERSION_PATCH, [$android_headers_patch])
AC_MSG_NOTICE("Android headers version is $android_headers_major.$android_headers_minor.$android_headers_patch")

# Add automake tests for version/API needs here that you need in code, including test .am's

AM_CONDITIONAL([HAS_ANDROID_5_0_0], [test $android_headers_major -ge 5 -a $android_headers_minor -ge 0 ])
AM_CONDITIONAL([HAS_ANDROID_4_2_0], [test $android_headers_major -ge 4 -a $android_headers_minor -ge 2 ])
AM_CONDITIONAL([HAS_ANDROID_4_1_0], [test $android_headers_major -ge 4 -a $android_headers_minor -ge 1 ])
AM_CONDITIONAL([HAS_ANDROID_4_0_0], [test $android_headers_major -ge 4 -a $android_headers_minor -ge 0 ])
Expand Down
3 changes: 3 additions & 0 deletions libhybris/hybris/egl/platforms/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ SUBDIRS = common null fbdev
if HAS_ANDROID_4_2_0
SUBDIRS += hwcomposer
endif
if HAS_ANDROID_5_0_0
SUBDIRS += hwcomposer
endif

if WANT_WAYLAND
SUBDIRS += wayland
Expand Down
4 changes: 4 additions & 0 deletions libhybris/hybris/egl/platforms/common/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ if HAS_ANDROID_4_2_0
libhybris_eglplatformcommon_la_LDFLAGS += $(top_builddir)/libsync/libsync.la
endif

if HAS_ANDROID_5_0_0
libhybris_eglplatformcommon_la_LDFLAGS += $(top_builddir)/libsync/libsync.la
endif


eglplatformcommondir = $(includedir)/hybris/eglplatformcommon
eglplatformcommon_HEADERS = \
Expand Down
1 change: 1 addition & 0 deletions libhybris/hybris/egl/platforms/common/server_wlegl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#include <android-config.h>
#include <cstring>

#include <EGL/egl.h>
Expand Down
4 changes: 3 additions & 1 deletion libhybris/hybris/egl/platforms/hwcomposer/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ libhybris_hwcomposerwindow_la_LDFLAGS = \
if HAS_ANDROID_4_2_0
libhybris_hwcomposerwindow_la_LDFLAGS += $(top_builddir)/libsync/libsync.la
endif

if HAS_ANDROID_5_0_0
libhybris_hwcomposerwindow_la_LDFLAGS += $(top_builddir)/libsync/libsync.la
endif
pkglib_LTLIBRARIES = eglplatform_hwcomposer.la

eglplatform_hwcomposer_la_SOURCES = \
Expand Down
6 changes: 5 additions & 1 deletion libhybris/hybris/egl/platforms/wayland/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ eglplatform_wayland_la_LDFLAGS = \
$(top_builddir)/egl/platforms/common/libhybris-eglplatformcommon.la \
$(top_builddir)/hardware/libhardware.la \
$(WAYLAND_CLIENT_LIBS)

if HAS_ANDROID_4_2_0
eglplatform_wayland_la_LDFLAGS += $(top_builddir)/libsync/libsync.la
endif

if HAS_ANDROID_5_0_0
eglplatform_wayland_la_LDFLAGS += $(top_builddir)/libsync/libsync.la
endif

2 changes: 0 additions & 2 deletions libhybris/hybris/glesv2/glesv2.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ This generates a function that when first called overwrites it's plt entry with
typeof(sym) * sym ## _dispatch (void) __asm__ (#sym);\
typeof(sym) * sym ## _dispatch (void) \
{ \
if (!_libglesv2) \
_libglesv2 = (void *) android_dlopen(getenv("LIBGLESV2") ? getenv("LIBGLESV2") : "libGLESv2.so", RTLD_NOW); \
return (void *) android_dlsym(_libglesv2, #sym); \
}

Expand Down
2 changes: 1 addition & 1 deletion libhybris/hybris/hardware/hardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static int (*_hw_get_module_by_class)(const char *class_id, const char *inst, co

static void _init_lib_hardware()
{
_libhardware = (void *) android_dlopen("/system/lib/libhardware.so", RTLD_LAZY);
_libhardware = (void *) android_dlopen("libhardware.so", RTLD_LAZY);
}

int hw_get_module(const char *id, const struct hw_module_t **module)
Expand Down
2 changes: 1 addition & 1 deletion libhybris/hybris/libnfc_nxp/libnfc_nxp.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, uint32_t, phFriNfc_Llcp_CyclicFifoAvailabl
HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, uint32_t, phFriNfc_Llcp_Buffer2Sequence, uint8_t *, uint32_t, phFriNfc_Llcp_sPacketSequence_t *);
HYBRIS_IMPLEMENT_VOID_FUNCTION5(libnfc_so, Handle_ConnectionOriented_IncommingFrame, phFriNfc_LlcpTransport_t *, phNfc_sData_t *, uint8_t, uint8_t, uint8_t);
HYBRIS_IMPLEMENT_VOID_FUNCTION4(libnfc_so, Handle_Connectionless_IncommingFrame, phFriNfc_LlcpTransport_t *, phNfc_sData_t *, uint8_t, uint8_t);
#if ANDROID_VERSION_MAJOR>=4 && ANDROID_VERSION_MINOR>=3
#if ANDROID_VERSION_MAJOR>=4 && ANDROID_VERSION_MINOR>=3 || ANDROID_VERSION_MAJOR >= 5
/* see libnfc-nxp commit 7c4b4fad -- since Android 4.3 */
HYBRIS_IMPLEMENT_FUNCTION7(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_LinkSend, phFriNfc_LlcpTransport_t *, phFriNfc_Llcp_sPacketHeader_t *, phFriNfc_Llcp_sPacketSequence_t *, phNfc_sData_t *, phFriNfc_Llcp_LinkSend_CB_t, uint8_t, void *);
#else
Expand Down
9 changes: 8 additions & 1 deletion libhybris/hybris/tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ if HAS_ANDROID_4_2_0
bin_PROGRAMS += test_hwcomposer
endif

if HAS_ANDROID_5_0_0
bin_PROGRAMS += test_hwcomposer
endif


if HAS_LIBNFC_NXP_HEADERS
bin_PROGRAMS += test_nfc
endif
Expand Down Expand Up @@ -149,7 +154,9 @@ test_gps_CFLAGS = -pthread \
if HAS_ANDROID_4_2_0
test_gps_CFLAGS += -DHAS_ANDROID_4_2_0
endif

if HAS_ANDROID_5_0_0
test_gps_CFLAGS += -DHAS_ANDROID_5_0_0
endif
test_gps_LDFLAGS = -pthread
test_gps_LDADD = \
$(top_builddir)/common/libhybris-common.la \
Expand Down
6 changes: 3 additions & 3 deletions libhybris/hybris/tests/test_gps.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,15 @@ static void agps_handle_status_callback(AGpsStatus *status)
{
case GPS_REQUEST_AGPS_DATA_CONN:
fprintf(stdout, "*** data_conn_open\n");
#ifndef HAS_ANDROID_4_2_0
#if ! defined(HAS_ANDROID_4_2_0) && ! defined(HAS_ANDROID_5_0_0)
AGps->data_conn_open(AGPS_TYPE_SUPL, apn, AGPS_APN_BEARER_IPV4);
#else
AGps->data_conn_open(apn);
#endif
break;
case GPS_RELEASE_AGPS_DATA_CONN:
fprintf(stdout, "*** data_conn_closed\n");
#ifndef HAS_ANDROID_4_2_0
#if ! defined(HAS_ANDROID_4_2_0) && ! defined(HAS_ANDROID_5_0_0)
AGps->data_conn_closed(AGPS_TYPE_SUPL);
#else
AGps->data_conn_closed();
Expand Down Expand Up @@ -414,7 +414,7 @@ void sigint_handler(int signum)
fprintf(stdout, "*** cleanup\n");
if(AGps)
{
#ifndef HAS_ANDROID_4_2_0
#if ! defined(HAS_ANDROID_4_2_0) && ! defined(HAS_ANDROID_5_0_0)
AGps->data_conn_closed(AGPS_TYPE_SUPL);
#else
AGps->data_conn_closed();
Expand Down

0 comments on commit 08fe019

Please sign in to comment.