SF: Rename functions related to mode switching
This change renames several function in SF in order to increase
readibility.
* performSetActiveMode --> setActiveModeInHwcIfNeeded
* setActiveModeInternal --> updateInternalStateWithChangedMode
* setActiveMode --> setActiveModeFromBackdoor
This CL doesn't change behaviour.
Bug: 190982486
Test: m
Change-Id: I2723f66302016ffc196530f2000fce4a44524fb4
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 45e0a3f..095d5a8 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1102,7 +1102,7 @@
}
}
-status_t SurfaceFlinger::setActiveMode(const sp<IBinder>& displayToken, int modeId) {
+status_t SurfaceFlinger::setActiveModeFromBackdoor(const sp<IBinder>& displayToken, int modeId) {
ATRACE_CALL();
if (!displayToken) {
@@ -1143,7 +1143,7 @@
return future.get();
}
-void SurfaceFlinger::setActiveModeInternal() {
+void SurfaceFlinger::updateInternalStateWithChangedMode() {
ATRACE_CALL();
const auto display = getDefaultDisplayDeviceLocked();
@@ -1198,9 +1198,8 @@
updatePhaseConfiguration(refreshRate);
}
-void SurfaceFlinger::performSetActiveMode() {
+void SurfaceFlinger::setActiveModeInHwcIfNeeded() {
ATRACE_CALL();
- ALOGV("%s", __FUNCTION__);
for (const auto& iter : mDisplays) {
const auto& display = iter.second;
@@ -1235,8 +1234,7 @@
to_string(display->getId()).c_str());
if (display->getActiveMode()->getId() == desiredActiveMode->mode->getId()) {
- // display is not valid or we are already in the requested mode
- // on both cases there is nothing left to do
+ // we are already in the requested mode, there is nothing left to do
desiredActiveModeChangeDone(display);
continue;
}
@@ -1935,7 +1933,7 @@
// We received the present fence from the HWC, so we assume it successfully updated
// the mode, hence we update SF.
mSetActiveModePending = false;
- ON_MAIN_THREAD(setActiveModeInternal());
+ ON_MAIN_THREAD(updateInternalStateWithChangedMode());
}
if (framePending) {
@@ -2002,7 +2000,7 @@
mScheduler->chooseRefreshRateForContent();
}
- ON_MAIN_THREAD(performSetActiveMode());
+ ON_MAIN_THREAD(setActiveModeInHwcIfNeeded());
updateCursorAsync();
updateInputFlinger();
@@ -5611,7 +5609,7 @@
}();
mDebugDisplayModeSetByBackdoor = false;
- const status_t result = setActiveMode(display, modeId);
+ const status_t result = setActiveModeFromBackdoor(display, modeId);
mDebugDisplayModeSetByBackdoor = result == NO_ERROR;
return result;
}
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 6093be9..53cbcab 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -659,13 +659,13 @@
void onInitializeDisplays() REQUIRES(mStateLock);
// Sets the desired active mode bit. It obtains the lock, and sets mDesiredActiveMode.
void setDesiredActiveMode(const ActiveModeInfo& info) REQUIRES(mStateLock);
- status_t setActiveMode(const sp<IBinder>& displayToken, int id);
+ status_t setActiveModeFromBackdoor(const sp<IBinder>& displayToken, int id);
// Once HWC has returned the present fence, this sets the active mode and a new refresh
// rate in SF.
- void setActiveModeInternal() REQUIRES(mStateLock);
+ void updateInternalStateWithChangedMode() REQUIRES(mStateLock);
// Calls to setActiveMode on the main thread if there is a pending mode change
// that needs to be applied.
- void performSetActiveMode() REQUIRES(mStateLock);
+ void setActiveModeInHwcIfNeeded() REQUIRES(mStateLock);
void clearDesiredActiveModeState(const sp<DisplayDevice>&) REQUIRES(mStateLock);
// Called when active mode is no longer is progress
void desiredActiveModeChangeDone(const sp<DisplayDevice>&) REQUIRES(mStateLock);