fix libgui header location

Change-Id: Iec71706cdd4f29c6904993648ce873e83ef9cafe
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h
index 039e7b0..8c21a28 100644
--- a/include/gui/BufferQueue.h
+++ b/include/gui/BufferQueue.h
@@ -19,9 +19,9 @@
 
 #include <EGL/egl.h>
 
+#include <gui/IGraphicBufferAlloc.h>
 #include <gui/ISurfaceTexture.h>
 
-#include <surfaceflinger/IGraphicBufferAlloc.h>
 #include <ui/GraphicBuffer.h>
 
 #include <utils/String8.h>
diff --git a/include/gui/IGraphicBufferAlloc.h b/include/gui/IGraphicBufferAlloc.h
new file mode 100644
index 0000000..cee41d9
--- /dev/null
+++ b/include/gui/IGraphicBufferAlloc.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_GUI_IGRAPHIC_BUFFER_ALLOC_H
+#define ANDROID_GUI_IGRAPHIC_BUFFER_ALLOC_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <binder/IInterface.h>
+#include <ui/PixelFormat.h>
+#include <utils/RefBase.h>
+
+namespace android {
+// ----------------------------------------------------------------------------
+
+class GraphicBuffer;
+
+class IGraphicBufferAlloc : public IInterface
+{
+public:
+    DECLARE_META_INTERFACE(GraphicBufferAlloc);
+
+    /* Create a new GraphicBuffer for the client to use.
+     */
+    virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
+            PixelFormat format, uint32_t usage, status_t* error) = 0;
+};
+
+// ----------------------------------------------------------------------------
+
+class BnGraphicBufferAlloc : public BnInterface<IGraphicBufferAlloc>
+{
+public:
+    virtual status_t    onTransact( uint32_t code,
+                                    const Parcel& data,
+                                    Parcel* reply,
+                                    uint32_t flags = 0);
+};
+
+// ----------------------------------------------------------------------------
+
+}; // namespace android
+
+#endif // ANDROID_GUI_IGRAPHIC_BUFFER_ALLOC_H
diff --git a/include/gui/ISurface.h b/include/gui/ISurface.h
new file mode 100644
index 0000000..c0ff9fc
--- /dev/null
+++ b/include/gui/ISurface.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_GUI_ISURFACE_H
+#define ANDROID_GUI_ISURFACE_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <utils/Errors.h>
+#include <utils/RefBase.h>
+
+#include <binder/IInterface.h>
+
+#include <ui/PixelFormat.h>
+
+namespace android {
+
+typedef int32_t    SurfaceID;
+
+class ISurfaceTexture;
+
+class ISurface : public IInterface
+{
+protected:
+    enum {
+        GET_SURFACE_TEXTURE = IBinder::FIRST_CALL_TRANSACTION,
+    };
+
+public: 
+    DECLARE_META_INTERFACE(Surface);
+
+    virtual sp<ISurfaceTexture> getSurfaceTexture() const = 0;
+};
+
+// ----------------------------------------------------------------------------
+
+class BnSurface : public BnInterface<ISurface>
+{
+public:
+    virtual status_t    onTransact( uint32_t code,
+                                    const Parcel& data,
+                                    Parcel* reply,
+                                    uint32_t flags = 0);
+};
+
+// ----------------------------------------------------------------------------
+
+}; // namespace android
+
+#endif // ANDROID_GUI_ISURFACE_H
diff --git a/include/gui/ISurfaceComposer.h b/include/gui/ISurfaceComposer.h
new file mode 100644
index 0000000..f3c0ecb
--- /dev/null
+++ b/include/gui/ISurfaceComposer.h
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_GUI_ISURFACE_COMPOSER_H
+#define ANDROID_GUI_ISURFACE_COMPOSER_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <utils/RefBase.h>
+#include <utils/Errors.h>
+
+#include <binder/IInterface.h>
+
+#include <ui/PixelFormat.h>
+
+#include <gui/IGraphicBufferAlloc.h>
+#include <gui/ISurfaceComposerClient.h>
+
+namespace android {
+// ----------------------------------------------------------------------------
+
+class ComposerState;
+class IDisplayEventConnection;
+class IMemoryHeap;
+
+class ISurfaceComposer : public IInterface
+{
+public:
+    DECLARE_META_INTERFACE(SurfaceComposer);
+
+    enum { // (keep in sync with Surface.java)
+        eHidden             = 0x00000004,
+        eDestroyBackbuffer  = 0x00000020,
+        eSecure             = 0x00000080,
+        eNonPremultiplied   = 0x00000100,
+        eOpaque             = 0x00000400,
+        eProtectedByApp     = 0x00000800,
+        eProtectedByDRM     = 0x00001000,
+
+        eFXSurfaceNormal    = 0x00000000,
+        eFXSurfaceBlur      = 0x00010000,
+        eFXSurfaceDim       = 0x00020000,
+        eFXSurfaceScreenshot= 0x00030000,
+        eFXSurfaceMask      = 0x000F0000,
+    };
+
+    enum {
+        ePositionChanged            = 0x00000001,
+        eLayerChanged               = 0x00000002,
+        eSizeChanged                = 0x00000004,
+        eAlphaChanged               = 0x00000008,
+        eMatrixChanged              = 0x00000010,
+        eTransparentRegionChanged   = 0x00000020,
+        eVisibilityChanged          = 0x00000040,
+        eFreezeTintChanged          = 0x00000080,
+    };
+
+    enum {
+        eLayerHidden        = 0x01,
+        eLayerFrozen        = 0x02,
+        eLayerDither        = 0x04,
+        eLayerFilter        = 0x08,
+        eLayerBlurFreeze    = 0x10
+    };
+
+    enum {
+        eOrientationDefault     = 0,
+        eOrientation90          = 1,
+        eOrientation180         = 2,
+        eOrientation270         = 3,
+        eOrientationUnchanged   = 4,
+        eOrientationSwapMask    = 0x01
+    };
+
+    enum {
+        eSynchronous            = 0x01,
+    };
+
+    enum {
+        eElectronBeamAnimationOn  = 0x01,
+        eElectronBeamAnimationOff = 0x10
+    };
+
+    /* create connection with surface flinger, requires
+     * ACCESS_SURFACE_FLINGER permission
+     */
+    virtual sp<ISurfaceComposerClient> createConnection() = 0;
+
+    /* create a graphic buffer allocator
+     */
+    virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc() = 0;
+
+    /* retrieve the control block */
+    virtual sp<IMemoryHeap> getCblk() const = 0;
+
+    /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
+    virtual void setTransactionState(const Vector<ComposerState>& state,
+            int orientation, uint32_t flags) = 0;
+
+    /* signal that we're done booting.
+     * Requires ACCESS_SURFACE_FLINGER permission
+     */
+    virtual void bootFinished() = 0;
+
+    /* Capture the specified screen. requires READ_FRAME_BUFFER permission
+     * This function will fail if there is a secure window on screen.
+     */
+    virtual status_t captureScreen(DisplayID dpy,
+            sp<IMemoryHeap>* heap,
+            uint32_t* width, uint32_t* height, PixelFormat* format,
+            uint32_t reqWidth, uint32_t reqHeight,
+            uint32_t minLayerZ, uint32_t maxLayerZ) = 0;
+
+    /* triggers screen off animation */
+    virtual status_t turnElectronBeamOff(int32_t mode) = 0;
+
+    /* triggers screen on animation */
+    virtual status_t turnElectronBeamOn(int32_t mode) = 0;
+
+    /* verify that an ISurfaceTexture was created by SurfaceFlinger.
+     */
+    virtual bool authenticateSurfaceTexture(
+            const sp<ISurfaceTexture>& surface) const = 0;
+
+    /* return an IDisplayEventConnection */
+    virtual sp<IDisplayEventConnection> createDisplayEventConnection() = 0;
+};
+
+// ----------------------------------------------------------------------------
+
+class BnSurfaceComposer : public BnInterface<ISurfaceComposer>
+{
+public:
+    enum {
+        // Note: BOOT_FINISHED must remain this value, it is called from
+        // Java by ActivityManagerService.
+        BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
+        CREATE_CONNECTION,
+        CREATE_GRAPHIC_BUFFER_ALLOC,
+        GET_CBLK,
+        SET_TRANSACTION_STATE,
+        SET_ORIENTATION,
+        CAPTURE_SCREEN,
+        TURN_ELECTRON_BEAM_OFF,
+        TURN_ELECTRON_BEAM_ON,
+        AUTHENTICATE_SURFACE,
+        CREATE_DISPLAY_EVENT_CONNECTION,
+    };
+
+    virtual status_t    onTransact( uint32_t code,
+                                    const Parcel& data,
+                                    Parcel* reply,
+                                    uint32_t flags = 0);
+};
+
+// ----------------------------------------------------------------------------
+
+}; // namespace android
+
+#endif // ANDROID_GUI_ISURFACE_COMPOSER_H
diff --git a/include/gui/ISurfaceComposerClient.h b/include/gui/ISurfaceComposerClient.h
new file mode 100644
index 0000000..c793933
--- /dev/null
+++ b/include/gui/ISurfaceComposerClient.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
+#define ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <utils/Errors.h>
+#include <utils/RefBase.h>
+
+#include <binder/IInterface.h>
+
+#include <ui/PixelFormat.h>
+
+#include <gui/ISurface.h>
+
+namespace android {
+
+// ----------------------------------------------------------------------------
+
+typedef int32_t    DisplayID;
+
+// ----------------------------------------------------------------------------
+
+class ISurfaceComposerClient : public IInterface
+{
+public:
+    DECLARE_META_INTERFACE(SurfaceComposerClient);
+
+    struct surface_data_t {
+        int32_t             token;
+        int32_t             identity;
+        status_t readFromParcel(const Parcel& parcel);
+        status_t writeToParcel(Parcel* parcel) const;
+    };
+
+    /*
+     * Requires ACCESS_SURFACE_FLINGER permission
+     */
+    virtual sp<ISurface> createSurface( surface_data_t* data,
+                                        const String8& name,
+                                        DisplayID display,
+                                        uint32_t w,
+                                        uint32_t h,
+                                        PixelFormat format,
+                                        uint32_t flags) = 0;
+
+    /*
+     * Requires ACCESS_SURFACE_FLINGER permission
+     */
+    virtual status_t    destroySurface(SurfaceID sid) = 0;
+};
+
+// ----------------------------------------------------------------------------
+
+class BnSurfaceComposerClient : public BnInterface<ISurfaceComposerClient>
+{
+public:
+    virtual status_t    onTransact( uint32_t code,
+                                    const Parcel& data,
+                                    Parcel* reply,
+                                    uint32_t flags = 0);
+};
+
+// ----------------------------------------------------------------------------
+
+}; // namespace android
+
+#endif // ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
new file mode 100644
index 0000000..1f90c59
--- /dev/null
+++ b/include/gui/Surface.h
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_GUI_SURFACE_H
+#define ANDROID_GUI_SURFACE_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <utils/KeyedVector.h>
+#include <utils/RefBase.h>
+#include <utils/threads.h>
+
+#include <ui/PixelFormat.h>
+#include <ui/Region.h>
+
+#include <gui/SurfaceTextureClient.h>
+#include <gui/ISurface.h>
+#include <gui/ISurfaceComposerClient.h>
+
+#define ANDROID_VIEW_SURFACE_JNI_ID    "mNativeSurface"
+
+namespace android {
+
+// ---------------------------------------------------------------------------
+
+class ISurfaceTexture;
+class Surface;
+class SurfaceComposerClient;
+
+// ---------------------------------------------------------------------------
+
+class SurfaceControl : public RefBase
+{
+public:
+    static bool isValid(const sp<SurfaceControl>& surface) {
+        return (surface != 0) && surface->isValid();
+    }
+    bool isValid() {
+        return mToken>=0 && mClient!=0;
+    }
+    static bool isSameSurface(
+            const sp<SurfaceControl>& lhs, const sp<SurfaceControl>& rhs);
+        
+    uint32_t    getIdentity() const { return mIdentity; }
+
+    // release surface data from java
+    void        clear();
+    
+    status_t    setLayer(int32_t layer);
+    status_t    setPosition(int32_t x, int32_t y);
+    status_t    setSize(uint32_t w, uint32_t h);
+    status_t    hide();
+    status_t    show(int32_t layer = -1);
+    status_t    freeze();
+    status_t    unfreeze();
+    status_t    setFlags(uint32_t flags, uint32_t mask);
+    status_t    setTransparentRegionHint(const Region& transparent);
+    status_t    setAlpha(float alpha=1.0f);
+    status_t    setMatrix(float dsdx, float dtdx, float dsdy, float dtdy);
+    status_t    setFreezeTint(uint32_t tint);
+
+    static status_t writeSurfaceToParcel(
+            const sp<SurfaceControl>& control, Parcel* parcel);
+
+    sp<Surface> getSurface() const;
+
+private:
+    // can't be copied
+    SurfaceControl& operator = (SurfaceControl& rhs);
+    SurfaceControl(const SurfaceControl& rhs);
+
+    friend class SurfaceComposerClient;
+    friend class Surface;
+
+    SurfaceControl(
+            const sp<SurfaceComposerClient>& client,
+            const sp<ISurface>& surface,
+            const ISurfaceComposerClient::surface_data_t& data);
+
+    ~SurfaceControl();
+
+    status_t validate() const;
+    void destroy();
+    
+    sp<SurfaceComposerClient>   mClient;
+    sp<ISurface>                mSurface;
+    SurfaceID                   mToken;
+    uint32_t                    mIdentity;
+    mutable Mutex               mLock;
+    
+    mutable sp<Surface>         mSurfaceData;
+};
+    
+// ---------------------------------------------------------------------------
+
+class Surface : public SurfaceTextureClient
+{
+public:
+    struct SurfaceInfo {
+        uint32_t    w;
+        uint32_t    h;
+        uint32_t    s;
+        uint32_t    usage;
+        PixelFormat format;
+        void*       bits;
+        uint32_t    reserved[2];
+    };
+
+    explicit Surface(const sp<ISurfaceTexture>& st);
+
+    static status_t writeToParcel(const sp<Surface>& control, Parcel* parcel);
+
+    static sp<Surface> readFromParcel(const Parcel& data);
+    static bool isValid(const sp<Surface>& surface) {
+        return (surface != 0) && surface->isValid();
+    }
+
+    bool        isValid();
+    uint32_t    getIdentity() const { return mIdentity; }
+    sp<ISurfaceTexture> getSurfaceTexture();
+
+    // the lock/unlock APIs must be used from the same thread
+    status_t    lock(SurfaceInfo* info, Region* dirty = NULL);
+    status_t    unlockAndPost();
+
+    sp<IBinder> asBinder() const;
+
+private:
+    // this is just to be able to write some unit tests
+    friend class Test;
+    friend class SurfaceControl;
+
+    // can't be copied
+    Surface& operator = (Surface& rhs);
+    Surface(const Surface& rhs);
+
+    explicit Surface(const sp<SurfaceControl>& control);
+    Surface(const Parcel& data, const sp<IBinder>& ref);
+    ~Surface();
+
+    /*
+     *  private stuff...
+     */
+    void init(const sp<ISurfaceTexture>& surfaceTexture);
+
+    static void cleanCachedSurfacesLocked();
+
+    virtual int query(int what, int* value) const;
+
+    // constants
+    sp<ISurface>                mSurface;
+    uint32_t                    mIdentity;
+
+    // A cache of Surface objects that have been deserialized into this process.
+    static Mutex sCachedSurfacesLock;
+    static DefaultKeyedVector<wp<IBinder>, wp<Surface> > sCachedSurfaces;
+};
+
+}; // namespace android
+
+#endif // ANDROID_GUI_SURFACE_H
diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h
new file mode 100644
index 0000000..d971031
--- /dev/null
+++ b/include/gui/SurfaceComposerClient.h
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_GUI_SURFACE_COMPOSER_CLIENT_H
+#define ANDROID_GUI_SURFACE_COMPOSER_CLIENT_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <binder/IBinder.h>
+
+#include <utils/RefBase.h>
+#include <utils/Singleton.h>
+#include <utils/SortedVector.h>
+#include <utils/threads.h>
+
+#include <ui/PixelFormat.h>
+
+#include <gui/Surface.h>
+
+namespace android {
+
+// ---------------------------------------------------------------------------
+
+class DisplayInfo;
+class Composer;
+class IMemoryHeap;
+class ISurfaceComposerClient;
+class Region;
+
+// ---------------------------------------------------------------------------
+
+class SurfaceComposerClient : public RefBase
+{
+    friend class Composer;
+public:    
+                SurfaceComposerClient();
+    virtual     ~SurfaceComposerClient();
+
+    // Always make sure we could initialize
+    status_t    initCheck() const;
+
+    // Return the connection of this client
+    sp<IBinder> connection() const;
+    
+    // Forcibly remove connection before all references have gone away.
+    void        dispose();
+
+    // ------------------------------------------------------------------------
+    // surface creation / destruction
+
+    //! Create a surface
+    sp<SurfaceControl> createSurface(
+            const String8& name,// name of the surface
+            DisplayID display,  // Display to create this surface on
+            uint32_t w,         // width in pixel
+            uint32_t h,         // height in pixel
+            PixelFormat format, // pixel-format desired
+            uint32_t flags = 0  // usage flags
+    );
+
+    sp<SurfaceControl> createSurface(
+            DisplayID display,  // Display to create this surface on
+            uint32_t w,         // width in pixel
+            uint32_t h,         // height in pixel
+            PixelFormat format, // pixel-format desired
+            uint32_t flags = 0  // usage flags
+    );
+
+
+    // ------------------------------------------------------------------------
+    // Composer parameters
+    // All composer parameters must be changed within a transaction
+    // several surfaces can be updated in one transaction, all changes are
+    // committed at once when the transaction is closed.
+    // closeGlobalTransaction() usually requires an IPC with the server.
+
+    //! Open a composer transaction on all active SurfaceComposerClients.
+    static void openGlobalTransaction();
+        
+    //! Close a composer transaction on all active SurfaceComposerClients.
+    static void closeGlobalTransaction(bool synchronous = false);
+    
+    //! Freeze the specified display but not transactions.
+    static status_t freezeDisplay(DisplayID dpy, uint32_t flags = 0);
+        
+    //! Resume updates on the specified display.
+    static status_t unfreezeDisplay(DisplayID dpy, uint32_t flags = 0);
+
+    //! Set the orientation of the given display
+    static int setOrientation(DisplayID dpy, int orientation, uint32_t flags);
+
+    // Query the number of displays
+    static ssize_t getNumberOfDisplays();
+
+    // Get information about a display
+    static status_t getDisplayInfo(DisplayID dpy, DisplayInfo* info);
+    static ssize_t getDisplayWidth(DisplayID dpy);
+    static ssize_t getDisplayHeight(DisplayID dpy);
+    static ssize_t getDisplayOrientation(DisplayID dpy);
+
+    status_t linkToComposerDeath(const sp<IBinder::DeathRecipient>& recipient,
+            void* cookie = NULL, uint32_t flags = 0);
+
+    status_t    hide(SurfaceID id);
+    status_t    show(SurfaceID id, int32_t layer = -1);
+    status_t    freeze(SurfaceID id);
+    status_t    unfreeze(SurfaceID id);
+    status_t    setFlags(SurfaceID id, uint32_t flags, uint32_t mask);
+    status_t    setTransparentRegionHint(SurfaceID id, const Region& transparent);
+    status_t    setLayer(SurfaceID id, int32_t layer);
+    status_t    setAlpha(SurfaceID id, float alpha=1.0f);
+    status_t    setFreezeTint(SurfaceID id, uint32_t tint);
+    status_t    setMatrix(SurfaceID id, float dsdx, float dtdx, float dsdy, float dtdy);
+    status_t    setPosition(SurfaceID id, float x, float y);
+    status_t    setSize(SurfaceID id, uint32_t w, uint32_t h);
+    status_t    destroySurface(SurfaceID sid);
+
+private:
+    virtual void onFirstRef();
+    Composer& getComposer();
+
+    mutable     Mutex                       mLock;
+                status_t                    mStatus;
+                sp<ISurfaceComposerClient>  mClient;
+                Composer&                   mComposer;
+};
+
+// ---------------------------------------------------------------------------
+
+class ScreenshotClient
+{
+    sp<IMemoryHeap> mHeap;
+    uint32_t mWidth;
+    uint32_t mHeight;
+    PixelFormat mFormat;
+public:
+    ScreenshotClient();
+
+    // frees the previous screenshot and capture a new one
+    status_t update();
+    status_t update(uint32_t reqWidth, uint32_t reqHeight);
+    status_t update(uint32_t reqWidth, uint32_t reqHeight,
+            uint32_t minLayerZ, uint32_t maxLayerZ);
+
+    // release memory occupied by the screenshot
+    void release();
+
+    // pixels are valid until this object is freed or
+    // release() or update() is called
+    void const* getPixels() const;
+
+    uint32_t getWidth() const;
+    uint32_t getHeight() const;
+    PixelFormat getFormat() const;
+    uint32_t getStride() const;
+    // size of allocated memory in bytes
+    size_t getSize() const;
+};
+
+// ---------------------------------------------------------------------------
+}; // namespace android
+
+#endif // ANDROID_GUI_SURFACE_COMPOSER_CLIENT_H