Snap for 9358956 from 39dfd704e02a6d514e32684e519c7fbfde0ee530 to tm-qpr2-release
Change-Id: Icc606fbdffa6742fdad56dcfd3e17746d71a943b
diff --git a/src/Android.bp b/src/Android.bp
index f71c2e1..b419ef9 100644
--- a/src/Android.bp
+++ b/src/Android.bp
@@ -39,6 +39,7 @@
cflags: [
"-DDYN_ALLOC=1",
"-DBUILDCFG=1",
+ "-DGKI_PTHREAD_JOINABLE",
"-Wall",
"-Werror",
"-Wimplicit-fallthrough",
diff --git a/src/gki/ulinux/gki_ulinux.cc b/src/gki/ulinux/gki_ulinux.cc
index d6d81ed..336af3a 100644
--- a/src/gki/ulinux/gki_ulinux.cc
+++ b/src/gki/ulinux/gki_ulinux.cc
@@ -303,11 +303,16 @@
while ((gki_cb.com.OSWaitEvt[task_id - 1] != 0) && (++i < 10))
usleep(100 * 1000);
#else
- /* wait for proper Arnold Schwarzenegger task state */
- result = pthread_join(gki_cb.os.thread_id[task_id - 1], NULL);
- if (result < 0) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("FAILED: result: %d", result);
+ /* Skip BTU_TASK due to BTU_TASK is used for GKI_run() and it terminates
+ * after GKI_shutdown().
+ */
+ if ((task_id - 1) != BTU_TASK) {
+ /* wait for proper Arnold Schwarzenegger task state */
+ result = pthread_join(gki_cb.os.thread_id[task_id - 1], NULL);
+ if (result < 0) {
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("FAILED: result: %d", result);
+ }
}
#endif
DLOG_IF(INFO, nfc_debug_enabled)