ISurfaceComposerClient.h revision 9d4e3d2f42e93e2d12bacabe97d307d30c3c20dd
1/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
18#define ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
23#include <utils/Errors.h>
24#include <utils/RefBase.h>
25
26#include <binder/IInterface.h>
27
28#include <ui/PixelFormat.h>
29
30#include <gui/ISurface.h>
31
32namespace android {
33
34// ----------------------------------------------------------------------------
35
36// TODO: Remove this declaration, it is only used internally by SurfaceFlinger.
37typedef int32_t    DisplayID;
38
39// ----------------------------------------------------------------------------
40
41class ISurfaceComposerClient : public IInterface
42{
43public:
44    DECLARE_META_INTERFACE(SurfaceComposerClient);
45
46    // flags for createSurface()
47    enum { // (keep in sync with Surface.java)
48        eHidden             = 0x00000004,
49        eDestroyBackbuffer  = 0x00000020,
50        eSecure             = 0x00000080,
51        eNonPremultiplied   = 0x00000100,
52        eOpaque             = 0x00000400,
53        eProtectedByApp     = 0x00000800,
54        eProtectedByDRM     = 0x00001000,
55
56        eFXSurfaceNormal    = 0x00000000,
57        eFXSurfaceBlur      = 0x00010000, // deprecated, same as Dim
58        eFXSurfaceDim       = 0x00020000,
59        eFXSurfaceScreenshot= 0x00030000,
60        eFXSurfaceMask      = 0x000F0000,
61    };
62
63    struct surface_data_t {
64        int32_t token;
65        int32_t identity;
66        status_t readFromParcel(const Parcel& parcel);
67        status_t writeToParcel(Parcel* parcel) const;
68    };
69
70    /*
71     * Requires ACCESS_SURFACE_FLINGER permission
72     */
73    virtual sp<ISurface> createSurface(surface_data_t* data,
74            const String8& name, uint32_t w, uint32_t h,
75            PixelFormat format, uint32_t flags) = 0;
76
77    /*
78     * Requires ACCESS_SURFACE_FLINGER permission
79     */
80    virtual status_t destroySurface(SurfaceID sid) = 0;
81};
82
83// ----------------------------------------------------------------------------
84
85class BnSurfaceComposerClient: public BnInterface<ISurfaceComposerClient> {
86public:
87    virtual status_t onTransact(uint32_t code, const Parcel& data,
88            Parcel* reply, uint32_t flags = 0);
89};
90
91// ----------------------------------------------------------------------------
92
93}; // namespace android
94
95#endif // ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
96