SF: remove IComposer.dumpDebugInfo
aidl already have a dump funciton, so there is no need to
expose a custom dumpDebugInfo from IComposer.
Bug: 220171623
Test: atest VtsHalGraphicsComposer3_TargetTest
Test: adb shell dumpsys SurfaceFlinger
Test: adb shell dumpsys android.hardware.graphics.composer3.IComposer/default
Change-Id: Ifaf91e74b01230c5926fc43619cada80deaa1630
diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
index 8d67954..b2d7a7a 100644
--- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
+++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
@@ -20,6 +20,7 @@
#include "AidlComposerHal.h"
+#include <android-base/file.h>
#include <android/binder_ibinder_platform.h>
#include <android/binder_manager.h>
#include <log/log.h>
@@ -262,13 +263,27 @@
}
std::string AidlComposer::dumpDebugInfo() {
- std::string info;
- const auto status = mAidlComposer->dumpDebugInfo(&info);
- if (!status.isOk()) {
- ALOGE("dumpDebugInfo failed %s", status.getDescription().c_str());
+ int pipefds[2];
+ int result = pipe(pipefds);
+ if (result < 0) {
+ ALOGE("dumpDebugInfo: pipe failed: %s", strerror(errno));
return {};
}
- return info;
+
+ std::string str;
+ const auto status = mAidlComposer->dump(pipefds[1], /*args*/ nullptr, /*numArgs*/ 0);
+ // Close the write-end of the pipe to make sure that when reading from the
+ // read-end we will get eof instead of blocking forever
+ close(pipefds[1]);
+
+ if (status == STATUS_OK) {
+ base::ReadFdToString(pipefds[0], &str);
+ } else {
+ ALOGE("dumpDebugInfo: dump failed: %d", status);
+ }
+
+ close(pipefds[0]);
+ return str;
}
void AidlComposer::registerCallback(HWC2::ComposerCallback& callback) {