Capture transaction traces before system reboot
Bug: 299937754
Test: bugreport - data/misc/wmtrace/systemRestart_transactions.winscope
Test: go/winscope
Change-Id: Icfb10a9e69fd2ca7f4657564b109f8da126f7dc7
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 3743025..1977ce6 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -3113,6 +3113,10 @@
->removeWindowInfosListener(windowInfosListener,
ComposerServiceAIDL::getComposerService());
}
+
+void SurfaceComposerClient::notifyShutdown() {
+ ComposerServiceAIDL::getComposerService()->notifyShutdown();
+}
// ----------------------------------------------------------------------------
status_t ScreenshotClient::captureDisplay(const DisplayCaptureArgs& captureArgs,
diff --git a/libs/gui/aidl/android/gui/ISurfaceComposer.aidl b/libs/gui/aidl/android/gui/ISurfaceComposer.aidl
index a2549e7..854045a 100644
--- a/libs/gui/aidl/android/gui/ISurfaceComposer.aidl
+++ b/libs/gui/aidl/android/gui/ISurfaceComposer.aidl
@@ -571,4 +571,11 @@
@nullable StalledTransactionInfo getStalledTransactionInfo(int pid);
SchedulingPolicy getSchedulingPolicy();
+
+ /**
+ * Notifies the SurfaceFlinger that the ShutdownThread is running. When it is called,
+ * transaction traces will be captured and writted into a file.
+ * This method should not block the ShutdownThread therefore it's handled asynchronously.
+ */
+ oneway void notifyShutdown();
}
diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h
index 49b0a7d..64fbb43 100644
--- a/libs/gui/include/gui/SurfaceComposerClient.h
+++ b/libs/gui/include/gui/SurfaceComposerClient.h
@@ -825,6 +825,8 @@
nullptr);
status_t removeWindowInfosListener(const sp<gui::WindowInfosListener>& windowInfosListener);
+ static void notifyShutdown();
+
protected:
ReleaseCallbackThread mReleaseCallbackThread;
diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp
index f4b059c..8aec030 100644
--- a/libs/gui/tests/Surface_test.cpp
+++ b/libs/gui/tests/Surface_test.cpp
@@ -984,6 +984,8 @@
return binder::Status::ok();
}
+ binder::Status notifyShutdown() override { return binder::Status::ok(); }
+
protected:
IBinder* onAsBinder() override { return nullptr; }