Enable changing display configuration
This allows querying and switching display device configurations
through the ISurfaceComposer/SurfaceComposerClient interface.
Bug: 14320401
Change-Id: I8c22165698950e5da32204c1c4da92122f91a715
diff --git a/include/gui/ISurfaceComposer.h b/include/gui/ISurfaceComposer.h
index efde5db..8042211 100644
--- a/include/gui/ISurfaceComposer.h
+++ b/include/gui/ISurfaceComposer.h
@@ -113,9 +113,18 @@
*/
virtual void unblank(const sp<IBinder>& display) = 0;
- /* returns information about a display
+ /* returns information for each configuration of the given display
* intended to be used to get information about built-in displays */
- virtual status_t getDisplayInfo(const sp<IBinder>& display, DisplayInfo* info) = 0;
+ virtual status_t getDisplayConfigs(const sp<IBinder>& display,
+ Vector<DisplayInfo>* configs) = 0;
+
+ /* indicates which of the configurations returned by getDisplayInfo is
+ * currently active */
+ virtual int getActiveConfig(const sp<IBinder>& display) = 0;
+
+ /* specifies which configuration (of those returned by getDisplayInfo)
+ * should be used */
+ virtual status_t setActiveConfig(const sp<IBinder>& display, int id) = 0;
/* Capture the specified screen. requires READ_FRAME_BUFFER permission
* This function will fail if there is a secure window on screen.
@@ -158,7 +167,9 @@
AUTHENTICATE_SURFACE,
BLANK,
UNBLANK,
- GET_DISPLAY_INFO,
+ GET_DISPLAY_CONFIGS,
+ GET_ACTIVE_CONFIG,
+ SET_ACTIVE_CONFIG,
CONNECT_DISPLAY,
CAPTURE_SCREEN,
CLEAR_ANIMATION_FRAME_STATS,
diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h
index 6a53ccb..c2192af 100644
--- a/include/gui/SurfaceComposerClient.h
+++ b/include/gui/SurfaceComposerClient.h
@@ -66,8 +66,21 @@
status_t linkToComposerDeath(const sp<IBinder::DeathRecipient>& recipient,
void* cookie = NULL, uint32_t flags = 0);
- // Get information about a display
- static status_t getDisplayInfo(const sp<IBinder>& display, DisplayInfo* info);
+ // Get a list of supported configurations for a given display
+ static status_t getDisplayConfigs(const sp<IBinder>& display,
+ Vector<DisplayInfo>* configs);
+
+ // Get the DisplayInfo for the currently-active configuration
+ static status_t getDisplayInfo(const sp<IBinder>& display,
+ DisplayInfo* info);
+
+ // Get the index of the current active configuration (relative to the list
+ // returned by getDisplayInfo)
+ static int getActiveConfig(const sp<IBinder>& display);
+
+ // Set a new active configuration using an index relative to the list
+ // returned by getDisplayInfo
+ static status_t setActiveConfig(const sp<IBinder>& display, int id);
/* triggers screen off and waits for it to complete */
static void blankDisplay(const sp<IBinder>& display);