The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 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 | // tag as surfaceflinger |
| 18 | #define LOG_TAG "SurfaceFlinger" |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
Mathias Agopian | c5b2c0b | 2009-05-19 19:08:10 -0700 | [diff] [blame] | 23 | #include <binder/Parcel.h> |
| 24 | #include <binder/IMemory.h> |
| 25 | #include <binder/IPCThreadState.h> |
| 26 | #include <binder/IServiceManager.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 27 | |
Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 28 | #include <gui/BitTube.h> |
| 29 | #include <gui/IDisplayEventConnection.h> |
Mathias Agopian | 90ac799 | 2012-02-25 18:48:35 -0800 | [diff] [blame] | 30 | #include <gui/ISurfaceComposer.h> |
| 31 | #include <gui/ISurfaceTexture.h> |
| 32 | |
| 33 | #include <private/gui/LayerState.h> |
Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 34 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | #include <ui/DisplayInfo.h> |
| 36 | |
Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 37 | #include <utils/Log.h> |
Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 38 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 39 | // --------------------------------------------------------------------------- |
| 40 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 41 | namespace android { |
| 42 | |
Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 43 | class IDisplayEventConnection; |
| 44 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | class BpSurfaceComposer : public BpInterface<ISurfaceComposer> |
| 46 | { |
| 47 | public: |
| 48 | BpSurfaceComposer(const sp<IBinder>& impl) |
| 49 | : BpInterface<ISurfaceComposer>(impl) |
| 50 | { |
| 51 | } |
| 52 | |
Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 53 | virtual sp<ISurfaceComposerClient> createConnection() |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 54 | { |
| 55 | uint32_t n; |
| 56 | Parcel data, reply; |
| 57 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); |
| 58 | remote()->transact(BnSurfaceComposer::CREATE_CONNECTION, data, &reply); |
Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 59 | return interface_cast<ISurfaceComposerClient>(reply.readStrongBinder()); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 60 | } |
| 61 | |
Jamie Gennis | 9a78c90 | 2011-01-12 18:30:40 -0800 | [diff] [blame] | 62 | virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc() |
| 63 | { |
| 64 | uint32_t n; |
| 65 | Parcel data, reply; |
| 66 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); |
| 67 | remote()->transact(BnSurfaceComposer::CREATE_GRAPHIC_BUFFER_ALLOC, data, &reply); |
| 68 | return interface_cast<IGraphicBufferAlloc>(reply.readStrongBinder()); |
| 69 | } |
| 70 | |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 71 | virtual void setTransactionState( |
| 72 | const Vector<ComposerState>& state, |
| 73 | const Vector<DisplayState>& displays, |
| 74 | uint32_t flags) |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 75 | { |
| 76 | Parcel data, reply; |
| 77 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 78 | { |
| 79 | Vector<ComposerState>::const_iterator b(state.begin()); |
| 80 | Vector<ComposerState>::const_iterator e(state.end()); |
| 81 | data.writeInt32(state.size()); |
| 82 | for ( ; b != e ; ++b ) { |
| 83 | b->write(data); |
| 84 | } |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 85 | } |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 86 | { |
| 87 | Vector<DisplayState>::const_iterator b(displays.begin()); |
| 88 | Vector<DisplayState>::const_iterator e(displays.end()); |
| 89 | data.writeInt32(displays.size()); |
| 90 | for ( ; b != e ; ++b ) { |
| 91 | b->write(data); |
| 92 | } |
| 93 | } |
Jamie Gennis | 2837839 | 2011-10-12 17:39:00 -0700 | [diff] [blame] | 94 | data.writeInt32(flags); |
Jamie Gennis | b8d69a5 | 2011-10-10 15:48:06 -0700 | [diff] [blame] | 95 | remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | virtual void bootFinished() |
| 99 | { |
| 100 | Parcel data, reply; |
| 101 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); |
| 102 | remote()->transact(BnSurfaceComposer::BOOT_FINISHED, data, &reply); |
| 103 | } |
| 104 | |
Jeff Brown | 9d4e3d2 | 2012-08-24 20:00:51 -0700 | [diff] [blame] | 105 | virtual status_t captureScreen( |
| 106 | const sp<IBinder>& display, sp<IMemoryHeap>* heap, |
Mathias Agopian | df85c45 | 2010-09-29 13:02:36 -0700 | [diff] [blame] | 107 | uint32_t* width, uint32_t* height, PixelFormat* format, |
Mathias Agopian | bf2c6a6 | 2010-12-10 16:22:31 -0800 | [diff] [blame] | 108 | uint32_t reqWidth, uint32_t reqHeight, |
| 109 | uint32_t minLayerZ, uint32_t maxLayerZ) |
Mathias Agopian | 1b0b30d | 2010-09-24 11:26:58 -0700 | [diff] [blame] | 110 | { |
| 111 | Parcel data, reply; |
| 112 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); |
Jeff Brown | 9d4e3d2 | 2012-08-24 20:00:51 -0700 | [diff] [blame] | 113 | data.writeStrongBinder(display); |
Mathias Agopian | df85c45 | 2010-09-29 13:02:36 -0700 | [diff] [blame] | 114 | data.writeInt32(reqWidth); |
| 115 | data.writeInt32(reqHeight); |
Mathias Agopian | bf2c6a6 | 2010-12-10 16:22:31 -0800 | [diff] [blame] | 116 | data.writeInt32(minLayerZ); |
| 117 | data.writeInt32(maxLayerZ); |
Mathias Agopian | 1b0b30d | 2010-09-24 11:26:58 -0700 | [diff] [blame] | 118 | remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply); |
| 119 | *heap = interface_cast<IMemoryHeap>(reply.readStrongBinder()); |
| 120 | *width = reply.readInt32(); |
| 121 | *height = reply.readInt32(); |
| 122 | *format = reply.readInt32(); |
| 123 | return reply.readInt32(); |
| 124 | } |
| 125 | |
Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 126 | virtual bool authenticateSurfaceTexture( |
| 127 | const sp<ISurfaceTexture>& surfaceTexture) const |
Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 128 | { |
| 129 | Parcel data, reply; |
| 130 | int err = NO_ERROR; |
| 131 | err = data.writeInterfaceToken( |
| 132 | ISurfaceComposer::getInterfaceDescriptor()); |
| 133 | if (err != NO_ERROR) { |
Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 134 | ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing " |
Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 135 | "interface descriptor: %s (%d)", strerror(-err), -err); |
| 136 | return false; |
| 137 | } |
Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 138 | err = data.writeStrongBinder(surfaceTexture->asBinder()); |
Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 139 | if (err != NO_ERROR) { |
Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 140 | ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing " |
Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 141 | "strong binder to parcel: %s (%d)", strerror(-err), -err); |
Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 142 | return false; |
| 143 | } |
| 144 | err = remote()->transact(BnSurfaceComposer::AUTHENTICATE_SURFACE, data, |
| 145 | &reply); |
| 146 | if (err != NO_ERROR) { |
Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 147 | ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error " |
Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 148 | "performing transaction: %s (%d)", strerror(-err), -err); |
Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 149 | return false; |
| 150 | } |
| 151 | int32_t result = 0; |
| 152 | err = reply.readInt32(&result); |
| 153 | if (err != NO_ERROR) { |
Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 154 | ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error " |
Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 155 | "retrieving result: %s (%d)", strerror(-err), -err); |
Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 156 | return false; |
| 157 | } |
| 158 | return result != 0; |
| 159 | } |
Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 160 | |
| 161 | virtual sp<IDisplayEventConnection> createDisplayEventConnection() |
| 162 | { |
| 163 | Parcel data, reply; |
| 164 | sp<IDisplayEventConnection> result; |
| 165 | int err = data.writeInterfaceToken( |
| 166 | ISurfaceComposer::getInterfaceDescriptor()); |
| 167 | if (err != NO_ERROR) { |
| 168 | return result; |
| 169 | } |
| 170 | err = remote()->transact( |
| 171 | BnSurfaceComposer::CREATE_DISPLAY_EVENT_CONNECTION, |
| 172 | data, &reply); |
| 173 | if (err != NO_ERROR) { |
Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 174 | ALOGE("ISurfaceComposer::createDisplayEventConnection: error performing " |
Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 175 | "transaction: %s (%d)", strerror(-err), -err); |
| 176 | return result; |
| 177 | } |
| 178 | result = interface_cast<IDisplayEventConnection>(reply.readStrongBinder()); |
| 179 | return result; |
| 180 | } |
Colin Cross | 8e53306 | 2012-06-07 13:17:52 -0700 | [diff] [blame] | 181 | |
Jamie Gennis | dd3cb84 | 2012-10-19 18:19:11 -0700 | [diff] [blame] | 182 | virtual sp<IBinder> createDisplay(const String8& displayName, bool secure) |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 183 | { |
| 184 | Parcel data, reply; |
| 185 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); |
Andy McFadden | 8dfa92f | 2012-09-17 18:27:17 -0700 | [diff] [blame] | 186 | data.writeString8(displayName); |
Jamie Gennis | dd3cb84 | 2012-10-19 18:19:11 -0700 | [diff] [blame] | 187 | data.writeInt32(secure ? 1 : 0); |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 188 | remote()->transact(BnSurfaceComposer::CREATE_DISPLAY, data, &reply); |
| 189 | return reply.readStrongBinder(); |
| 190 | } |
| 191 | |
| 192 | virtual sp<IBinder> getBuiltInDisplay(int32_t id) |
| 193 | { |
| 194 | Parcel data, reply; |
| 195 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); |
| 196 | data.writeInt32(id); |
| 197 | remote()->transact(BnSurfaceComposer::GET_BUILT_IN_DISPLAY, data, &reply); |
| 198 | return reply.readStrongBinder(); |
| 199 | } |
| 200 | |
Andy McFadden | c01a79d | 2012-09-27 16:02:06 -0700 | [diff] [blame] | 201 | virtual void blank(const sp<IBinder>& display) |
Colin Cross | 8e53306 | 2012-06-07 13:17:52 -0700 | [diff] [blame] | 202 | { |
| 203 | Parcel data, reply; |
| 204 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); |
Andy McFadden | c01a79d | 2012-09-27 16:02:06 -0700 | [diff] [blame] | 205 | data.writeStrongBinder(display); |
Colin Cross | 8e53306 | 2012-06-07 13:17:52 -0700 | [diff] [blame] | 206 | remote()->transact(BnSurfaceComposer::BLANK, data, &reply); |
| 207 | } |
| 208 | |
Andy McFadden | c01a79d | 2012-09-27 16:02:06 -0700 | [diff] [blame] | 209 | virtual void unblank(const sp<IBinder>& display) |
Colin Cross | 8e53306 | 2012-06-07 13:17:52 -0700 | [diff] [blame] | 210 | { |
| 211 | Parcel data, reply; |
| 212 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); |
Andy McFadden | c01a79d | 2012-09-27 16:02:06 -0700 | [diff] [blame] | 213 | data.writeStrongBinder(display); |
Colin Cross | 8e53306 | 2012-06-07 13:17:52 -0700 | [diff] [blame] | 214 | remote()->transact(BnSurfaceComposer::UNBLANK, data, &reply); |
| 215 | } |
Mathias Agopian | 3094df3 | 2012-06-18 18:06:45 -0700 | [diff] [blame] | 216 | |
Jeff Brown | 9d4e3d2 | 2012-08-24 20:00:51 -0700 | [diff] [blame] | 217 | virtual status_t getDisplayInfo(const sp<IBinder>& display, DisplayInfo* info) |
Mathias Agopian | c666cae | 2012-07-25 18:56:13 -0700 | [diff] [blame] | 218 | { |
| 219 | Parcel data, reply; |
| 220 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); |
Jeff Brown | 9d4e3d2 | 2012-08-24 20:00:51 -0700 | [diff] [blame] | 221 | data.writeStrongBinder(display); |
Mathias Agopian | c666cae | 2012-07-25 18:56:13 -0700 | [diff] [blame] | 222 | remote()->transact(BnSurfaceComposer::GET_DISPLAY_INFO, data, &reply); |
| 223 | memcpy(info, reply.readInplace(sizeof(DisplayInfo)), sizeof(DisplayInfo)); |
| 224 | return reply.readInt32(); |
| 225 | } |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 226 | }; |
| 227 | |
| 228 | IMPLEMENT_META_INTERFACE(SurfaceComposer, "android.ui.ISurfaceComposer"); |
| 229 | |
| 230 | // ---------------------------------------------------------------------- |
| 231 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 232 | status_t BnSurfaceComposer::onTransact( |
| 233 | uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) |
| 234 | { |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 235 | switch(code) { |
| 236 | case CREATE_CONNECTION: { |
Mathias Agopian | 83c0446 | 2009-05-22 19:00:22 -0700 | [diff] [blame] | 237 | CHECK_INTERFACE(ISurfaceComposer, data, reply); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 238 | sp<IBinder> b = createConnection()->asBinder(); |
| 239 | reply->writeStrongBinder(b); |
| 240 | } break; |
Jamie Gennis | 9a78c90 | 2011-01-12 18:30:40 -0800 | [diff] [blame] | 241 | case CREATE_GRAPHIC_BUFFER_ALLOC: { |
| 242 | CHECK_INTERFACE(ISurfaceComposer, data, reply); |
| 243 | sp<IBinder> b = createGraphicBufferAlloc()->asBinder(); |
| 244 | reply->writeStrongBinder(b); |
| 245 | } break; |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 246 | case SET_TRANSACTION_STATE: { |
Mathias Agopian | 83c0446 | 2009-05-22 19:00:22 -0700 | [diff] [blame] | 247 | CHECK_INTERFACE(ISurfaceComposer, data, reply); |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 248 | size_t count = data.readInt32(); |
| 249 | ComposerState s; |
| 250 | Vector<ComposerState> state; |
| 251 | state.setCapacity(count); |
| 252 | for (size_t i=0 ; i<count ; i++) { |
| 253 | s.read(data); |
| 254 | state.add(s); |
| 255 | } |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 256 | count = data.readInt32(); |
| 257 | DisplayState d; |
| 258 | Vector<DisplayState> displays; |
| 259 | displays.setCapacity(count); |
| 260 | for (size_t i=0 ; i<count ; i++) { |
| 261 | d.read(data); |
| 262 | displays.add(d); |
| 263 | } |
Jamie Gennis | 2837839 | 2011-10-12 17:39:00 -0700 | [diff] [blame] | 264 | uint32_t flags = data.readInt32(); |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 265 | setTransactionState(state, displays, flags); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 266 | } break; |
| 267 | case BOOT_FINISHED: { |
Mathias Agopian | 83c0446 | 2009-05-22 19:00:22 -0700 | [diff] [blame] | 268 | CHECK_INTERFACE(ISurfaceComposer, data, reply); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 269 | bootFinished(); |
| 270 | } break; |
Mathias Agopian | 1b0b30d | 2010-09-24 11:26:58 -0700 | [diff] [blame] | 271 | case CAPTURE_SCREEN: { |
| 272 | CHECK_INTERFACE(ISurfaceComposer, data, reply); |
Jeff Brown | 9d4e3d2 | 2012-08-24 20:00:51 -0700 | [diff] [blame] | 273 | sp<IBinder> display = data.readStrongBinder(); |
Mathias Agopian | df85c45 | 2010-09-29 13:02:36 -0700 | [diff] [blame] | 274 | uint32_t reqWidth = data.readInt32(); |
| 275 | uint32_t reqHeight = data.readInt32(); |
Mathias Agopian | bf2c6a6 | 2010-12-10 16:22:31 -0800 | [diff] [blame] | 276 | uint32_t minLayerZ = data.readInt32(); |
| 277 | uint32_t maxLayerZ = data.readInt32(); |
Mathias Agopian | 1b0b30d | 2010-09-24 11:26:58 -0700 | [diff] [blame] | 278 | sp<IMemoryHeap> heap; |
| 279 | uint32_t w, h; |
| 280 | PixelFormat f; |
Jeff Brown | 9d4e3d2 | 2012-08-24 20:00:51 -0700 | [diff] [blame] | 281 | status_t res = captureScreen(display, &heap, &w, &h, &f, |
Mathias Agopian | bf2c6a6 | 2010-12-10 16:22:31 -0800 | [diff] [blame] | 282 | reqWidth, reqHeight, minLayerZ, maxLayerZ); |
Mathias Agopian | 1b0b30d | 2010-09-24 11:26:58 -0700 | [diff] [blame] | 283 | reply->writeStrongBinder(heap->asBinder()); |
| 284 | reply->writeInt32(w); |
| 285 | reply->writeInt32(h); |
| 286 | reply->writeInt32(f); |
| 287 | reply->writeInt32(res); |
| 288 | } break; |
Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 289 | case AUTHENTICATE_SURFACE: { |
| 290 | CHECK_INTERFACE(ISurfaceComposer, data, reply); |
Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 291 | sp<ISurfaceTexture> surfaceTexture = |
| 292 | interface_cast<ISurfaceTexture>(data.readStrongBinder()); |
| 293 | int32_t result = authenticateSurfaceTexture(surfaceTexture) ? 1 : 0; |
Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 294 | reply->writeInt32(result); |
| 295 | } break; |
Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 296 | case CREATE_DISPLAY_EVENT_CONNECTION: { |
| 297 | CHECK_INTERFACE(ISurfaceComposer, data, reply); |
| 298 | sp<IDisplayEventConnection> connection(createDisplayEventConnection()); |
| 299 | reply->writeStrongBinder(connection->asBinder()); |
| 300 | return NO_ERROR; |
| 301 | } break; |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 302 | case CREATE_DISPLAY: { |
| 303 | CHECK_INTERFACE(ISurfaceComposer, data, reply); |
Andy McFadden | 8dfa92f | 2012-09-17 18:27:17 -0700 | [diff] [blame] | 304 | String8 displayName = data.readString8(); |
Jamie Gennis | dd3cb84 | 2012-10-19 18:19:11 -0700 | [diff] [blame] | 305 | bool secure = bool(data.readInt32()); |
| 306 | sp<IBinder> display(createDisplay(displayName, secure)); |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 307 | reply->writeStrongBinder(display); |
| 308 | return NO_ERROR; |
| 309 | } break; |
| 310 | case GET_BUILT_IN_DISPLAY: { |
| 311 | CHECK_INTERFACE(ISurfaceComposer, data, reply); |
| 312 | int32_t id = data.readInt32(); |
| 313 | sp<IBinder> display(getBuiltInDisplay(id)); |
| 314 | reply->writeStrongBinder(display); |
| 315 | return NO_ERROR; |
| 316 | } break; |
Colin Cross | 8e53306 | 2012-06-07 13:17:52 -0700 | [diff] [blame] | 317 | case BLANK: { |
| 318 | CHECK_INTERFACE(ISurfaceComposer, data, reply); |
Andy McFadden | c01a79d | 2012-09-27 16:02:06 -0700 | [diff] [blame] | 319 | sp<IBinder> display = data.readStrongBinder(); |
| 320 | blank(display); |
Colin Cross | 8e53306 | 2012-06-07 13:17:52 -0700 | [diff] [blame] | 321 | } break; |
| 322 | case UNBLANK: { |
| 323 | CHECK_INTERFACE(ISurfaceComposer, data, reply); |
Andy McFadden | c01a79d | 2012-09-27 16:02:06 -0700 | [diff] [blame] | 324 | sp<IBinder> display = data.readStrongBinder(); |
| 325 | unblank(display); |
Colin Cross | 8e53306 | 2012-06-07 13:17:52 -0700 | [diff] [blame] | 326 | } break; |
Mathias Agopian | c666cae | 2012-07-25 18:56:13 -0700 | [diff] [blame] | 327 | case GET_DISPLAY_INFO: { |
| 328 | CHECK_INTERFACE(ISurfaceComposer, data, reply); |
| 329 | DisplayInfo info; |
Jeff Brown | 9d4e3d2 | 2012-08-24 20:00:51 -0700 | [diff] [blame] | 330 | sp<IBinder> display = data.readStrongBinder(); |
| 331 | status_t result = getDisplayInfo(display, &info); |
Mathias Agopian | c666cae | 2012-07-25 18:56:13 -0700 | [diff] [blame] | 332 | memcpy(reply->writeInplace(sizeof(DisplayInfo)), &info, sizeof(DisplayInfo)); |
| 333 | reply->writeInt32(result); |
| 334 | } break; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 335 | default: |
Mathias Agopian | 83c0446 | 2009-05-22 19:00:22 -0700 | [diff] [blame] | 336 | return BBinder::onTransact(code, data, reply, flags); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 337 | } |
| 338 | return NO_ERROR; |
| 339 | } |
| 340 | |
| 341 | // ---------------------------------------------------------------------------- |
| 342 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 343 | }; |