Camera2: Debug and logging fixes.

- Fix LOG_TAGs to work with standard logcat filtering.
- Add ATRACE to Camera2Device
- Shorten thread names to fit in 16 characters
- Remove some ATRACEs to avoid flooding trace unnecessarily

Bug: 7220520
Change-Id: Ief8d677b5c8bb35d94e0f21b11b86505e83169ea
diff --git a/services/camera/libcameraservice/camera2/BurstCapture.cpp b/services/camera/libcameraservice/camera2/BurstCapture.cpp
index 5020819..f4a2aa1 100644
--- a/services/camera/libcameraservice/camera2/BurstCapture.cpp
+++ b/services/camera/libcameraservice/camera2/BurstCapture.cpp
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#define LOG_NDEBUG 0
-#define LOG_TAG "BurstCapture"
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Camera2-BurstCapture"
 
 #include <utils/Log.h>
 #include <utils/Trace.h>
diff --git a/services/camera/libcameraservice/camera2/CallbackProcessor.cpp b/services/camera/libcameraservice/camera2/CallbackProcessor.cpp
index ca917f2..ede97a6 100644
--- a/services/camera/libcameraservice/camera2/CallbackProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/CallbackProcessor.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "Camera2Client::CallbackProcessor"
+#define LOG_TAG "Camera2-CallbackProcessor"
 #define ATRACE_TAG ATRACE_TAG_CAMERA
 //#define LOG_NDEBUG 0
 
diff --git a/services/camera/libcameraservice/camera2/CameraMetadata.cpp b/services/camera/libcameraservice/camera2/CameraMetadata.cpp
index 8399e20..835587d 100644
--- a/services/camera/libcameraservice/camera2/CameraMetadata.cpp
+++ b/services/camera/libcameraservice/camera2/CameraMetadata.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "CameraMetadata"
+#define LOG_TAG "Camera2-Metadata"
 #include <utils/Log.h>
 #include <utils/Errors.h>
 
diff --git a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
index 6d7c54f..c9498c2 100644
--- a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
+++ b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "Camera2Client::CaptureSequencer"
+#define LOG_TAG "Camera2-CaptureSequencer"
 #define ATRACE_TAG ATRACE_TAG_CAMERA
 //#define LOG_NDEBUG 0
 
@@ -169,7 +169,11 @@
     if (client == 0) return false;
 
     if (mCaptureState < ERROR) {
+        CaptureState oldState = mCaptureState;
         mCaptureState = (this->*kStateManagers[mCaptureState])(client);
+        if (ATRACE_ENABLED() && oldState != mCaptureState) {
+            ATRACE_INT("cam2_capt_state", mCaptureState);
+        }
     } else {
         ALOGE("%s: Bad capture state: %s",
                 __FUNCTION__, kStateNames[mCaptureState]);
@@ -181,7 +185,6 @@
 
 CaptureSequencer::CaptureState CaptureSequencer::manageIdle(sp<Camera2Client> &client) {
     status_t res;
-    ATRACE_CALL();
     Mutex::Autolock l(mInputMutex);
     while (!mStartCapture) {
         res = mStartCaptureSignal.waitRelative(mInputMutex,
diff --git a/services/camera/libcameraservice/camera2/FrameProcessor.cpp b/services/camera/libcameraservice/camera2/FrameProcessor.cpp
index d3d7b3e..0c8560b 100644
--- a/services/camera/libcameraservice/camera2/FrameProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/FrameProcessor.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "Camera2Client::FrameProcessor"
+#define LOG_TAG "Camera2-FrameProcessor"
 #define ATRACE_TAG ATRACE_TAG_CAMERA
 //#define LOG_NDEBUG 0
 
@@ -92,6 +92,7 @@
                     __FUNCTION__, client->getCameraId());
             break;
         }
+        ATRACE_INT("cam2_frame", entry.data.i32[0]);
 
         res = processFaceDetect(frame, client);
         if (res != OK) break;
diff --git a/services/camera/libcameraservice/camera2/JpegCompressor.cpp b/services/camera/libcameraservice/camera2/JpegCompressor.cpp
index 55964b6..702ef58 100644
--- a/services/camera/libcameraservice/camera2/JpegCompressor.cpp
+++ b/services/camera/libcameraservice/camera2/JpegCompressor.cpp
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#define LOG_NDEBUG 0
-#define LOG_TAG "JpegCompressor"
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Camera2-JpegCompressor"
 
 #include <utils/Log.h>
 #include <ui/GraphicBufferMapper.h>
diff --git a/services/camera/libcameraservice/camera2/JpegProcessor.cpp b/services/camera/libcameraservice/camera2/JpegProcessor.cpp
index 0538363..27f0fd9 100644
--- a/services/camera/libcameraservice/camera2/JpegProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/JpegProcessor.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "Camera2Client::JpegProcessor"
+#define LOG_TAG "Camera2-JpegProcessor"
 #define ATRACE_TAG ATRACE_TAG_CAMERA
 //#define LOG_NDEBUG 0
 
diff --git a/services/camera/libcameraservice/camera2/Parameters.cpp b/services/camera/libcameraservice/camera2/Parameters.cpp
index 82783e3..ec85f9c 100644
--- a/services/camera/libcameraservice/camera2/Parameters.cpp
+++ b/services/camera/libcameraservice/camera2/Parameters.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "Camera2::Parameters"
+#define LOG_TAG "Camera2-Parameters"
 #define ATRACE_TAG ATRACE_TAG_CAMERA
 //#define LOG_NDEBUG 0
 
diff --git a/services/camera/libcameraservice/camera2/ZslProcessor.cpp b/services/camera/libcameraservice/camera2/ZslProcessor.cpp
index c7a679e..9516f97 100644
--- a/services/camera/libcameraservice/camera2/ZslProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/ZslProcessor.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "Camera2Client::ZslProcessor"
+#define LOG_TAG "Camera2-ZslProcessor"
 #define ATRACE_TAG ATRACE_TAG_CAMERA
 //#define LOG_NDEBUG 0
 //#define LOG_NNDEBUG 0