From a7fe3048aaaf8a45337c7355326f2c6b68b70fb0 Mon Sep 17 00:00:00 2001 From: Marin Shalamanov Date: Fri, 29 Jan 2021 21:02:08 +0100 Subject: Rename DisplayConfig to DisplayMode This CL continues the raneming of display "configs" to display "modes". The goal of this is to have the same names as in the java code and the public display APIs. Additionally in this CL we move DisplayConfig (from libui) to the namespace android::ui. This is to prevent conflict with the SurfaceFlinger's internal android::DisplayMode. This is consistent with the neighboring classes which are also in the ui namespace. Also the type of the parameter defaultMode of {s,g}etDesiredDisplayModeSpecs is changed to size_t for consistency with the rest of the code. Appropriate error handling is added for this. Bug: 159590486 Bug: 179158858 Test: presubmit Change-Id: I31e5be1f2223a9ec9340789ce3dc5738eceaf40f --- libs/gui/SurfaceComposerClient.cpp | 47 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'libs/gui/SurfaceComposerClient.cpp') diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 550803d453..4493a21fc3 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #ifndef NO_INPUT #include @@ -1802,52 +1802,51 @@ status_t SurfaceComposerClient::getDisplayInfo(const sp& display, Displ return ComposerService::getComposerService()->getDisplayInfo(display, info); } -status_t SurfaceComposerClient::getDisplayConfigs(const sp& display, - Vector* configs) { - return ComposerService::getComposerService()->getDisplayConfigs(display, configs); +status_t SurfaceComposerClient::getDisplayModes(const sp& display, + Vector* modes) { + return ComposerService::getComposerService()->getDisplayModes(display, modes); } -status_t SurfaceComposerClient::getActiveDisplayConfig(const sp& display, - DisplayConfig* config) { - Vector configs; - status_t result = getDisplayConfigs(display, &configs); +status_t SurfaceComposerClient::getActiveDisplayMode(const sp& display, + ui::DisplayMode* mode) { + Vector modes; + status_t result = getDisplayModes(display, &modes); if (result != NO_ERROR) { return result; } - int activeId = getActiveConfig(display); + int activeId = getActiveDisplayModeId(display); if (activeId < 0) { - ALOGE("No active configuration found"); + ALOGE("No active mode found"); return NAME_NOT_FOUND; } - *config = configs[static_cast(activeId)]; + *mode = modes[static_cast(activeId)]; return NO_ERROR; } -int SurfaceComposerClient::getActiveConfig(const sp& display) { - return ComposerService::getComposerService()->getActiveConfig(display); +int SurfaceComposerClient::getActiveDisplayModeId(const sp& display) { + return ComposerService::getComposerService()->getActiveDisplayModeId(display); } -status_t SurfaceComposerClient::setDesiredDisplayConfigSpecs( - const sp& displayToken, int32_t defaultConfig, bool allowGroupSwitching, +status_t SurfaceComposerClient::setDesiredDisplayModeSpecs( + const sp& displayToken, size_t defaultMode, bool allowGroupSwitching, float primaryRefreshRateMin, float primaryRefreshRateMax, float appRequestRefreshRateMin, float appRequestRefreshRateMax) { return ComposerService::getComposerService() - ->setDesiredDisplayConfigSpecs(displayToken, defaultConfig, allowGroupSwitching, - primaryRefreshRateMin, primaryRefreshRateMax, - appRequestRefreshRateMin, appRequestRefreshRateMax); + ->setDesiredDisplayModeSpecs(displayToken, defaultMode, allowGroupSwitching, + primaryRefreshRateMin, primaryRefreshRateMax, + appRequestRefreshRateMin, appRequestRefreshRateMax); } -status_t SurfaceComposerClient::getDesiredDisplayConfigSpecs( - const sp& displayToken, int32_t* outDefaultConfig, bool* outAllowGroupSwitching, +status_t SurfaceComposerClient::getDesiredDisplayModeSpecs( + const sp& displayToken, size_t* outDefaultMode, bool* outAllowGroupSwitching, float* outPrimaryRefreshRateMin, float* outPrimaryRefreshRateMax, float* outAppRequestRefreshRateMin, float* outAppRequestRefreshRateMax) { return ComposerService::getComposerService() - ->getDesiredDisplayConfigSpecs(displayToken, outDefaultConfig, outAllowGroupSwitching, - outPrimaryRefreshRateMin, outPrimaryRefreshRateMax, - outAppRequestRefreshRateMin, - outAppRequestRefreshRateMax); + ->getDesiredDisplayModeSpecs(displayToken, outDefaultMode, outAllowGroupSwitching, + outPrimaryRefreshRateMin, outPrimaryRefreshRateMax, + outAppRequestRefreshRateMin, outAppRequestRefreshRateMax); } status_t SurfaceComposerClient::getDisplayColorModes(const sp& display, -- cgit v1.2.3-59-g8ed1b