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_SF_ISURFACE_COMPOSER_H
18 #define ANDROID_SF_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 <surfaceflinger/ISurfaceComposerClient.h>
31 #include <surfaceflinger/IGraphicBufferAlloc.h>
34 // ----------------------------------------------------------------------------
39 class ISurfaceComposer : public IInterface
42 DECLARE_META_INTERFACE(SurfaceComposer);
44 enum { // (keep in sync with Surface.java)
46 eDestroyBackbuffer = 0x00000020,
48 eNonPremultiplied = 0x00000100,
50 eProtectedByApp = 0x00000800,
51 eProtectedByDRM = 0x00001000,
53 eFXSurfaceNormal = 0x00000000,
54 eFXSurfaceBlur = 0x00010000,
55 eFXSurfaceDim = 0x00020000,
56 eFXSurfaceScreenshot= 0x00030000,
57 eFXSurfaceMask = 0x000F0000,
61 ePositionChanged = 0x00000001,
62 eLayerChanged = 0x00000002,
63 eSizeChanged = 0x00000004,
64 eAlphaChanged = 0x00000008,
65 eMatrixChanged = 0x00000010,
66 eTransparentRegionChanged = 0x00000020,
67 eVisibilityChanged = 0x00000040,
68 eFreezeTintChanged = 0x00000080,
76 eLayerBlurFreeze = 0x10
80 eOrientationDefault = 0,
84 eOrientationUnchanged = 4,
85 eOrientationSwapMask = 0x01
93 eElectronBeamAnimationOn = 0x01,
94 eElectronBeamAnimationOff = 0x10
97 /* create connection with surface flinger, requires
98 * ACCESS_SURFACE_FLINGER permission
100 virtual sp<ISurfaceComposerClient> createConnection() = 0;
102 /* create a graphic buffer allocator
104 virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc() = 0;
106 /* retrieve the control block */
107 virtual sp<IMemoryHeap> getCblk() const = 0;
109 /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
110 virtual void setTransactionState(const Vector<ComposerState>& state,
111 int orientation, uint32_t flags) = 0;
113 /* signal that we're done booting.
114 * Requires ACCESS_SURFACE_FLINGER permission
116 virtual void bootFinished() = 0;
118 /* Capture the specified screen. requires READ_FRAME_BUFFER permission
119 * This function will fail if there is a secure window on screen.
121 virtual status_t captureScreen(DisplayID dpy,
122 sp<IMemoryHeap>* heap,
123 uint32_t* width, uint32_t* height, PixelFormat* format,
124 uint32_t reqWidth, uint32_t reqHeight,
125 uint32_t minLayerZ, uint32_t maxLayerZ) = 0;
127 virtual status_t turnElectronBeamOff(int32_t mode) = 0;
128 virtual status_t turnElectronBeamOn(int32_t mode) = 0;
130 /* verify that an ISurfaceTexture was created by SurfaceFlinger.
132 virtual bool authenticateSurfaceTexture(
133 const sp<ISurfaceTexture>& surface) const = 0;
136 // ----------------------------------------------------------------------------
138 class BnSurfaceComposer : public BnInterface<ISurfaceComposer>
142 // Note: BOOT_FINISHED must remain this value, it is called from
143 // Java by ActivityManagerService.
144 BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
146 CREATE_GRAPHIC_BUFFER_ALLOC,
148 SET_TRANSACTION_STATE,
151 TURN_ELECTRON_BEAM_OFF,
152 TURN_ELECTRON_BEAM_ON,
153 AUTHENTICATE_SURFACE,
156 virtual status_t onTransact( uint32_t code,
162 // ----------------------------------------------------------------------------
164 }; // namespace android
166 #endif // ANDROID_SF_ISURFACE_COMPOSER_H