SF: Rename callbacks from SF to Scheduler to more generic name
Scheduler is going to call in SF to request configs on more occasions
than just through idle timer. This CL changes the callback into a more
direct request to either switch to DEFAULT or PERFORMANCE config.
Test: manual
Bug: 127365162
Change-Id: I67c37b6679671a9d998fde3fcfd189d572c784b4
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp
index 5b4af4a..e05c985 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.cpp
+++ b/services/surfaceflinger/Scheduler/Scheduler.cpp
@@ -308,14 +308,10 @@
mLayerHistory.incrementCounter();
}
-void Scheduler::setExpiredIdleTimerCallback(const ExpiredIdleTimerCallback& expiredTimerCallback) {
+void Scheduler::setChangeRefreshRateCallback(
+ const ChangeRefreshRateCallback& changeRefreshRateCallback) {
std::lock_guard<std::mutex> lock(mCallbackLock);
- mExpiredTimerCallback = expiredTimerCallback;
-}
-
-void Scheduler::setResetIdleTimerCallback(const ResetIdleTimerCallback& resetTimerCallback) {
- std::lock_guard<std::mutex> lock(mCallbackLock);
- mResetTimerCallback = resetTimerCallback;
+ mChangeRefreshRateCallback = changeRefreshRateCallback;
}
void Scheduler::updateFrameSkipping(const int64_t skipCount) {
@@ -414,16 +410,18 @@
void Scheduler::resetTimerCallback() {
std::lock_guard<std::mutex> lock(mCallbackLock);
- if (mResetTimerCallback) {
- mResetTimerCallback();
+ if (mChangeRefreshRateCallback) {
+ // We do not notify the applications about config changes when idle timer is reset.
+ mChangeRefreshRateCallback(RefreshRateType::PERFORMANCE, ConfigEvent::None);
ATRACE_INT("ExpiredIdleTimer", 0);
}
}
void Scheduler::expiredTimerCallback() {
std::lock_guard<std::mutex> lock(mCallbackLock);
- if (mExpiredTimerCallback) {
- mExpiredTimerCallback();
+ if (mChangeRefreshRateCallback) {
+ // We do not notify the applications about config changes when idle timer expires.
+ mChangeRefreshRateCallback(RefreshRateType::DEFAULT, ConfigEvent::None);
ATRACE_INT("ExpiredIdleTimer", 1);
}
}