• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006 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_ISURFACE_COMPOSER_H
18 #define ANDROID_ISURFACE_COMPOSER_H
19 
20 #include <stdint.h>
21 #include <sys/types.h>
22 
23 #include <utils/RefBase.h>
24 #include <utils/Errors.h>
25 #include <binder/IInterface.h>
26 
27 #include <ui/PixelFormat.h>
28 #include <ui/ISurfaceFlingerClient.h>
29 
30 namespace android {
31 
32 // ----------------------------------------------------------------------------
33 
34 class DisplayInfo;
35 
36 class ISurfaceComposer : public IInterface
37 {
38 public:
39     DECLARE_META_INTERFACE(SurfaceComposer);
40 
41     enum { // (keep in sync with Surface.java)
42         eHidden             = 0x00000004,
43         eDestroyBackbuffer  = 0x00000020,
44         eSecure             = 0x00000080,
45         eNonPremultiplied   = 0x00000100,
46         ePushBuffers        = 0x00000200,
47 
48         eFXSurfaceNormal    = 0x00000000,
49         eFXSurfaceBlur      = 0x00010000,
50         eFXSurfaceDim       = 0x00020000,
51         eFXSurfaceMask      = 0x000F0000,
52     };
53 
54     enum {
55         ePositionChanged            = 0x00000001,
56         eLayerChanged               = 0x00000002,
57         eSizeChanged                = 0x00000004,
58         eAlphaChanged               = 0x00000008,
59         eMatrixChanged              = 0x00000010,
60         eTransparentRegionChanged   = 0x00000020,
61         eVisibilityChanged          = 0x00000040,
62         eFreezeTintChanged          = 0x00000080,
63     };
64 
65     enum {
66         eLayerHidden        = 0x01,
67         eLayerFrozen        = 0x02,
68         eLayerDither        = 0x04,
69         eLayerFilter        = 0x08,
70         eLayerBlurFreeze    = 0x10
71     };
72 
73     enum {
74         eOrientationDefault     = 0,
75         eOrientation90          = 1,
76         eOrientation180         = 2,
77         eOrientation270         = 3,
78         eOrientationSwapMask    = 0x01
79     };
80 
81     // flags for setOrientation
82     enum {
83         eOrientationAnimationDisable = 0x00000001
84     };
85 
86     /* create connection with surface flinger, requires
87      * ACCESS_SURFACE_FLINGER permission
88      */
89 
90     virtual sp<ISurfaceFlingerClient> createConnection() = 0;
91 
92     /* retrieve the control block */
93     virtual sp<IMemoryHeap> getCblk() const = 0;
94 
95     /* open/close transactions. recquires ACCESS_SURFACE_FLINGER permission */
96     virtual void openGlobalTransaction() = 0;
97     virtual void closeGlobalTransaction() = 0;
98 
99     /* [un]freeze display. recquires ACCESS_SURFACE_FLINGER permission */
100     virtual status_t freezeDisplay(DisplayID dpy, uint32_t flags) = 0;
101     virtual status_t unfreezeDisplay(DisplayID dpy, uint32_t flags) = 0;
102 
103     /* Set display orientation. recquires ACCESS_SURFACE_FLINGER permission */
104     virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags) = 0;
105 
106     /* signal that we're done booting.
107      * recquires ACCESS_SURFACE_FLINGER permission
108      */
109     virtual void bootFinished() = 0;
110 
111     /* Signal surfaceflinger that there might be some work to do
112      * This is an ASYNCHRONOUS call.
113      */
114     virtual void signal() const = 0;
115 };
116 
117 // ----------------------------------------------------------------------------
118 
119 class BnSurfaceComposer : public BnInterface<ISurfaceComposer>
120 {
121 public:
122     enum {
123         // Note: BOOT_FINISHED must remain this value, it is called from
124         // Java by ActivityManagerService.
125         BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
126         CREATE_CONNECTION,
127         GET_CBLK,
128         OPEN_GLOBAL_TRANSACTION,
129         CLOSE_GLOBAL_TRANSACTION,
130         SET_ORIENTATION,
131         FREEZE_DISPLAY,
132         UNFREEZE_DISPLAY,
133         SIGNAL
134     };
135 
136     virtual status_t    onTransact( uint32_t code,
137                                     const Parcel& data,
138                                     Parcel* reply,
139                                     uint32_t flags = 0);
140 };
141 
142 // ----------------------------------------------------------------------------
143 
144 }; // namespace android
145 
146 #endif // ANDROID_ISURFACE_COMPOSER_H
147