Add plumbing for upcoming setFrameRate() api
Add plumbing from the app to surface flinger for the
ANativeWindow_setFrameRate() and ASurfaceTransaction_setFrameRate() api
calls we'll be adding soon.
We don't do anything in surface flinger with this data yet.
Bug: 143912624
Test: Added a new test, SetFrameRateTest.
Change-Id: I1cab87f3ce5afca4591a39d8e7a42cb1e86a368f
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index 9f91d9d..515f45c 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -363,6 +363,24 @@
return OK;
}
+status_t ConsumerBase::setFrameRate(float frameRate) {
+ Mutex::Autolock _l(mMutex);
+ if (mAbandoned) {
+ CB_LOGE("setFrameRate: ConsumerBase is abandoned!");
+ return NO_INIT;
+ }
+ return mConsumer->setFrameRate(frameRate);
+}
+
+status_t ConsumerBase::getFrameRate(float* frameRate) {
+ Mutex::Autolock _l(mMutex);
+ if (mAbandoned) {
+ CB_LOGE("getFrameRate: ConsumerBase is abandoned!");
+ return NO_INIT;
+ }
+ return mConsumer->getFrameRate(frameRate);
+}
+
void ConsumerBase::dumpState(String8& result) const {
dumpState(result, "");
}