Eliminate the usage of ConfigStore in native/libs/gui.
Ideally modules above SurfaceFlinger should query ConfigStore through
ISurfaceComposer APIs. Previously Surface::getWideColorSupport directly
evaluate wide color support for built-in display, we don't want that, we should
align it with SurfaceFlinger.
This patch essentially creates an API to allow other modules to query whether a
given display is a wide color display. As a result, we must enforce that wide
color display board config together with the wide color modes returned from
hardware composer.
BUG: 123312783
Test: Build, flash and boot. Verify in logcat.
Test: SurfaceFlinger_test --gtest_filter=CredentialsTest.IsWideColorDisplay\*
Change-Id: I0a5e3cc404e5365343adb0c9efaee8c13cc49cfe
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index 00e23f0..1f726b2 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -39,9 +39,6 @@
#include <gui/ISurfaceComposer.h>
#include <private/gui/ComposerService.h>
-#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
-#include <configstore/Utils.h>
-
namespace android {
using ui::ColorMode;
@@ -321,41 +318,14 @@
return NO_ERROR;
}
-using namespace android::hardware::configstore;
-using namespace android::hardware::configstore::V1_0;
-
status_t Surface::getWideColorSupport(bool* supported) {
ATRACE_CALL();
sp<IBinder> display(
composerService()->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain));
- Vector<ColorMode> colorModes;
- status_t err =
- composerService()->getDisplayColorModes(display, &colorModes);
-
- if (err)
- return err;
-
- bool wideColorBoardConfig =
- getBool<ISurfaceFlingerConfigs,
- &ISurfaceFlingerConfigs::hasWideColorDisplay>(false);
-
*supported = false;
- for (ColorMode colorMode : colorModes) {
- switch (colorMode) {
- case ColorMode::DISPLAY_P3:
- case ColorMode::ADOBE_RGB:
- case ColorMode::DCI_P3:
- if (wideColorBoardConfig) {
- *supported = true;
- }
- break;
- default:
- break;
- }
- }
-
- return NO_ERROR;
+ status_t error = composerService()->isWideColorDisplay(display, supported);
+ return error;
}
status_t Surface::getHdrSupport(bool* supported) {