ISurfaceComposer.h revision 3165cc21cfea781988407b19bd83292b19f05f55
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_GUI_ISURFACE_COMPOSER_H 18#define ANDROID_GUI_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 26#include <binder/IInterface.h> 27 28#include <ui/PixelFormat.h> 29 30#include <gui/IGraphicBufferAlloc.h> 31#include <gui/ISurfaceComposerClient.h> 32 33namespace android { 34// ---------------------------------------------------------------------------- 35 36class ComposerState; 37class DisplayState; 38class DisplayInfo; 39class IDisplayEventConnection; 40class IMemoryHeap; 41 42class ISurfaceComposer: public IInterface { 43public: 44 DECLARE_META_INTERFACE(SurfaceComposer); 45 46 // flags for setTransactionState() 47 enum { 48 eSynchronous = 0x01, 49 }; 50 51 /* create connection with surface flinger, requires 52 * ACCESS_SURFACE_FLINGER permission 53 */ 54 virtual sp<ISurfaceComposerClient> createConnection() = 0; 55 56 /* create a graphic buffer allocator 57 */ 58 virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc() = 0; 59 60 /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */ 61 virtual void setTransactionState(const Vector<ComposerState>& state, 62 const Vector<DisplayState>& displays, uint32_t flags) = 0; 63 64 /* signal that we're done booting. 65 * Requires ACCESS_SURFACE_FLINGER permission 66 */ 67 virtual void bootFinished() = 0; 68 69 /* Capture the specified screen. requires READ_FRAME_BUFFER permission 70 * This function will fail if there is a secure window on screen. 71 */ 72 virtual status_t captureScreen(DisplayID dpy, sp<IMemoryHeap>* heap, 73 uint32_t* width, uint32_t* height, PixelFormat* format, 74 uint32_t reqWidth, uint32_t reqHeight, uint32_t minLayerZ, 75 uint32_t maxLayerZ) = 0; 76 77 /* verify that an ISurfaceTexture was created by SurfaceFlinger. 78 */ 79 virtual bool authenticateSurfaceTexture( 80 const sp<ISurfaceTexture>& surface) const = 0; 81 82 /* return an IDisplayEventConnection */ 83 virtual sp<IDisplayEventConnection> createDisplayEventConnection() = 0; 84 85 /* triggers screen off and waits for it to complete */ 86 virtual void blank() = 0; 87 88 /* triggers screen on and waits for it to complete */ 89 virtual void unblank() = 0; 90 91 /* returns information about a physical screen. This is intended to be 92 * used by low-level native tests */ 93 virtual status_t getDisplayInfo(DisplayID dpy, DisplayInfo* info) = 0; 94 95 /* connects to an external display */ 96 virtual void connectDisplay(const sp<ISurfaceTexture> display) = 0; 97}; 98 99// ---------------------------------------------------------------------------- 100 101class BnSurfaceComposer: public BnInterface<ISurfaceComposer> { 102public: 103 enum { 104 // Note: BOOT_FINISHED must remain this value, it is called from 105 // Java by ActivityManagerService. 106 BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION, 107 CREATE_CONNECTION, 108 CREATE_GRAPHIC_BUFFER_ALLOC, 109 GET_DISPLAY_INFO, 110 SET_TRANSACTION_STATE, 111 CAPTURE_SCREEN, 112 AUTHENTICATE_SURFACE, 113 CREATE_DISPLAY_EVENT_CONNECTION, 114 BLANK, 115 UNBLANK, 116 CONNECT_DISPLAY, 117 }; 118 119 virtual status_t onTransact(uint32_t code, const Parcel& data, 120 Parcel* reply, uint32_t flags = 0); 121}; 122 123// ---------------------------------------------------------------------------- 124 125}; // namespace android 126 127#endif // ANDROID_GUI_ISURFACE_COMPOSER_H 128