第一种方法
error: frameworks/native/services/surfaceflinger/Android.bp:248:1: module "surfaceflinger" variant "android_arm64_armv8-a": depends on //system/unwinding/libbacktrace:libbacktrace which is not visible to this module
You may need to add "//frameworks/native/services/surfaceflinger" to its visibility
09:58:02 soong bootstrap failed with: exit statu
diff --git a/libbacktrace/Android.bp b/libbacktrace/Android.bp
index af14cde..38ea6f5 100644
--- a/libbacktrace/Android.bp
+++ b/libbacktrace/Android.bp
@@ -128,6 +128,7 @@ cc_library {
"//packages/modules/Bluetooth/system/gd",
"//system/core/init",
"//system/core/libutils",
+ "//frameworks/native/services/surfaceflinger",
],
min_sdk_version: "apex_inherit",
添加头文件和库
index 000a2cb0d3..f99582d469 100644
--- a/services/surfaceflinger/Android.bp
+++ b/services/surfaceflinger/Android.bp
@@ -69,6 +69,7 @@ cc_defaults {
"libui",
"libinput",
"libutils",
+ "libbacktrace",
"libSurfaceFlingerProp",
"server_configurable_flags",
],
@@ -84,6 +85,7 @@ cc_defaults {
"libshaders",
"libtonemap",
"libtrace_proto",
+ "libSFTest",
],
header_libs: [
"android.hardware.graphics.composer@2.1-command-buffer",
@@ -177,6 +179,7 @@ filegroup {
"RefreshRateOverlay.cpp",
"RegionSamplingThread.cpp",
"RenderArea.cpp",
+ "Scheduler/MyTestRef.cpp",
"Scheduler/DispSyncSource.cpp",
"Scheduler/EventThread.cpp",
"Scheduler/FrameRateOverrideMappings.cpp",
@@ -255,6 +258,9 @@ cc_binary {
shared_libs: [
"libSurfaceFlingerProp",
],
+ header_libs: [
+ "libscheduler_headers",
+ ],
添加头文件和调用
+++ b/services/surfaceflinger/BufferQueueLayer.cpp
@@ -34,6 +34,12 @@
#include "Scheduler/LayerHistory.h"
#include "TimeStats/TimeStats.h"
+#undef LOG_NDEBUG
+#define LOG_NDEBUG 1
+#include <utils/Log.h>
+//#include <utils/CallStack.h>
+#include "CallStack.h"
+
namespace android {
using PresentState = frametimeline::SurfaceFrame::PresentState;
@@ -444,6 +450,9 @@ void BufferQueueLayer::onSidebandStreamChanged() {
void BufferQueueLayer::onFirstRef() {
BufferLayer::onFirstRef();
+ CallStack cs;
+ cs.log("setMaxDequeueBuffer");
+
创建 CallStack.h 文件
16
17 #pragma once
18
19 #include <backtrace/Backtrace.h>
20 #include <log/log.h>
21
22 #include <memory>
23
24 class CallStack {
25 public:
26 // Create a callstack with the current thread's stack trace.
27 // Immediately dump it to logcat using the given logtag.
28 static void log(const char* logtag) noexcept {
29 std::unique_ptr<Backtrace> backtrace(
30 Backtrace::Create(BACKTRACE_CURRENT_PROCESS, BACKTRACE_CURRENT_THREAD));
31 if (backtrace->Unwind(2)) {
32 for (size_t i = 0, c = backtrace->NumFrames(); i < c; i++) {
33 __android_log_print(ANDROID_LOG_ERROR, logtag, "%s",
34 backtrace->FormatFrameData(i).c_str());
35 }
36 }
37 }
38 };
~
~
第二种方法:
添加库和头文件库
+++ b/services/surfaceflinger/Android.bp
@@ -69,6 +69,7 @@ cc_defaults {
"libui",
"libinput",
"libutils",
+ "libcutils",
"libSurfaceFlingerProp",
"server_configurable_flags",
],
@@ -91,6 +92,7 @@ cc_defaults {
"android.hardware.graphics.composer@2.3-command-buffer",
"android.hardware.graphics.composer@2.4-command-buffer",
"android.hardware.graphics.composer3-command-buffer",
+ "libutils_headers",
],
export_static_lib_headers: [
"libcompositionengine",
@@ -125,9 +127,7 @@ cc_defaults {
whole_program_vtables: true, // Requires ThinLTO
afdo: true,
// TODO(b/131771163): Fix broken fuzzer support with LTO.
- sanitize: {
- fuzzer: false,
- },
+ sanitize: {never:true,},
}
cc_library_headers {
@@ -227,6 +227,7 @@ cc_defaults {
"libprocessgroup",
"libsync",
"libutils",
+ "libutilscallstack",
],
static_libs: [
"libserviceutils",
代码添加头文件和代码
+++ b/services/surfaceflinger/BufferQueueLayer.cpp
@@ -34,6 +34,11 @@
#include "Scheduler/LayerHistory.h"
#include "TimeStats/TimeStats.h"
+#undef LOG_NDEBUG
+#define LOG_NDEBUG 1
+#include <utils/Log.h>
+#include <utils/CallStack.h>
+
namespace android {
using PresentState = frametimeline::SurfaceFrame::PresentState;
@@ -444,6 +449,10 @@ void BufferQueueLayer::onSidebandStreamChanged() {
void BufferQueueLayer::onFirstRef() {
BufferLayer::onFirstRef();
+ android::CallStack cs("setMaxDequeueBuffer",1);
BufferQueueProducer.cpp
@@ -123,6 +128,12 @@ status_t BufferQueueProducer::setMaxDequeuedBufferCount(
BQ_LOGV("setMaxDequeuedBufferCount: maxDequeuedBuffers = %d",
maxDequeuedBuffers);
+
+
+ android::CallStack cs("setMaxDequeueBufferB",1);
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #00 pc 00000000000030b4 /system/lib64/libutilscallstack.so (android::CallStack::CallStack(char const*, int)+88)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #01 pc 00000000000895e0 /system/lib64/libgui.so (android::BufferQueueProducer::setMaxDequeuedBufferCount(int)+76)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #02 pc 000000000009e100 /system/lib64/libgui.so (android::BLASTBufferQueue::BLASTBufferQueue(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)+440)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #03 pc 000000000014651c /system/lib64/libandroid_runtime.so (android::nativeCreate(_JNIEnv*, _jclass*, _jstring*, unsigned char)+352)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #04 pc 00000000001aa2f4 /system/framework/arm64/boot-framework.oat (art_jni_trampoline+132)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #05 pc 000000000070a050 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl.updateBlastSurfaceIfNeeded+400)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #06 pc 00000000006ff568 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl.relayoutWindow+3144)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #07 pc 00000000006fb940 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl.performTraversals+4224)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #08 pc 0000000000702a50 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl.doTraversal+224)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #09 pc 0000000000626ce4 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl$TraversalRunnable.run+68)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #10 pc 0000000000606854 /system/framework/arm64/boot-framework.oat (android.view.Choreographer.doCallbacks+1252)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #11 pc 0000000000607274 /system/framework/arm64/boot-framework.oat (android.view.Choreographer.doFrame+1892)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #12 pc 0000000000698e80 /system/framework/arm64/boot-framework.oat (android.view.Choreographer$FrameDisplayEventReceiver.run+96)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #13 pc 00000000004ec934 /system/framework/arm64/boot-framework.oat (android.os.Handler.dispatchMessage+84)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #14 pc 00000000004efcd8 /system/framework/arm64/boot-framework.oat (android.os.Looper.loopOnce+1032)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #15 pc 00000000004ef830 /system/framework/arm64/boot-framework.oat (android.os.Looper.loop+560)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #16 pc 00000000002d1894 /system/framework/arm64/boot-framework.oat (android.app.ActivityThread.main+1236)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #17 pc 0000000000210c00 /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+576)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #18 pc 000000000027b4ac /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+240)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #19 pc 00000000006105b8 /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::PointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1400)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #20 pc 00000000005900d4 /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+52)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #21 pc 0000000000099148 /system/framework/arm64/boot.oat (art_jni_trampoline+120)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #22 pc 00000000007b7060 /system/framework/arm64/boot-framework.oat (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+144)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #23 pc 00000000007c01ec /system/framework/arm64/boot-framework.oat (com.android.internal.os.ZygoteInit.main+3228)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #24 pc 0000000000210c00 /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+576)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #25 pc 000000000027b4ac /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+240)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #26 pc 0000000000610d40 /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)+452)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #27 pc 000000000061122c /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+96)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #28 pc 00000000004fac28 /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+600)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #29 pc 00000000000bdc04 /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+124)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #30 pc 00000000000c9c10 /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+844)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #31 pc 000000000000255c /system/bin/app_process64 (main+1284)
06-17 01:00:10.649 2510 2510 D setMaxDequeueBufferB: #32 pc 000000000004a878 /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+100)
06-17 01:00:10.952 2510 2956 D setMaxDequeueBufferB: #00 pc 00000000000030b4 /system/lib64/libutilscallstack.so (android::CallStack::CallStack(char const*, int)+88)
06-17 01:00:10.952 2510 2956 D setMaxDequeueBufferB: #01 pc 00000000000895e0 /system/lib64/libgui.so (android::BufferQueueProducer::setMaxDequeuedBufferCount(int)+76)
06-17 01:00:10.952 2510 2956 D setMaxDequeueBufferB: #02 pc 00000000000ea550 /system/lib64/libgui.so (android::Surface::setBufferCount(int)+148)
06-17 01:00:10.952 2510 2956 D setMaxDequeueBufferB: #03 pc 00000000000e7d5c /system/lib64/libgui.so (android::Surface::perform(int, std::__va_list)+1872)
06-17 01:00:10.952 2510 2956 D setMaxDequeueBufferB: #04 pc 00000000000e3bb0 /system/lib64/libgui.so (android::Surface::performInternal(ANativeWindow*, int, std::__va_list)+60)
06-17 01:00:10.952 2510 2956 D setMaxDequeueBufferB: #05 pc 00000000002876a0 /system/lib64/libhwui.so (android::uirenderer::renderthread::ReliableSurface::hook_perform(ANativeWindow*, int (*)(ANativeWindow*, int, std::__va_list), void*, int, std::__va_list)+92)
06-17 01:00:10.952 2510 2956 D setMaxDequeueBufferB: #06 pc 00000000000e2618 /system/lib64/libgui.so (android::Surface::hook_perform(ANativeWindow*, int, ...)+208)
06-17 01:00:10.953 2510 2956 D setMaxDequeueBufferB: #07 pc 0000000000281090 /system/lib64/libhwui.so (android::uirenderer::renderthread::CanvasContext::setupPipelineSurface()+200)
06-17 01:00:10.953 2510 2956 D setMaxDequeueBufferB: #08 pc 0000000000280bdc /system/lib64/libhwui.so (android::uirenderer::renderthread::CanvasContext::setSurface(ANativeWindow*, bool)+180)
06-17 01:00:10.953 2510 2956 D setMaxDequeueBufferB: #09 pc 0000000000292060 /system/lib64/libhwui.so (std::__1::__function::__func<android::uirenderer::renderthread::RenderProxy::setSurface(ANativeWindow*, bool)::$_5, std::__1::allocator<android::uirenderer::renderthread::RenderProxy::setSurface(ANativeWindow*, bool)::$_5>, void ()>::operator()() (.2a0230ca9784b3ed733f337e97c21a2e)+32)
06-17 01:00:10.953 2510 2956 D setMaxDequeueBufferB: #10 pc 0000000000274374 /system/lib64/libhwui.so (android::uirenderer::WorkQueue::process()+588)
06-17 01:00:10.953 2510 2956 D setMaxDequeueBufferB: #11 pc 00000000002950c0 /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+416)
06-17 01:00:10.953 2510 2956 D setMaxDequeueBufferB: #12 pc 0000000000013418 /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+424)
06-17 01:00:10.953 2510 2956 D setMaxDequeueBufferB: #13 pc 00000000000ba2c0 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
06-17 01:00:10.953 2510 2956 D setMaxDequeueBufferB: #14 pc 0000000000053c6c /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68)
BufferQueueConsumer.cpp
@@ -648,6 +654,12 @@ status_t BufferQueueConsumer::setMaxAcquiredBufferCount(
int maxAcquiredBuffers) {
ATRACE_CALL();
+
+
+ android::CallStack cs("setMaxAcquiredBufferCountB",1);
06-17 00:58:14.349 2510 2510 D setMaxAcquiredBufferCountB: #00 pc 00000000000030b4 /system/lib64/libutilscallstack.so (android::CallStack::CallStack(char const*, int)+88)
06-17 00:58:14.349 2510 2510 D setMaxAcquiredBufferCountB: #01 pc 0000000000085030 /system/lib64/libgui.so (android::BufferQueueConsumer::setMaxAcquiredBufferCount(int)+76)
06-17 00:58:14.349 2510 2510 D setMaxAcquiredBufferCountB: #02 pc 00000000000ae714 /system/lib64/libgui.so (android::BufferItemConsumer::BufferItemConsumer(android::sp<android::IGraphicBufferConsumer> const&, unsigned long, int, bool)+124)
06-17 00:58:14.349 2510 2510 D setMaxAcquiredBufferCountB: #03 pc 000000000009e158 /system/lib64/libgui.so (android::BLASTBufferQueue::BLASTBufferQueue(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)+528)
06-17 00:58:14.349 2510 2510 D setMaxAcquiredBufferCountB: #04 pc 000000000014651c /system/lib64/libandroid_runtime.so (android::nativeCreate(_JNIEnv*, _jclass*, _jstring*, unsigned char)+352)
06-17 00:58:14.349 2510 2510 D setMaxAcquiredBufferCountB: #05 pc 00000000001aa2f4 /system/framework/arm64/boot-framework.oat (art_jni_trampoline+132)
06-17 00:58:14.349 2510 2510 D setMaxAcquiredBufferCountB: #06 pc 000000000070a050 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl.updateBlastSurfaceIfNeeded+400)
06-17 00:58:14.349 2510 2510 D setMaxAcquiredBufferCountB: #07 pc 00000000006ff568 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl.relayoutWindow+3144)
06-17 00:58:14.349 2510 2510 D setMaxAcquiredBufferCountB: #08 pc 00000000006fb940 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl.performTraversals+4224)
06-17 00:58:14.349 2510 2510 D setMaxAcquiredBufferCountB: #09 pc 0000000000702a50 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl.doTraversal+224)
06-17 00:58:14.349 2510 2510 D setMaxAcquiredBufferCountB: #10 pc 0000000000626ce4 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl$TraversalRunnable.run+68)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #11 pc 0000000000606854 /system/framework/arm64/boot-framework.oat (android.view.Choreographer.doCallbacks+1252)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #12 pc 0000000000607274 /system/framework/arm64/boot-framework.oat (android.view.Choreographer.doFrame+1892)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #13 pc 0000000000698e80 /system/framework/arm64/boot-framework.oat (android.view.Choreographer$FrameDisplayEventReceiver.run+96)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #14 pc 00000000004ec934 /system/framework/arm64/boot-framework.oat (android.os.Handler.dispatchMessage+84)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #15 pc 00000000004efcd8 /system/framework/arm64/boot-framework.oat (android.os.Looper.loopOnce+1032)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #16 pc 00000000004ef830 /system/framework/arm64/boot-framework.oat (android.os.Looper.loop+560)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #17 pc 00000000002d1894 /system/framework/arm64/boot-framework.oat (android.app.ActivityThread.main+1236)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #18 pc 0000000000210c00 /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+576)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #19 pc 000000000027b4ac /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+240)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #20 pc 00000000006105b8 /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::PointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1400)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #21 pc 00000000005900d4 /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+52)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #22 pc 0000000000099148 /system/framework/arm64/boot.oat (art_jni_trampoline+120)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #23 pc 00000000007b7060 /system/framework/arm64/boot-framework.oat (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+144)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #24 pc 00000000007c01ec /system/framework/arm64/boot-framework.oat (com.android.internal.os.ZygoteInit.main+3228)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #25 pc 0000000000210c00 /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+576)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #26 pc 000000000027b4ac /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+240)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #27 pc 0000000000610d40 /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)+452)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #28 pc 000000000061122c /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+96)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #29 pc 00000000004fac28 /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+600)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #30 pc 00000000000bdc04 /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+124)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #31 pc 00000000000c9c10 /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+844)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #32 pc 000000000000255c /system/bin/app_process64 (main+1284)
06-17 00:58:14.350 2510 2510 D setMaxAcquiredBufferCountB: #33 pc 000000000004a878 /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+100)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #00 pc 00000000000030b4 /system/lib64/libutilscallstack.so (android::CallStack::CallStack(char const*, int)+88)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #01 pc 0000000000085030 /system/lib64/libgui.so (android::BufferQueueConsumer::setMaxAcquiredBufferCount(int)+76)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #02 pc 00000000000b04c0 /system/lib64/libgui.so (android::ConsumerBase::setMaxAcquiredBufferCount(int)+96)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #03 pc 000000000009e658 /system/lib64/libgui.so (android::BLASTBufferQueue::BLASTBufferQueue(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)+1808)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #04 pc 000000000014651c /system/lib64/libandroid_runtime.so (android::nativeCreate(_JNIEnv*, _jclass*, _jstring*, unsigned char)+352)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #05 pc 00000000001aa2f4 /system/framework/arm64/boot-framework.oat (art_jni_trampoline+132)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #06 pc 000000000070a050 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl.updateBlastSurfaceIfNeeded+400)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #07 pc 00000000006ff568 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl.relayoutWindow+3144)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #08 pc 00000000006fb940 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl.performTraversals+4224)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #09 pc 0000000000702a50 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl.doTraversal+224)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #10 pc 0000000000626ce4 /system/framework/arm64/boot-framework.oat (android.view.ViewRootImpl$TraversalRunnable.run+68)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #11 pc 0000000000606854 /system/framework/arm64/boot-framework.oat (android.view.Choreographer.doCallbacks+1252)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #12 pc 0000000000607274 /system/framework/arm64/boot-framework.oat (android.view.Choreographer.doFrame+1892)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #13 pc 0000000000698e80 /system/framework/arm64/boot-framework.oat (android.view.Choreographer$FrameDisplayEventReceiver.run+96)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #14 pc 00000000004ec934 /system/framework/arm64/boot-framework.oat (android.os.Handler.dispatchMessage+84)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #15 pc 00000000004efcd8 /system/framework/arm64/boot-framework.oat (android.os.Looper.loopOnce+1032)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #16 pc 00000000004ef830 /system/framework/arm64/boot-framework.oat (android.os.Looper.loop+560)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #17 pc 00000000002d1894 /system/framework/arm64/boot-framework.oat (android.app.ActivityThread.main+1236)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #18 pc 0000000000210c00 /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+576)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #19 pc 000000000027b4ac /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+240)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #20 pc 00000000006105b8 /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::PointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1400)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #21 pc 00000000005900d4 /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+52)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #22 pc 0000000000099148 /system/framework/arm64/boot.oat (art_jni_trampoline+120)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #23 pc 00000000007b7060 /system/framework/arm64/boot-framework.oat (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+144)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #24 pc 00000000007c01ec /system/framework/arm64/boot-framework.oat (com.android.internal.os.ZygoteInit.main+3228)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #25 pc 0000000000210c00 /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+576)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #26 pc 000000000027b4ac /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+240)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #27 pc 0000000000610d40 /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)+452)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #28 pc 000000000061122c /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+96)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #29 pc 00000000004fac28 /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+600)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #30 pc 00000000000bdc04 /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+124)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #31 pc 00000000000c9c10 /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+844)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #32 pc 000000000000255c /system/bin/app_process64 (main+1284)
06-17 00:58:14.445 2510 2510 D setMaxAcquiredBufferCountB: #33 pc 000000000004a878 /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+100)
获取进程pid tid 进程名
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <string.h>
pid_t pid = getpid();
pid_t tid = syscall(SYS_gettid);
BQ_LOGE("BufferItemConsumer Current process PID: %d-tid:%d", pid,tid);
char procName[256];
char threadName[256];
sprintf(procName, "/proc/%d/cmdline", pid);
sprintf(threadName, "/proc/%d/task/%d/comm", pid,tid);
FILE *file = fopen(procName, "r");
if (file == NULL) {
BQ_LOGE("BufferItemConsumer Failed to open %s", procName);
//return;
}else{
if (fgets(procName, sizeof(procName), file) != NULL) {
BQ_LOGE("BufferItemConsumer Current process name: %s", procName);
}
fclose(file);
}
FILE *file2 = fopen(threadName, "r");
if (file2 == NULL) {
BQ_LOGE("BufferItemConsumer Failed to open %s", threadName);
//return;
}else{
if (fgets(threadName, sizeof(threadName), file2) != NULL) {
BQ_LOGE("BufferItemConsumer Current thread name: %s", threadName);
}
fclose(file2);
}
bool notfound = true;
const char* spec_process_arr[] = {"com.android.systemui","com.android.map",nullptr };
size_t len = sizeof(spec_process_arr) / sizeof(spec_process_arr[0]);
for (int i=0;i<int(len);i++){
if(spec_process_arr[i] != nullptr && strcmp(spec_process_arr[i],procName) == 0)
BQ_LOGE("BufferItemConsumer found bufferCount %d-default is %d",bufferCount,DEFAULT_MAX_BUFFERS);
notfound = false;
}