2 * Copyright (C) 2006 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ANDROID_GUI_ISURFACE_COMPOSER_H
18 #define ANDROID_GUI_ISURFACE_COMPOSER_H
21 #include <sys/types.h>
23 #include <utils/RefBase.h>
24 #include <utils/Errors.h>
26 #include <binder/IInterface.h>
28 #include <ui/PixelFormat.h>
30 #include <gui/IGraphicBufferAlloc.h>
31 #include <gui/ISurfaceComposerClient.h>
34 // ----------------------------------------------------------------------------
37 class IDisplayEventConnection;
40 class ISurfaceComposer : public IInterface
43 DECLARE_META_INTERFACE(SurfaceComposer);
45 enum { // (keep in sync with Surface.java)
47 eDestroyBackbuffer = 0x00000020,
49 eNonPremultiplied = 0x00000100,
51 eProtectedByApp = 0x00000800,
52 eProtectedByDRM = 0x00001000,
54 eFXSurfaceNormal = 0x00000000,
55 eFXSurfaceBlur = 0x00010000,
56 eFXSurfaceDim = 0x00020000,
57 eFXSurfaceScreenshot= 0x00030000,
58 eFXSurfaceMask = 0x000F0000,
62 ePositionChanged = 0x00000001,
63 eLayerChanged = 0x00000002,
64 eSizeChanged = 0x00000004,
65 eAlphaChanged = 0x00000008,
66 eMatrixChanged = 0x00000010,
67 eTransparentRegionChanged = 0x00000020,
68 eVisibilityChanged = 0x00000040,
69 eFreezeTintChanged = 0x00000080,
77 eLayerBlurFreeze = 0x10
81 eOrientationDefault = 0,
85 eOrientationUnchanged = 4,
86 eOrientationSwapMask = 0x01
94 eElectronBeamAnimationOn = 0x01,
95 eElectronBeamAnimationOff = 0x10
98 /* create connection with surface flinger, requires
99 * ACCESS_SURFACE_FLINGER permission
101 virtual sp<ISurfaceComposerClient> createConnection() = 0;
103 /* create a graphic buffer allocator
105 virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc() = 0;
107 /* retrieve the control block */
108 virtual sp<IMemoryHeap> getCblk() const = 0;
110 /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
111 virtual void setTransactionState(const Vector<ComposerState>& state,
112 int orientation, uint32_t flags) = 0;
114 /* signal that we're done booting.
115 * Requires ACCESS_SURFACE_FLINGER permission
117 virtual void bootFinished() = 0;
119 /* Capture the specified screen. requires READ_FRAME_BUFFER permission
120 * This function will fail if there is a secure window on screen.
122 virtual status_t captureScreen(DisplayID dpy,
123 sp<IMemoryHeap>* heap,
124 uint32_t* width, uint32_t* height, PixelFormat* format,
125 uint32_t reqWidth, uint32_t reqHeight,
126 uint32_t minLayerZ, uint32_t maxLayerZ) = 0;
128 /* triggers screen off animation */
129 virtual status_t turnElectronBeamOff(int32_t mode) = 0;
131 /* triggers screen on animation */
132 virtual status_t turnElectronBeamOn(int32_t mode) = 0;
134 /* verify that an ISurfaceTexture was created by SurfaceFlinger.
136 virtual bool authenticateSurfaceTexture(
137 const sp<ISurfaceTexture>& surface) const = 0;
139 /* return an IDisplayEventConnection */
140 virtual sp<IDisplayEventConnection> createDisplayEventConnection() = 0;
143 // ----------------------------------------------------------------------------
145 class BnSurfaceComposer : public BnInterface<ISurfaceComposer>
149 // Note: BOOT_FINISHED must remain this value, it is called from
150 // Java by ActivityManagerService.
151 BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
153 CREATE_GRAPHIC_BUFFER_ALLOC,
155 SET_TRANSACTION_STATE,
158 TURN_ELECTRON_BEAM_OFF,
159 TURN_ELECTRON_BEAM_ON,
160 AUTHENTICATE_SURFACE,
161 CREATE_DISPLAY_EVENT_CONNECTION,
164 virtual status_t onTransact( uint32_t code,
170 // ----------------------------------------------------------------------------
172 }; // namespace android
174 #endif // ANDROID_GUI_ISURFACE_COMPOSER_H