Add a tool to make calls to SurfaceFlinger
The tool should make the calls to SurfaceFlinger more user friendly and
also document them.
Bug: 269188249
Test: Manually build and call the functions.
Ignore-AOSP-First: sfdo is developed on main as it depends on surfaceflinger which is developed on that branch
Change-Id: I7136c9d7e98175c320dab33369858861831289e6
diff --git a/libs/gui/aidl/android/gui/ISurfaceComposer.aidl b/libs/gui/aidl/android/gui/ISurfaceComposer.aidl
index e1726b7..c2f47fc 100644
--- a/libs/gui/aidl/android/gui/ISurfaceComposer.aidl
+++ b/libs/gui/aidl/android/gui/ISurfaceComposer.aidl
@@ -480,6 +480,30 @@
void setOverrideFrameRate(int uid, float frameRate);
/**
+ * Enables or disables the frame rate overlay in the top left corner.
+ * Requires root or android.permission.HARDWARE_TEST
+ */
+ void enableRefreshRateOverlay(boolean active);
+
+ /**
+ * Enables or disables the debug flash.
+ * Requires root or android.permission.HARDWARE_TEST
+ */
+ void setDebugFlash(int delay);
+
+ /**
+ * Force composite ahead of next VSYNC.
+ * Requires root or android.permission.HARDWARE_TEST
+ */
+ void scheduleComposite();
+
+ /**
+ * Force commit ahead of next VSYNC.
+ * Requires root or android.permission.HARDWARE_TEST
+ */
+ void scheduleCommit();
+
+ /**
* Gets priority of the RenderEngine in SurfaceFlinger.
*/
int getGpuContextPriority();
diff --git a/libs/gui/fuzzer/libgui_fuzzer_utils.h b/libs/gui/fuzzer/libgui_fuzzer_utils.h
index a381687..2643fa7 100644
--- a/libs/gui/fuzzer/libgui_fuzzer_utils.h
+++ b/libs/gui/fuzzer/libgui_fuzzer_utils.h
@@ -150,6 +150,10 @@
MOCK_METHOD(binder::Status, getDisplayDecorationSupport,
(const sp<IBinder>&, std::optional<gui::DisplayDecorationSupport>*), (override));
MOCK_METHOD(binder::Status, setOverrideFrameRate, (int32_t, float), (override));
+ MOCK_METHOD(binder::Status, enableRefreshRateOverlay, (bool), (override));
+ MOCK_METHOD(binder::Status, setDebugFlash, (int), (override));
+ MOCK_METHOD(binder::Status, scheduleComposite, (), (override));
+ MOCK_METHOD(binder::Status, scheduleCommit, (), (override));
MOCK_METHOD(binder::Status, getGpuContextPriority, (int32_t*), (override));
MOCK_METHOD(binder::Status, getMaxAcquiredBufferCount, (int32_t*), (override));
MOCK_METHOD(binder::Status, addWindowInfosListener,
diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp
index e89998f..ffb8622 100644
--- a/libs/gui/tests/Surface_test.cpp
+++ b/libs/gui/tests/Surface_test.cpp
@@ -989,6 +989,16 @@
return binder::Status::ok();
}
+ binder::Status enableRefreshRateOverlay(bool /*active*/) override {
+ return binder::Status::ok();
+ }
+
+ binder::Status setDebugFlash(int /*delay*/) override { return binder::Status::ok(); }
+
+ binder::Status scheduleComposite() override { return binder::Status::ok(); }
+
+ binder::Status scheduleCommit() override { return binder::Status::ok(); }
+
binder::Status getGpuContextPriority(int32_t* /*outPriority*/) override {
return binder::Status::ok();
}