From 9d4e3d2f42e93e2d12bacabe97d307d30c3c20dd Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Fri, 24 Aug 2012 20:00:51 -0700 Subject: Banish DisplayID from the SurfaceFlinger API. Use only display tokens in the API to refer to new displays. Don't require the caller to specify the display when creating a surface (since in general a surface could be shown on any display). This is intended to be a minimum change just to update the API. Note that SurfaceFlinger still uses DisplayID in a few places internally that might cause some features not to work properly when there are multiple displays (LayerScreenshot, for example). Change-Id: I3d91eec2da406eefd97bcd53655d403ad865a7e6 --- libs/gui/Surface.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libs/gui/Surface.cpp') diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index b9cbfa6d6b..33cc48023e 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -92,6 +92,12 @@ bool SurfaceControl::isSameSurface( return lhs->mSurface->asBinder() == rhs->mSurface->asBinder(); } +status_t SurfaceControl::setLayerStack(int32_t layerStack) { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->setLayerStack(mToken, layerStack); +} status_t SurfaceControl::setLayer(int32_t layer) { status_t err = validate(); if (err < 0) return err; @@ -299,8 +305,11 @@ void Surface::init(const sp& surfaceTexture) setUsage(GraphicBuffer::USAGE_HW_RENDER); } + // TODO: the display metrics should come from the display manager DisplayInfo dinfo; - SurfaceComposerClient::getDisplayInfo(0, &dinfo); + sp display = SurfaceComposerClient::getBuiltInDisplay( + ISurfaceComposer::eDisplayIdMain); + SurfaceComposerClient::getDisplayInfo(display, &dinfo); const_cast(ANativeWindow::xdpi) = dinfo.xdpi; const_cast(ANativeWindow::ydpi) = dinfo.ydpi; const_cast(ANativeWindow::flags) = 0; -- cgit v1.2.3-59-g8ed1b