From 838de0622c700345fbfde270c065fdc97f4b9428 Mon Sep 17 00:00:00 2001 From: Ady Abraham Date: Mon, 4 Feb 2019 10:24:03 -0800 Subject: SurfaceFlinger: add setAllowedDisplayConfigs Add an API to ISurfaceComposer to set allowed display configurations. This API is expected to be called by DisplayManager depends on the current policy in place. Once setAllowedDisplayConfigs is called, SF can only set a new display config if it is part of the allowed configurations list. Test: call setAllowedDisplayConfigs() from backdoor and observe config change. Bug: 122905403 Change-Id: I1d0a3649bbe7a08efeb72dc270f0b2df330b021c --- libs/gui/include/gui/ISurfaceComposer.h | 10 +++++++++- libs/gui/include/gui/SurfaceComposerClient.h | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'libs/gui/include') diff --git a/libs/gui/include/gui/ISurfaceComposer.h b/libs/gui/include/gui/ISurfaceComposer.h index e6700e77d..0d5b7679e 100644 --- a/libs/gui/include/gui/ISurfaceComposer.h +++ b/libs/gui/include/gui/ISurfaceComposer.h @@ -359,6 +359,14 @@ public: * Removes a listener that was streaming median luma updates from SurfaceFlinger. */ virtual status_t removeRegionSamplingListener(const sp& listener) = 0; + + /* + * Sets the allowed display configurations to be used. + * The allowedConfigs in a vector of indexes corresponding to the configurations + * returned from getDisplayConfigs(). + */ + virtual status_t setAllowedDisplayConfigs(const sp& displayToken, + const std::vector& allowedConfigs) = 0; }; // ---------------------------------------------------------------------------- @@ -406,7 +414,7 @@ public: GET_PHYSICAL_DISPLAY_IDS, ADD_REGION_SAMPLING_LISTENER, REMOVE_REGION_SAMPLING_LISTENER, - + SET_ALLOWED_DISPLAY_CONFIGS, // Always append new enum to the end. }; diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h index cb38209f6..3c52b105b 100644 --- a/libs/gui/include/gui/SurfaceComposerClient.h +++ b/libs/gui/include/gui/SurfaceComposerClient.h @@ -111,6 +111,12 @@ public: // returned by getDisplayInfo static status_t setActiveConfig(const sp& display, int id); + // Sets the allowed display configurations to be used. + // The allowedConfigs in a vector of indexes corresponding to the configurations + // returned from getDisplayConfigs(). + static status_t setAllowedDisplayConfigs(const sp& displayToken, + const std::vector& allowedConfigs); + // Gets the list of supported color modes for the given display static status_t getDisplayColorModes(const sp& display, Vector* outColorModes); -- cgit v1.2.3