gn-build: Get //utils:utils to compile
This CL conditionally removes the dependency on libcutils to get the
//utils:utils static library target to compile in GN. This technically breaks
the functionality on non-Android platforms until we come up with a common way to
make the logic work.
BUG=21339022
Change-Id: I47cd8f7991942dbe43a577cef1f95626560f7f72
diff --git a/utils/src/bt_utils.c b/utils/src/bt_utils.c
index c8755c5..2420716 100644
--- a/utils/src/bt_utils.c
+++ b/utils/src/bt_utils.c
@@ -27,7 +27,13 @@
#define LOG_TAG "bt_utils"
+// TODO(armansito): cutils/properties.h is only being used to pull-in runtime
+// settings on Android. Remove this conditional include once we have a generic
+// way to obtain system properties.
+#if !defined(OS_GENERIC)
#include <cutils/properties.h>
+#endif // !defined(OS_GENERIC)
+
#include <cutils/sched_policy.h>
#include <errno.h>
#include <pthread.h>
@@ -84,7 +90,10 @@
}
};
-
+// TODO(armansito): Remove this conditional code once there is a generic way
+// to obtain system properties. System properties are only available on
+// Android. Don't do the following check if this is a generic build.
+#if !defined(OS_GENERIC)
/*****************************************************************************
**
** Function check_do_scheduling_group
@@ -104,6 +113,7 @@
}
}
}
+#endif // !defined(OS_GENERIC)
/*****************************************************************************
**
@@ -122,11 +132,18 @@
pthread_mutex_lock(&gIdxLock);
g_TaskIdx = high_task;
+ // TODO(armansito): Remove this conditional check once we find a solution
+ // for system/core on non-Android platforms.
+#if defined(OS_GENERIC)
+ rc = -1;
+#else // !defined(OS_GENERIC)
pthread_once(&g_DoSchedulingGroupOnce[g_TaskIdx], check_do_scheduling_group);
if (g_DoSchedulingGroup[g_TaskIdx]) {
// set_sched_policy does not support tid == 0
rc = set_sched_policy(tid, SP_AUDIO_SYS);
}
+#endif // defined(OS_GENERIC)
+
g_TaskIDs[high_task] = tid;
pthread_mutex_unlock(&gIdxLock);