Use __ANDROID__ instead of HAVE_ANDROID_OS.
Change-Id: I9967f3fd758c2a5b40be5b60ae72be7e2fb75136
diff --git a/libutils/Threads.cpp b/libutils/Threads.cpp
index c3666e4..6dda6b5 100644
--- a/libutils/Threads.cpp
+++ b/libutils/Threads.cpp
@@ -45,7 +45,7 @@
#include <cutils/sched_policy.h>
-#ifdef HAVE_ANDROID_OS
+#if defined(__ANDROID__)
# define __android_unused
#else
# define __android_unused __attribute__((__unused__))
@@ -132,7 +132,7 @@
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-#ifdef HAVE_ANDROID_OS /* valgrind is rejecting RT-priority create reqs */
+#if defined(__ANDROID__) /* valgrind is rejecting RT-priority create reqs */
if (threadPriority != PRIORITY_DEFAULT || threadName != NULL) {
// Now that the pthread_t has a method to find the associated
// android_thread_id_t (pid) from pthread_t, it would be possible to avoid
@@ -176,7 +176,7 @@
return 1;
}
-#ifdef HAVE_ANDROID_OS
+#if defined(__ANDROID__)
static pthread_t android_thread_id_t_to_pthread(android_thread_id_t thread)
{
return (pthread_t) thread;
@@ -302,12 +302,10 @@
gCreateThreadFn = func;
}
-#ifdef HAVE_ANDROID_OS
+#if defined(__ANDROID__)
int androidSetThreadPriority(pid_t tid, int pri)
{
int rc = 0;
-
-#if !defined(_WIN32)
int lasterr = 0;
if (pri >= ANDROID_PRIORITY_BACKGROUND) {
@@ -325,17 +323,12 @@
} else {
errno = lasterr;
}
-#endif
return rc;
}
int androidGetThreadPriority(pid_t tid) {
-#if !defined(_WIN32)
return getpriority(PRIO_PROCESS, tid);
-#else
- return ANDROID_PRIORITY_NORMAL;
-#endif
}
#endif
@@ -658,7 +651,7 @@
mLock("Thread::mLock"),
mStatus(NO_ERROR),
mExitPending(false), mRunning(false)
-#ifdef HAVE_ANDROID_OS
+#if defined(__ANDROID__)
, mTid(-1)
#endif
{
@@ -728,7 +721,7 @@
wp<Thread> weak(strong);
self->mHoldSelf.clear();
-#ifdef HAVE_ANDROID_OS
+#if defined(__ANDROID__)
// this is very useful for debugging with gdb
self->mTid = gettid();
#endif
@@ -839,7 +832,7 @@
return mRunning;
}
-#ifdef HAVE_ANDROID_OS
+#if defined(__ANDROID__)
pid_t Thread::getTid() const
{
// mTid is not defined until the child initializes it, and the caller may need it earlier