2009-03-04 03:31:44 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2006 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2012-02-26 02:48:35 +00:00
|
|
|
#ifndef ANDROID_GUI_ISURFACE_COMPOSER_H
|
|
|
|
#define ANDROID_GUI_ISURFACE_COMPOSER_H
|
2009-03-04 03:31:44 +00:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include <utils/RefBase.h>
|
|
|
|
#include <utils/Errors.h>
|
2010-02-10 01:46:37 +00:00
|
|
|
|
2009-05-20 02:08:10 +00:00
|
|
|
#include <binder/IInterface.h>
|
2009-03-04 03:31:44 +00:00
|
|
|
|
|
|
|
#include <ui/PixelFormat.h>
|
|
|
|
|
2012-02-26 02:48:35 +00:00
|
|
|
#include <gui/IGraphicBufferAlloc.h>
|
|
|
|
#include <gui/ISurfaceComposerClient.h>
|
2009-03-04 03:31:44 +00:00
|
|
|
|
2010-02-10 01:46:37 +00:00
|
|
|
namespace android {
|
2009-03-04 03:31:44 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2011-11-29 21:07:24 +00:00
|
|
|
class ComposerState;
|
2012-07-25 03:43:54 +00:00
|
|
|
class DisplayState;
|
2012-07-26 01:56:13 +00:00
|
|
|
class DisplayInfo;
|
2011-11-18 01:49:17 +00:00
|
|
|
class IDisplayEventConnection;
|
|
|
|
class IMemoryHeap;
|
2011-04-20 21:20:59 +00:00
|
|
|
|
2013-01-09 00:06:15 +00:00
|
|
|
/*
|
|
|
|
* This class defines the Binder IPC interface for accessing various
|
|
|
|
* SurfaceFlinger features.
|
|
|
|
*/
|
2012-08-09 02:42:09 +00:00
|
|
|
class ISurfaceComposer: public IInterface {
|
2009-03-04 03:31:44 +00:00
|
|
|
public:
|
|
|
|
DECLARE_META_INTERFACE(SurfaceComposer);
|
|
|
|
|
2012-08-09 02:42:09 +00:00
|
|
|
// flags for setTransactionState()
|
2011-10-13 00:39:00 +00:00
|
|
|
enum {
|
2012-08-09 02:42:09 +00:00
|
|
|
eSynchronous = 0x01,
|
2012-10-16 01:24:43 +00:00
|
|
|
eAnimation = 0x02,
|
2011-10-13 00:39:00 +00:00
|
|
|
};
|
|
|
|
|
2012-08-09 23:29:12 +00:00
|
|
|
enum {
|
|
|
|
eDisplayIdMain = 0,
|
|
|
|
eDisplayIdHdmi = 1
|
|
|
|
};
|
|
|
|
|
2009-03-04 03:31:44 +00:00
|
|
|
/* create connection with surface flinger, requires
|
|
|
|
* ACCESS_SURFACE_FLINGER permission
|
|
|
|
*/
|
2010-05-28 21:22:23 +00:00
|
|
|
virtual sp<ISurfaceComposerClient> createConnection() = 0;
|
2009-03-04 03:31:44 +00:00
|
|
|
|
2011-01-13 02:30:40 +00:00
|
|
|
/* create a graphic buffer allocator
|
|
|
|
*/
|
|
|
|
virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc() = 0;
|
|
|
|
|
2012-08-09 23:29:12 +00:00
|
|
|
/* return an IDisplayEventConnection */
|
|
|
|
virtual sp<IDisplayEventConnection> createDisplayEventConnection() = 0;
|
|
|
|
|
2012-08-25 03:00:51 +00:00
|
|
|
/* create a display
|
2012-08-09 23:29:12 +00:00
|
|
|
* requires ACCESS_SURFACE_FLINGER permission.
|
|
|
|
*/
|
2012-10-20 01:19:11 +00:00
|
|
|
virtual sp<IBinder> createDisplay(const String8& displayName,
|
|
|
|
bool secure) = 0;
|
2012-08-09 23:29:12 +00:00
|
|
|
|
|
|
|
/* get the token for the existing default displays. possible values
|
|
|
|
* for id are eDisplayIdMain and eDisplayIdHdmi.
|
|
|
|
*/
|
|
|
|
virtual sp<IBinder> getBuiltInDisplay(int32_t id) = 0;
|
|
|
|
|
2010-02-10 01:46:37 +00:00
|
|
|
/* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
|
2012-08-09 02:42:09 +00:00
|
|
|
virtual void setTransactionState(const Vector<ComposerState>& state,
|
|
|
|
const Vector<DisplayState>& displays, uint32_t flags) = 0;
|
2009-03-04 03:31:44 +00:00
|
|
|
|
|
|
|
/* signal that we're done booting.
|
2010-02-10 01:46:37 +00:00
|
|
|
* Requires ACCESS_SURFACE_FLINGER permission
|
2009-03-04 03:31:44 +00:00
|
|
|
*/
|
|
|
|
virtual void bootFinished() = 0;
|
|
|
|
|
2012-12-18 17:49:45 +00:00
|
|
|
/* verify that an IGraphicBufferProducer was created by SurfaceFlinger.
|
2012-08-09 23:29:12 +00:00
|
|
|
*/
|
|
|
|
virtual bool authenticateSurfaceTexture(
|
2012-12-18 17:49:45 +00:00
|
|
|
const sp<IGraphicBufferProducer>& surface) const = 0;
|
2012-08-09 23:29:12 +00:00
|
|
|
|
2013-03-16 01:31:56 +00:00
|
|
|
/* triggers screen off and waits for it to complete
|
|
|
|
* requires ACCESS_SURFACE_FLINGER permission.
|
|
|
|
*/
|
2012-09-27 23:02:06 +00:00
|
|
|
virtual void blank(const sp<IBinder>& display) = 0;
|
2012-06-07 20:17:52 +00:00
|
|
|
|
2013-03-16 01:31:56 +00:00
|
|
|
/* triggers screen on and waits for it to complete
|
|
|
|
* requires ACCESS_SURFACE_FLINGER permission.
|
|
|
|
*/
|
2012-09-27 23:02:06 +00:00
|
|
|
virtual void unblank(const sp<IBinder>& display) = 0;
|
2012-06-19 01:06:45 +00:00
|
|
|
|
2012-08-25 03:00:51 +00:00
|
|
|
/* returns information about a display
|
|
|
|
* intended to be used to get information about built-in displays */
|
|
|
|
virtual status_t getDisplayInfo(const sp<IBinder>& display, DisplayInfo* info) = 0;
|
2013-03-01 21:42:57 +00:00
|
|
|
|
2013-03-16 01:31:56 +00:00
|
|
|
/* Capture the specified screen. requires READ_FRAME_BUFFER permission
|
|
|
|
* This function will fail if there is a secure window on screen.
|
|
|
|
*/
|
2013-03-01 21:42:57 +00:00
|
|
|
virtual status_t captureScreen(const sp<IBinder>& display,
|
|
|
|
const sp<IGraphicBufferProducer>& producer,
|
|
|
|
uint32_t reqWidth, uint32_t reqHeight,
|
2013-03-20 05:22:21 +00:00
|
|
|
uint32_t minLayerZ, uint32_t maxLayerZ,
|
|
|
|
bool isCpuConsumer) = 0;
|
2009-03-04 03:31:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2012-08-09 02:42:09 +00:00
|
|
|
class BnSurfaceComposer: public BnInterface<ISurfaceComposer> {
|
2009-03-04 03:31:44 +00:00
|
|
|
public:
|
|
|
|
enum {
|
|
|
|
// Note: BOOT_FINISHED must remain this value, it is called from
|
|
|
|
// Java by ActivityManagerService.
|
|
|
|
BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
|
|
|
|
CREATE_CONNECTION,
|
2011-01-13 02:30:40 +00:00
|
|
|
CREATE_GRAPHIC_BUFFER_ALLOC,
|
2012-08-09 23:29:12 +00:00
|
|
|
CREATE_DISPLAY_EVENT_CONNECTION,
|
|
|
|
CREATE_DISPLAY,
|
|
|
|
GET_BUILT_IN_DISPLAY,
|
2011-06-29 02:09:31 +00:00
|
|
|
SET_TRANSACTION_STATE,
|
2011-03-08 20:18:54 +00:00
|
|
|
AUTHENTICATE_SURFACE,
|
2012-06-07 20:17:52 +00:00
|
|
|
BLANK,
|
|
|
|
UNBLANK,
|
2012-08-09 23:29:12 +00:00
|
|
|
GET_DISPLAY_INFO,
|
2012-06-19 01:06:45 +00:00
|
|
|
CONNECT_DISPLAY,
|
2013-03-01 21:42:57 +00:00
|
|
|
CAPTURE_SCREEN,
|
2009-03-04 03:31:44 +00:00
|
|
|
};
|
|
|
|
|
2012-08-09 02:42:09 +00:00
|
|
|
virtual status_t onTransact(uint32_t code, const Parcel& data,
|
|
|
|
Parcel* reply, uint32_t flags = 0);
|
2009-03-04 03:31:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
}; // namespace android
|
|
|
|
|
2012-02-26 02:48:35 +00:00
|
|
|
#endif // ANDROID_GUI_ISURFACE_COMPOSER_H
|