Abstract atrace dependency into binder::os

This is a regression introduced in Iab43329097488f5de531ab9da46893c9df8e46b5

Bug: 302718225
Bug: 341083395
Test: aosp/3081709
Test: mma
Change-Id: I89c9b0f48d20f073619637b31b517a5374bde61e
diff --git a/libs/binder/BpBinder.cpp b/libs/binder/BpBinder.cpp
index 7a855e1..6594aa6 100644
--- a/libs/binder/BpBinder.cpp
+++ b/libs/binder/BpBinder.cpp
@@ -15,7 +15,6 @@
  */
 
 #define LOG_TAG "BpBinder"
-#define ATRACE_TAG ATRACE_TAG_AIDL
 //#define LOG_NDEBUG 0
 
 #include <binder/BpBinder.h>
@@ -24,15 +23,10 @@
 #include <binder/IResultReceiver.h>
 #include <binder/RpcSession.h>
 #include <binder/Stability.h>
+#include <binder/Trace.h>
 
 #include <stdio.h>
 
-#ifndef __TRUSTY__
-#include <cutils/trace.h>
-#else
-#define ATRACE_INT(...)
-#endif
-
 #include "BuildFlags.h"
 #include "file.h"
 
@@ -216,7 +210,7 @@
         sTrackingMap[trackedUid]++;
     }
     uint32_t numProxies = sBinderProxyCount.fetch_add(1, std::memory_order_relaxed);
-    ATRACE_INT("binder_proxies", numProxies);
+    binder::os::trace_int(ATRACE_TAG_AIDL, "binder_proxies", numProxies);
     uint32_t numLastWarned = sBinderProxyCountWarned.load(std::memory_order_relaxed);
     uint32_t numNextWarn = numLastWarned + kBinderProxyCountWarnInterval;
     if (numProxies >= numNextWarn) {
@@ -640,8 +634,8 @@
             }
         }
     }
-    [[maybe_unused]] uint32_t numProxies = --sBinderProxyCount;
-    ATRACE_INT("binder_proxies", numProxies);
+    uint32_t numProxies = --sBinderProxyCount;
+    binder::os::trace_int(ATRACE_TAG_AIDL, "binder_proxies", numProxies);
     if (ipc) {
         ipc->expungeHandle(binderHandle(), this);
         ipc->decWeakHandle(binderHandle());