Implemented typed, thread-specific logging system. Currently supported types are:
 * Strings
 * Integers
 * Floats
 * Timestamps
 * Process IDs

Added printf-like formatted logging using mentioned types.

Test: included in this CL
Bug: 29421410
Change-Id: Ie07b78d8d39c32fcc8a122ffa9b1b7082800b990
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index e025316..b40d51c 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -73,6 +73,9 @@
 
 #include "AutoPark.h"
 
+#include <pthread.h>
+#include "TypedLogger.h"
+
 // ----------------------------------------------------------------------------
 
 // Note: the following macro is used for extremely verbose logging message.  In
@@ -2903,6 +2906,8 @@
 
 bool AudioFlinger::PlaybackThread::threadLoop()
 {
+    logWriterTLS = mNBLogWriter.get();
+
     Vector< sp<Track> > tracksToRemove;
 
     mStandbyTimeNs = systemTime();
@@ -2934,7 +2939,9 @@
     const char *logString = NULL;
 
     checkSilentMode_l();
-
+#if 0
+    int z = 0; // used in logFormat example
+#endif
     while (!exitPending())
     {
         cpuStats.sample(myName);
@@ -3023,7 +3030,17 @@
                     }
                 }
             }
-
+#if 0
+            // logFormat example
+            if (!(z % 100)) {
+                timespec ts;
+                clock_gettime(CLOCK_MONOTONIC, &ts);
+                LOGF("This is an integer %d, this is a float %f, this is my "
+                    "pid %p %% %s %t", 42, 3.14, "and this is a timestamp", ts);
+                LOGF("A deceptive null-terminated string %\0");
+            }
+            ++z;
+#endif
             saveOutputTracks();
             if (mSignalPending) {
                 // A signal was raised while we were unlocked