| 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> | 
| Mathias Agopian | c5b2c0b | 2009-05-19 19:08:10 -0700 | [diff] [blame] | 24 | #include <binder/IPCThreadState.h> | 
|  | 25 | #include <binder/IServiceManager.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 |  | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 27 | #include <gui/IDisplayEventConnection.h> | 
| Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 28 | #include <gui/IGraphicBufferProducer.h> | 
| Mathias Agopian | 2b5dd40 | 2017-02-07 17:36:19 -0800 | [diff] [blame] | 29 | #include <gui/ISurfaceComposer.h> | 
|  | 30 | #include <gui/ISurfaceComposerClient.h> | 
| Kalle Raita | a099a24 | 2017-01-11 11:17:29 -0800 | [diff] [blame] | 31 | #include <gui/LayerDebugInfo.h> | 
| Robert Carr | 4cdc58f | 2017-08-23 14:22:20 -0700 | [diff] [blame] | 32 | #include <gui/LayerState.h> | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 33 |  | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 34 | #include <system/graphics.h> | 
|  | 35 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 36 | #include <ui/DisplayInfo.h> | 
| Lajos Molnar | 67d8bd6 | 2014-09-11 14:58:45 -0700 | [diff] [blame] | 37 | #include <ui/DisplayStatInfo.h> | 
| Dan Stoza | c4f471e | 2016-03-24 09:31:08 -0700 | [diff] [blame] | 38 | #include <ui/HdrCapabilities.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 39 |  | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 40 | #include <utils/Log.h> | 
| Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 41 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 42 | // --------------------------------------------------------------------------- | 
|  | 43 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 44 | namespace android { | 
|  | 45 |  | 
| Peiyong Lin | 9f03447 | 2018-03-28 15:29:00 -0700 | [diff] [blame] | 46 | using ui::ColorMode; | 
|  | 47 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 48 | class BpSurfaceComposer : public BpInterface<ISurfaceComposer> | 
|  | 49 | { | 
|  | 50 | public: | 
| Chih-Hung Hsieh | e2347b7 | 2016-04-25 15:41:05 -0700 | [diff] [blame] | 51 | explicit BpSurfaceComposer(const sp<IBinder>& impl) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 52 | : BpInterface<ISurfaceComposer>(impl) | 
|  | 53 | { | 
|  | 54 | } | 
|  | 55 |  | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 56 | virtual ~BpSurfaceComposer(); | 
|  | 57 |  | 
| Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 58 | virtual sp<ISurfaceComposerClient> createConnection() | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 59 | { | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 60 | Parcel data, reply; | 
|  | 61 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 62 | remote()->transact(BnSurfaceComposer::CREATE_CONNECTION, data, &reply); | 
| Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 63 | return interface_cast<ISurfaceComposerClient>(reply.readStrongBinder()); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 64 | } | 
|  | 65 |  | 
| Robert Carr | 1db73f6 | 2016-12-21 12:58:51 -0800 | [diff] [blame] | 66 | virtual sp<ISurfaceComposerClient> createScopedConnection( | 
|  | 67 | const sp<IGraphicBufferProducer>& parent) | 
|  | 68 | { | 
|  | 69 | Parcel data, reply; | 
|  | 70 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 71 | data.writeStrongBinder(IInterface::asBinder(parent)); | 
|  | 72 | remote()->transact(BnSurfaceComposer::CREATE_SCOPED_CONNECTION, data, &reply); | 
|  | 73 | return interface_cast<ISurfaceComposerClient>(reply.readStrongBinder()); | 
|  | 74 | } | 
|  | 75 |  | 
| Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 76 | virtual void setTransactionState( | 
|  | 77 | const Vector<ComposerState>& state, | 
|  | 78 | const Vector<DisplayState>& displays, | 
|  | 79 | uint32_t flags) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 80 | { | 
|  | 81 | Parcel data, reply; | 
|  | 82 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 83 |  | 
|  | 84 | data.writeUint32(static_cast<uint32_t>(state.size())); | 
|  | 85 | for (const auto& s : state) { | 
|  | 86 | s.write(data); | 
| Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 87 | } | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 88 |  | 
|  | 89 | data.writeUint32(static_cast<uint32_t>(displays.size())); | 
|  | 90 | for (const auto& d : displays) { | 
|  | 91 | d.write(data); | 
| Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 92 | } | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 93 |  | 
|  | 94 | data.writeUint32(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 |  | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 105 | virtual status_t captureScreen(const sp<IBinder>& display, sp<GraphicBuffer>* outBuffer, | 
|  | 106 | Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, | 
| chaviw | 0e3479f | 2018-09-10 16:49:30 -0700 | [diff] [blame] | 107 | bool useIdentityTransform, ISurfaceComposer::Rotation rotation) { | 
| Mathias Agopian | 2a9fc49 | 2013-03-01 13:42:57 -0800 | [diff] [blame] | 108 | Parcel data, reply; | 
|  | 109 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 110 | data.writeStrongBinder(display); | 
| Dan Stoza | c187900 | 2014-05-22 15:59:05 -0700 | [diff] [blame] | 111 | data.write(sourceCrop); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 112 | data.writeUint32(reqWidth); | 
|  | 113 | data.writeUint32(reqHeight); | 
| Dan Stoza | c701401 | 2014-02-14 15:03:43 -0800 | [diff] [blame] | 114 | data.writeInt32(static_cast<int32_t>(useIdentityTransform)); | 
| Riley Andrews | c3ebe66 | 2014-09-04 16:20:31 -0700 | [diff] [blame] | 115 | data.writeInt32(static_cast<int32_t>(rotation)); | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 116 | status_t result = remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply); | 
|  | 117 | if (result != NO_ERROR) { | 
|  | 118 | ALOGE("captureScreen failed to transact: %d", result); | 
|  | 119 | return result; | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 120 | } | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 121 | result = reply.readInt32(); | 
|  | 122 | if (result != NO_ERROR) { | 
|  | 123 | ALOGE("captureScreen failed to readInt32: %d", result); | 
|  | 124 | return result; | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 125 | } | 
|  | 126 |  | 
|  | 127 | *outBuffer = new GraphicBuffer(); | 
|  | 128 | reply.read(**outBuffer); | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 129 | return result; | 
| Mathias Agopian | 2a9fc49 | 2013-03-01 13:42:57 -0800 | [diff] [blame] | 130 | } | 
|  | 131 |  | 
| chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 132 | virtual status_t captureLayers(const sp<IBinder>& layerHandleBinder, | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 133 | sp<GraphicBuffer>* outBuffer, const Rect& sourceCrop, | 
| Robert Carr | 578038f | 2018-03-09 12:25:24 -0800 | [diff] [blame] | 134 | float frameScale, bool childrenOnly) { | 
| chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 135 | Parcel data, reply; | 
|  | 136 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 137 | data.writeStrongBinder(layerHandleBinder); | 
| chaviw | 7206d49 | 2017-11-10 16:16:12 -0800 | [diff] [blame] | 138 | data.write(sourceCrop); | 
|  | 139 | data.writeFloat(frameScale); | 
| Robert Carr | 578038f | 2018-03-09 12:25:24 -0800 | [diff] [blame] | 140 | data.writeBool(childrenOnly); | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 141 | status_t result = remote()->transact(BnSurfaceComposer::CAPTURE_LAYERS, data, &reply); | 
|  | 142 | if (result != NO_ERROR) { | 
|  | 143 | ALOGE("captureLayers failed to transact: %d", result); | 
|  | 144 | return result; | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 145 | } | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 146 | result = reply.readInt32(); | 
|  | 147 | if (result != NO_ERROR) { | 
|  | 148 | ALOGE("captureLayers failed to readInt32: %d", result); | 
|  | 149 | return result; | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 150 | } | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 151 | *outBuffer = new GraphicBuffer(); | 
|  | 152 | reply.read(**outBuffer); | 
|  | 153 |  | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 154 | return result; | 
| chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 155 | } | 
|  | 156 |  | 
| Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 157 | virtual bool authenticateSurfaceTexture( | 
| Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 158 | const sp<IGraphicBufferProducer>& bufferProducer) const | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 159 | { | 
|  | 160 | Parcel data, reply; | 
|  | 161 | int err = NO_ERROR; | 
|  | 162 | err = data.writeInterfaceToken( | 
|  | 163 | ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 164 | if (err != NO_ERROR) { | 
| Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 165 | ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing " | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 166 | "interface descriptor: %s (%d)", strerror(-err), -err); | 
|  | 167 | return false; | 
|  | 168 | } | 
| Marco Nelissen | 2ea926b | 2014-11-14 08:01:01 -0800 | [diff] [blame] | 169 | err = data.writeStrongBinder(IInterface::asBinder(bufferProducer)); | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 170 | if (err != NO_ERROR) { | 
| Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 171 | ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing " | 
| Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 172 | "strong binder to parcel: %s (%d)", strerror(-err), -err); | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 173 | return false; | 
|  | 174 | } | 
|  | 175 | err = remote()->transact(BnSurfaceComposer::AUTHENTICATE_SURFACE, data, | 
|  | 176 | &reply); | 
|  | 177 | if (err != NO_ERROR) { | 
| Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 178 | ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error " | 
| Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 179 | "performing transaction: %s (%d)", strerror(-err), -err); | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 180 | return false; | 
|  | 181 | } | 
|  | 182 | int32_t result = 0; | 
|  | 183 | err = reply.readInt32(&result); | 
|  | 184 | if (err != NO_ERROR) { | 
| Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 185 | ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error " | 
| Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 186 | "retrieving result: %s (%d)", strerror(-err), -err); | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 187 | return false; | 
|  | 188 | } | 
|  | 189 | return result != 0; | 
|  | 190 | } | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 191 |  | 
| Brian Anderson | 6b37671 | 2017-04-04 10:51:39 -0700 | [diff] [blame] | 192 | virtual status_t getSupportedFrameTimestamps( | 
|  | 193 | std::vector<FrameEvent>* outSupported) const { | 
|  | 194 | if (!outSupported) { | 
|  | 195 | return UNEXPECTED_NULL; | 
|  | 196 | } | 
|  | 197 | outSupported->clear(); | 
|  | 198 |  | 
|  | 199 | Parcel data, reply; | 
|  | 200 |  | 
|  | 201 | status_t err = data.writeInterfaceToken( | 
|  | 202 | ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 203 | if (err != NO_ERROR) { | 
|  | 204 | return err; | 
|  | 205 | } | 
|  | 206 |  | 
|  | 207 | err = remote()->transact( | 
|  | 208 | BnSurfaceComposer::GET_SUPPORTED_FRAME_TIMESTAMPS, | 
|  | 209 | data, &reply); | 
|  | 210 | if (err != NO_ERROR) { | 
|  | 211 | return err; | 
|  | 212 | } | 
|  | 213 |  | 
|  | 214 | int32_t result = 0; | 
|  | 215 | err = reply.readInt32(&result); | 
|  | 216 | if (err != NO_ERROR) { | 
|  | 217 | return err; | 
|  | 218 | } | 
|  | 219 | if (result != NO_ERROR) { | 
|  | 220 | return result; | 
|  | 221 | } | 
|  | 222 |  | 
|  | 223 | std::vector<int32_t> supported; | 
|  | 224 | err = reply.readInt32Vector(&supported); | 
|  | 225 | if (err != NO_ERROR) { | 
|  | 226 | return err; | 
|  | 227 | } | 
|  | 228 |  | 
|  | 229 | outSupported->reserve(supported.size()); | 
|  | 230 | for (int32_t s : supported) { | 
|  | 231 | outSupported->push_back(static_cast<FrameEvent>(s)); | 
|  | 232 | } | 
|  | 233 | return NO_ERROR; | 
|  | 234 | } | 
|  | 235 |  | 
| Jorim Jaggi | b1e2f8d | 2017-06-08 15:43:59 -0700 | [diff] [blame] | 236 | virtual sp<IDisplayEventConnection> createDisplayEventConnection(VsyncSource vsyncSource) | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 237 | { | 
|  | 238 | Parcel data, reply; | 
|  | 239 | sp<IDisplayEventConnection> result; | 
|  | 240 | int err = data.writeInterfaceToken( | 
|  | 241 | ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 242 | if (err != NO_ERROR) { | 
|  | 243 | return result; | 
|  | 244 | } | 
| Jorim Jaggi | b1e2f8d | 2017-06-08 15:43:59 -0700 | [diff] [blame] | 245 | data.writeInt32(static_cast<int32_t>(vsyncSource)); | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 246 | err = remote()->transact( | 
|  | 247 | BnSurfaceComposer::CREATE_DISPLAY_EVENT_CONNECTION, | 
|  | 248 | data, &reply); | 
|  | 249 | if (err != NO_ERROR) { | 
| Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 250 | ALOGE("ISurfaceComposer::createDisplayEventConnection: error performing " | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 251 | "transaction: %s (%d)", strerror(-err), -err); | 
|  | 252 | return result; | 
|  | 253 | } | 
|  | 254 | result = interface_cast<IDisplayEventConnection>(reply.readStrongBinder()); | 
|  | 255 | return result; | 
|  | 256 | } | 
| Colin Cross | 8e53306 | 2012-06-07 13:17:52 -0700 | [diff] [blame] | 257 |  | 
| Jamie Gennis | dd3cb84 | 2012-10-19 18:19:11 -0700 | [diff] [blame] | 258 | virtual sp<IBinder> createDisplay(const String8& displayName, bool secure) | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 259 | { | 
|  | 260 | Parcel data, reply; | 
|  | 261 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
| Andy McFadden | 8dfa92f | 2012-09-17 18:27:17 -0700 | [diff] [blame] | 262 | data.writeString8(displayName); | 
| Jamie Gennis | dd3cb84 | 2012-10-19 18:19:11 -0700 | [diff] [blame] | 263 | data.writeInt32(secure ? 1 : 0); | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 264 | remote()->transact(BnSurfaceComposer::CREATE_DISPLAY, data, &reply); | 
|  | 265 | return reply.readStrongBinder(); | 
|  | 266 | } | 
|  | 267 |  | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 268 | virtual void destroyDisplay(const sp<IBinder>& display) | 
|  | 269 | { | 
|  | 270 | Parcel data, reply; | 
|  | 271 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 272 | data.writeStrongBinder(display); | 
|  | 273 | remote()->transact(BnSurfaceComposer::DESTROY_DISPLAY, data, &reply); | 
|  | 274 | } | 
|  | 275 |  | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 276 | virtual sp<IBinder> getBuiltInDisplay(int32_t id) | 
|  | 277 | { | 
|  | 278 | Parcel data, reply; | 
|  | 279 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 280 | data.writeInt32(id); | 
|  | 281 | remote()->transact(BnSurfaceComposer::GET_BUILT_IN_DISPLAY, data, &reply); | 
|  | 282 | return reply.readStrongBinder(); | 
|  | 283 | } | 
|  | 284 |  | 
| Prashant Malani | 2c9b11f | 2014-05-25 01:36:31 -0700 | [diff] [blame] | 285 | virtual void setPowerMode(const sp<IBinder>& display, int mode) | 
| Colin Cross | 8e53306 | 2012-06-07 13:17:52 -0700 | [diff] [blame] | 286 | { | 
|  | 287 | Parcel data, reply; | 
|  | 288 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
| Andy McFadden | c01a79d | 2012-09-27 16:02:06 -0700 | [diff] [blame] | 289 | data.writeStrongBinder(display); | 
| Prashant Malani | 2c9b11f | 2014-05-25 01:36:31 -0700 | [diff] [blame] | 290 | data.writeInt32(mode); | 
|  | 291 | remote()->transact(BnSurfaceComposer::SET_POWER_MODE, data, &reply); | 
| Colin Cross | 8e53306 | 2012-06-07 13:17:52 -0700 | [diff] [blame] | 292 | } | 
| Mathias Agopian | 3094df3 | 2012-06-18 18:06:45 -0700 | [diff] [blame] | 293 |  | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 294 | virtual status_t getDisplayConfigs(const sp<IBinder>& display, | 
|  | 295 | Vector<DisplayInfo>* configs) | 
| Mathias Agopian | c666cae | 2012-07-25 18:56:13 -0700 | [diff] [blame] | 296 | { | 
|  | 297 | Parcel data, reply; | 
|  | 298 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
| Jeff Brown | 9d4e3d2 | 2012-08-24 20:00:51 -0700 | [diff] [blame] | 299 | data.writeStrongBinder(display); | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 300 | remote()->transact(BnSurfaceComposer::GET_DISPLAY_CONFIGS, data, &reply); | 
|  | 301 | status_t result = reply.readInt32(); | 
|  | 302 | if (result == NO_ERROR) { | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 303 | size_t numConfigs = reply.readUint32(); | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 304 | configs->clear(); | 
|  | 305 | configs->resize(numConfigs); | 
|  | 306 | for (size_t c = 0; c < numConfigs; ++c) { | 
|  | 307 | memcpy(&(configs->editItemAt(c)), | 
|  | 308 | reply.readInplace(sizeof(DisplayInfo)), | 
|  | 309 | sizeof(DisplayInfo)); | 
|  | 310 | } | 
|  | 311 | } | 
|  | 312 | return result; | 
|  | 313 | } | 
|  | 314 |  | 
| Lajos Molnar | 67d8bd6 | 2014-09-11 14:58:45 -0700 | [diff] [blame] | 315 | virtual status_t getDisplayStats(const sp<IBinder>& display, | 
|  | 316 | DisplayStatInfo* stats) | 
|  | 317 | { | 
|  | 318 | Parcel data, reply; | 
|  | 319 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 320 | data.writeStrongBinder(display); | 
|  | 321 | remote()->transact(BnSurfaceComposer::GET_DISPLAY_STATS, data, &reply); | 
|  | 322 | status_t result = reply.readInt32(); | 
|  | 323 | if (result == NO_ERROR) { | 
|  | 324 | memcpy(stats, | 
|  | 325 | reply.readInplace(sizeof(DisplayStatInfo)), | 
|  | 326 | sizeof(DisplayStatInfo)); | 
|  | 327 | } | 
|  | 328 | return result; | 
|  | 329 | } | 
|  | 330 |  | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 331 | virtual int getActiveConfig(const sp<IBinder>& display) | 
|  | 332 | { | 
|  | 333 | Parcel data, reply; | 
|  | 334 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 335 | data.writeStrongBinder(display); | 
|  | 336 | remote()->transact(BnSurfaceComposer::GET_ACTIVE_CONFIG, data, &reply); | 
|  | 337 | return reply.readInt32(); | 
|  | 338 | } | 
|  | 339 |  | 
|  | 340 | virtual status_t setActiveConfig(const sp<IBinder>& display, int id) | 
|  | 341 | { | 
|  | 342 | Parcel data, reply; | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 343 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 344 | if (result != NO_ERROR) { | 
|  | 345 | ALOGE("setActiveConfig failed to writeInterfaceToken: %d", result); | 
|  | 346 | return result; | 
|  | 347 | } | 
|  | 348 | result = data.writeStrongBinder(display); | 
|  | 349 | if (result != NO_ERROR) { | 
|  | 350 | ALOGE("setActiveConfig failed to writeStrongBinder: %d", result); | 
|  | 351 | return result; | 
|  | 352 | } | 
|  | 353 | result = data.writeInt32(id); | 
|  | 354 | if (result != NO_ERROR) { | 
|  | 355 | ALOGE("setActiveConfig failed to writeInt32: %d", result); | 
|  | 356 | return result; | 
|  | 357 | } | 
|  | 358 | result = remote()->transact(BnSurfaceComposer::SET_ACTIVE_CONFIG, data, &reply); | 
|  | 359 | if (result != NO_ERROR) { | 
|  | 360 | ALOGE("setActiveConfig failed to transact: %d", result); | 
|  | 361 | return result; | 
|  | 362 | } | 
| Mathias Agopian | c666cae | 2012-07-25 18:56:13 -0700 | [diff] [blame] | 363 | return reply.readInt32(); | 
|  | 364 | } | 
| Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 365 |  | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 366 | virtual status_t getDisplayColorModes(const sp<IBinder>& display, | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 367 | Vector<ColorMode>* outColorModes) { | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 368 | Parcel data, reply; | 
|  | 369 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 370 | if (result != NO_ERROR) { | 
|  | 371 | ALOGE("getDisplayColorModes failed to writeInterfaceToken: %d", result); | 
|  | 372 | return result; | 
|  | 373 | } | 
|  | 374 | result = data.writeStrongBinder(display); | 
|  | 375 | if (result != NO_ERROR) { | 
|  | 376 | ALOGE("getDisplayColorModes failed to writeStrongBinder: %d", result); | 
|  | 377 | return result; | 
|  | 378 | } | 
|  | 379 | result = remote()->transact(BnSurfaceComposer::GET_DISPLAY_COLOR_MODES, data, &reply); | 
|  | 380 | if (result != NO_ERROR) { | 
|  | 381 | ALOGE("getDisplayColorModes failed to transact: %d", result); | 
|  | 382 | return result; | 
|  | 383 | } | 
|  | 384 | result = static_cast<status_t>(reply.readInt32()); | 
|  | 385 | if (result == NO_ERROR) { | 
|  | 386 | size_t numModes = reply.readUint32(); | 
|  | 387 | outColorModes->clear(); | 
|  | 388 | outColorModes->resize(numModes); | 
|  | 389 | for (size_t i = 0; i < numModes; ++i) { | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 390 | outColorModes->replaceAt(static_cast<ColorMode>(reply.readInt32()), i); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 391 | } | 
|  | 392 | } | 
|  | 393 | return result; | 
|  | 394 | } | 
|  | 395 |  | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 396 | virtual ColorMode getActiveColorMode(const sp<IBinder>& display) { | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 397 | Parcel data, reply; | 
|  | 398 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 399 | if (result != NO_ERROR) { | 
|  | 400 | ALOGE("getActiveColorMode failed to writeInterfaceToken: %d", result); | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 401 | return static_cast<ColorMode>(result); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 402 | } | 
|  | 403 | result = data.writeStrongBinder(display); | 
|  | 404 | if (result != NO_ERROR) { | 
|  | 405 | ALOGE("getActiveColorMode failed to writeStrongBinder: %d", result); | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 406 | return static_cast<ColorMode>(result); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 407 | } | 
|  | 408 | result = remote()->transact(BnSurfaceComposer::GET_ACTIVE_COLOR_MODE, data, &reply); | 
|  | 409 | if (result != NO_ERROR) { | 
|  | 410 | ALOGE("getActiveColorMode failed to transact: %d", result); | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 411 | return static_cast<ColorMode>(result); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 412 | } | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 413 | return static_cast<ColorMode>(reply.readInt32()); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 414 | } | 
|  | 415 |  | 
|  | 416 | virtual status_t setActiveColorMode(const sp<IBinder>& display, | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 417 | ColorMode colorMode) { | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 418 | Parcel data, reply; | 
|  | 419 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 420 | if (result != NO_ERROR) { | 
|  | 421 | ALOGE("setActiveColorMode failed to writeInterfaceToken: %d", result); | 
|  | 422 | return result; | 
|  | 423 | } | 
|  | 424 | result = data.writeStrongBinder(display); | 
|  | 425 | if (result != NO_ERROR) { | 
|  | 426 | ALOGE("setActiveColorMode failed to writeStrongBinder: %d", result); | 
|  | 427 | return result; | 
|  | 428 | } | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 429 | result = data.writeInt32(static_cast<int32_t>(colorMode)); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 430 | if (result != NO_ERROR) { | 
|  | 431 | ALOGE("setActiveColorMode failed to writeInt32: %d", result); | 
|  | 432 | return result; | 
|  | 433 | } | 
|  | 434 | result = remote()->transact(BnSurfaceComposer::SET_ACTIVE_COLOR_MODE, data, &reply); | 
|  | 435 | if (result != NO_ERROR) { | 
|  | 436 | ALOGE("setActiveColorMode failed to transact: %d", result); | 
|  | 437 | return result; | 
|  | 438 | } | 
|  | 439 | return static_cast<status_t>(reply.readInt32()); | 
|  | 440 | } | 
|  | 441 |  | 
| Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 442 | virtual status_t clearAnimationFrameStats() { | 
|  | 443 | Parcel data, reply; | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 444 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 445 | if (result != NO_ERROR) { | 
|  | 446 | ALOGE("clearAnimationFrameStats failed to writeInterfaceToken: %d", result); | 
|  | 447 | return result; | 
|  | 448 | } | 
|  | 449 | result = remote()->transact(BnSurfaceComposer::CLEAR_ANIMATION_FRAME_STATS, data, &reply); | 
|  | 450 | if (result != NO_ERROR) { | 
|  | 451 | ALOGE("clearAnimationFrameStats failed to transact: %d", result); | 
|  | 452 | return result; | 
|  | 453 | } | 
| Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 454 | return reply.readInt32(); | 
|  | 455 | } | 
|  | 456 |  | 
|  | 457 | virtual status_t getAnimationFrameStats(FrameStats* outStats) const { | 
|  | 458 | Parcel data, reply; | 
|  | 459 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 460 | remote()->transact(BnSurfaceComposer::GET_ANIMATION_FRAME_STATS, data, &reply); | 
|  | 461 | reply.read(*outStats); | 
|  | 462 | return reply.readInt32(); | 
|  | 463 | } | 
| Dan Stoza | c4f471e | 2016-03-24 09:31:08 -0700 | [diff] [blame] | 464 |  | 
|  | 465 | virtual status_t getHdrCapabilities(const sp<IBinder>& display, | 
|  | 466 | HdrCapabilities* outCapabilities) const { | 
|  | 467 | Parcel data, reply; | 
|  | 468 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 469 | status_t result = data.writeStrongBinder(display); | 
|  | 470 | if (result != NO_ERROR) { | 
|  | 471 | ALOGE("getHdrCapabilities failed to writeStrongBinder: %d", result); | 
|  | 472 | return result; | 
|  | 473 | } | 
|  | 474 | result = remote()->transact(BnSurfaceComposer::GET_HDR_CAPABILITIES, | 
|  | 475 | data, &reply); | 
|  | 476 | if (result != NO_ERROR) { | 
|  | 477 | ALOGE("getHdrCapabilities failed to transact: %d", result); | 
|  | 478 | return result; | 
|  | 479 | } | 
|  | 480 | result = reply.readInt32(); | 
|  | 481 | if (result == NO_ERROR) { | 
| Mathias Agopian | e1f5e6f | 2017-02-06 16:34:41 -0800 | [diff] [blame] | 482 | result = reply.read(*outCapabilities); | 
| Dan Stoza | c4f471e | 2016-03-24 09:31:08 -0700 | [diff] [blame] | 483 | } | 
|  | 484 | return result; | 
|  | 485 | } | 
| Sahil Dhanju | c1ba5c4 | 2016-06-07 20:09:20 -0700 | [diff] [blame] | 486 |  | 
|  | 487 | virtual status_t enableVSyncInjections(bool enable) { | 
|  | 488 | Parcel data, reply; | 
|  | 489 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 490 | if (result != NO_ERROR) { | 
|  | 491 | ALOGE("enableVSyncInjections failed to writeInterfaceToken: %d", result); | 
|  | 492 | return result; | 
|  | 493 | } | 
|  | 494 | result = data.writeBool(enable); | 
|  | 495 | if (result != NO_ERROR) { | 
|  | 496 | ALOGE("enableVSyncInjections failed to writeBool: %d", result); | 
|  | 497 | return result; | 
|  | 498 | } | 
|  | 499 | result = remote()->transact(BnSurfaceComposer::ENABLE_VSYNC_INJECTIONS, | 
|  | 500 | data, &reply, TF_ONE_WAY); | 
|  | 501 | if (result != NO_ERROR) { | 
|  | 502 | ALOGE("enableVSyncInjections failed to transact: %d", result); | 
|  | 503 | return result; | 
|  | 504 | } | 
|  | 505 | return result; | 
|  | 506 | } | 
|  | 507 |  | 
|  | 508 | virtual status_t injectVSync(nsecs_t when) { | 
|  | 509 | Parcel data, reply; | 
|  | 510 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 511 | if (result != NO_ERROR) { | 
|  | 512 | ALOGE("injectVSync failed to writeInterfaceToken: %d", result); | 
|  | 513 | return result; | 
|  | 514 | } | 
|  | 515 | result = data.writeInt64(when); | 
|  | 516 | if (result != NO_ERROR) { | 
|  | 517 | ALOGE("injectVSync failed to writeInt64: %d", result); | 
|  | 518 | return result; | 
|  | 519 | } | 
|  | 520 | result = remote()->transact(BnSurfaceComposer::INJECT_VSYNC, data, &reply, TF_ONE_WAY); | 
|  | 521 | if (result != NO_ERROR) { | 
|  | 522 | ALOGE("injectVSync failed to transact: %d", result); | 
|  | 523 | return result; | 
|  | 524 | } | 
|  | 525 | return result; | 
|  | 526 | } | 
|  | 527 |  | 
| Kalle Raita | a099a24 | 2017-01-11 11:17:29 -0800 | [diff] [blame] | 528 | virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) const | 
|  | 529 | { | 
|  | 530 | if (!outLayers) { | 
|  | 531 | return UNEXPECTED_NULL; | 
|  | 532 | } | 
|  | 533 |  | 
|  | 534 | Parcel data, reply; | 
|  | 535 |  | 
|  | 536 | status_t err = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 537 | if (err != NO_ERROR) { | 
|  | 538 | return err; | 
|  | 539 | } | 
|  | 540 |  | 
|  | 541 | err = remote()->transact(BnSurfaceComposer::GET_LAYER_DEBUG_INFO, data, &reply); | 
|  | 542 | if (err != NO_ERROR) { | 
|  | 543 | return err; | 
|  | 544 | } | 
|  | 545 |  | 
|  | 546 | int32_t result = 0; | 
|  | 547 | err = reply.readInt32(&result); | 
|  | 548 | if (err != NO_ERROR) { | 
|  | 549 | return err; | 
|  | 550 | } | 
|  | 551 | if (result != NO_ERROR) { | 
|  | 552 | return result; | 
|  | 553 | } | 
|  | 554 |  | 
|  | 555 | outLayers->clear(); | 
|  | 556 | return reply.readParcelableVector(outLayers); | 
|  | 557 | } | 
| Peiyong Lin | 0256f72 | 2018-08-31 15:45:10 -0700 | [diff] [blame] | 558 |  | 
|  | 559 | virtual status_t getCompositionPreference(ui::Dataspace* dataSpace, | 
|  | 560 | ui::PixelFormat* pixelFormat) const { | 
|  | 561 | Parcel data, reply; | 
|  | 562 | status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 563 | if (error != NO_ERROR) { | 
|  | 564 | return error; | 
|  | 565 | } | 
|  | 566 | error = remote()->transact(BnSurfaceComposer::GET_COMPOSITION_PREFERENCE, data, &reply); | 
|  | 567 | if (error != NO_ERROR) { | 
|  | 568 | return error; | 
|  | 569 | } | 
|  | 570 | error = static_cast<status_t>(reply.readInt32()); | 
|  | 571 | if (error == NO_ERROR) { | 
|  | 572 | *dataSpace = static_cast<ui::Dataspace>(reply.readInt32()); | 
|  | 573 | *pixelFormat = static_cast<ui::PixelFormat>(reply.readInt32()); | 
|  | 574 | } | 
|  | 575 | return error; | 
|  | 576 | } | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 577 | }; | 
|  | 578 |  | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 579 | // Out-of-line virtual method definition to trigger vtable emission in this | 
|  | 580 | // translation unit (see clang warning -Wweak-vtables) | 
|  | 581 | BpSurfaceComposer::~BpSurfaceComposer() {} | 
|  | 582 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 583 | IMPLEMENT_META_INTERFACE(SurfaceComposer, "android.ui.ISurfaceComposer"); | 
|  | 584 |  | 
|  | 585 | // ---------------------------------------------------------------------- | 
|  | 586 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 587 | status_t BnSurfaceComposer::onTransact( | 
|  | 588 | uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) | 
|  | 589 | { | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 590 | switch(code) { | 
|  | 591 | case CREATE_CONNECTION: { | 
| Mathias Agopian | 83c0446 | 2009-05-22 19:00:22 -0700 | [diff] [blame] | 592 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Marco Nelissen | 2ea926b | 2014-11-14 08:01:01 -0800 | [diff] [blame] | 593 | sp<IBinder> b = IInterface::asBinder(createConnection()); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 594 | reply->writeStrongBinder(b); | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 595 | return NO_ERROR; | 
|  | 596 | } | 
| Robert Carr | 1db73f6 | 2016-12-21 12:58:51 -0800 | [diff] [blame] | 597 | case CREATE_SCOPED_CONNECTION: { | 
|  | 598 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 599 | sp<IGraphicBufferProducer> bufferProducer = | 
|  | 600 | interface_cast<IGraphicBufferProducer>(data.readStrongBinder()); | 
|  | 601 | sp<IBinder> b = IInterface::asBinder(createScopedConnection(bufferProducer)); | 
|  | 602 | reply->writeStrongBinder(b); | 
|  | 603 | return NO_ERROR; | 
|  | 604 | } | 
| Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 605 | case SET_TRANSACTION_STATE: { | 
| Mathias Agopian | 83c0446 | 2009-05-22 19:00:22 -0700 | [diff] [blame] | 606 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 607 |  | 
|  | 608 | size_t count = data.readUint32(); | 
| Michael Lentine | 8afa1c4 | 2014-10-31 11:10:13 -0700 | [diff] [blame] | 609 | if (count > data.dataSize()) { | 
|  | 610 | return BAD_VALUE; | 
|  | 611 | } | 
| Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 612 | ComposerState s; | 
|  | 613 | Vector<ComposerState> state; | 
|  | 614 | state.setCapacity(count); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 615 | for (size_t i = 0; i < count; i++) { | 
| Michael Lentine | 8afa1c4 | 2014-10-31 11:10:13 -0700 | [diff] [blame] | 616 | if (s.read(data) == BAD_VALUE) { | 
|  | 617 | return BAD_VALUE; | 
|  | 618 | } | 
| Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 619 | state.add(s); | 
|  | 620 | } | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 621 |  | 
|  | 622 | count = data.readUint32(); | 
| Michael Lentine | 8afa1c4 | 2014-10-31 11:10:13 -0700 | [diff] [blame] | 623 | if (count > data.dataSize()) { | 
|  | 624 | return BAD_VALUE; | 
|  | 625 | } | 
| Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 626 | DisplayState d; | 
|  | 627 | Vector<DisplayState> displays; | 
|  | 628 | displays.setCapacity(count); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 629 | for (size_t i = 0; i < count; i++) { | 
| Michael Lentine | 8afa1c4 | 2014-10-31 11:10:13 -0700 | [diff] [blame] | 630 | if (d.read(data) == BAD_VALUE) { | 
|  | 631 | return BAD_VALUE; | 
|  | 632 | } | 
| Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 633 | displays.add(d); | 
|  | 634 | } | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 635 |  | 
|  | 636 | uint32_t stateFlags = data.readUint32(); | 
|  | 637 | setTransactionState(state, displays, stateFlags); | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 638 | return NO_ERROR; | 
|  | 639 | } | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 640 | case BOOT_FINISHED: { | 
| Mathias Agopian | 83c0446 | 2009-05-22 19:00:22 -0700 | [diff] [blame] | 641 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 642 | bootFinished(); | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 643 | return NO_ERROR; | 
|  | 644 | } | 
| Mathias Agopian | 2a9fc49 | 2013-03-01 13:42:57 -0800 | [diff] [blame] | 645 | case CAPTURE_SCREEN: { | 
|  | 646 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 647 | sp<IBinder> display = data.readStrongBinder(); | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 648 | sp<GraphicBuffer> outBuffer; | 
| Pablo Ceballos | 60d6922 | 2015-08-07 14:47:20 -0700 | [diff] [blame] | 649 | Rect sourceCrop(Rect::EMPTY_RECT); | 
| Dan Stoza | c187900 | 2014-05-22 15:59:05 -0700 | [diff] [blame] | 650 | data.read(sourceCrop); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 651 | uint32_t reqWidth = data.readUint32(); | 
|  | 652 | uint32_t reqHeight = data.readUint32(); | 
| Dan Stoza | c701401 | 2014-02-14 15:03:43 -0800 | [diff] [blame] | 653 | bool useIdentityTransform = static_cast<bool>(data.readInt32()); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 654 | int32_t rotation = data.readInt32(); | 
| Dan Stoza | c701401 | 2014-02-14 15:03:43 -0800 | [diff] [blame] | 655 |  | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 656 | status_t res = captureScreen(display, &outBuffer, sourceCrop, reqWidth, reqHeight, | 
| chaviw | 0e3479f | 2018-09-10 16:49:30 -0700 | [diff] [blame] | 657 | useIdentityTransform, | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 658 | static_cast<ISurfaceComposer::Rotation>(rotation)); | 
| Mathias Agopian | 2a9fc49 | 2013-03-01 13:42:57 -0800 | [diff] [blame] | 659 | reply->writeInt32(res); | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 660 | if (res == NO_ERROR) { | 
|  | 661 | reply->write(*outBuffer); | 
|  | 662 | } | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 663 | return NO_ERROR; | 
|  | 664 | } | 
| chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 665 | case CAPTURE_LAYERS: { | 
|  | 666 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 667 | sp<IBinder> layerHandleBinder = data.readStrongBinder(); | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 668 | sp<GraphicBuffer> outBuffer; | 
| chaviw | 7206d49 | 2017-11-10 16:16:12 -0800 | [diff] [blame] | 669 | Rect sourceCrop(Rect::EMPTY_RECT); | 
|  | 670 | data.read(sourceCrop); | 
|  | 671 | float frameScale = data.readFloat(); | 
| Robert Carr | 578038f | 2018-03-09 12:25:24 -0800 | [diff] [blame] | 672 | bool childrenOnly = data.readBool(); | 
| chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 673 |  | 
| Robert Carr | 578038f | 2018-03-09 12:25:24 -0800 | [diff] [blame] | 674 | status_t res = captureLayers(layerHandleBinder, &outBuffer, sourceCrop, frameScale, | 
|  | 675 | childrenOnly); | 
| chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 676 | reply->writeInt32(res); | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 677 | if (res == NO_ERROR) { | 
|  | 678 | reply->write(*outBuffer); | 
|  | 679 | } | 
| chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 680 | return NO_ERROR; | 
|  | 681 | } | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 682 | case AUTHENTICATE_SURFACE: { | 
|  | 683 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 684 | sp<IGraphicBufferProducer> bufferProducer = | 
|  | 685 | interface_cast<IGraphicBufferProducer>(data.readStrongBinder()); | 
|  | 686 | int32_t result = authenticateSurfaceTexture(bufferProducer) ? 1 : 0; | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 687 | reply->writeInt32(result); | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 688 | return NO_ERROR; | 
|  | 689 | } | 
| Brian Anderson | 6b37671 | 2017-04-04 10:51:39 -0700 | [diff] [blame] | 690 | case GET_SUPPORTED_FRAME_TIMESTAMPS: { | 
|  | 691 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 692 | std::vector<FrameEvent> supportedTimestamps; | 
|  | 693 | status_t result = getSupportedFrameTimestamps(&supportedTimestamps); | 
|  | 694 | status_t err = reply->writeInt32(result); | 
|  | 695 | if (err != NO_ERROR) { | 
|  | 696 | return err; | 
|  | 697 | } | 
|  | 698 | if (result != NO_ERROR) { | 
|  | 699 | return result; | 
|  | 700 | } | 
|  | 701 |  | 
|  | 702 | std::vector<int32_t> supported; | 
|  | 703 | supported.reserve(supportedTimestamps.size()); | 
|  | 704 | for (FrameEvent s : supportedTimestamps) { | 
|  | 705 | supported.push_back(static_cast<int32_t>(s)); | 
|  | 706 | } | 
|  | 707 | return reply->writeInt32Vector(supported); | 
|  | 708 | } | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 709 | case CREATE_DISPLAY_EVENT_CONNECTION: { | 
|  | 710 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Jorim Jaggi | b1e2f8d | 2017-06-08 15:43:59 -0700 | [diff] [blame] | 711 | sp<IDisplayEventConnection> connection(createDisplayEventConnection( | 
|  | 712 | static_cast<ISurfaceComposer::VsyncSource>(data.readInt32()))); | 
| Marco Nelissen | 2ea926b | 2014-11-14 08:01:01 -0800 | [diff] [blame] | 713 | reply->writeStrongBinder(IInterface::asBinder(connection)); | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 714 | return NO_ERROR; | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 715 | } | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 716 | case CREATE_DISPLAY: { | 
|  | 717 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Andy McFadden | 8dfa92f | 2012-09-17 18:27:17 -0700 | [diff] [blame] | 718 | String8 displayName = data.readString8(); | 
| Jamie Gennis | dd3cb84 | 2012-10-19 18:19:11 -0700 | [diff] [blame] | 719 | bool secure = bool(data.readInt32()); | 
|  | 720 | sp<IBinder> display(createDisplay(displayName, secure)); | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 721 | reply->writeStrongBinder(display); | 
|  | 722 | return NO_ERROR; | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 723 | } | 
|  | 724 | case DESTROY_DISPLAY: { | 
|  | 725 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 726 | sp<IBinder> display = data.readStrongBinder(); | 
|  | 727 | destroyDisplay(display); | 
|  | 728 | return NO_ERROR; | 
|  | 729 | } | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 730 | case GET_BUILT_IN_DISPLAY: { | 
|  | 731 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 732 | int32_t id = data.readInt32(); | 
|  | 733 | sp<IBinder> display(getBuiltInDisplay(id)); | 
|  | 734 | reply->writeStrongBinder(display); | 
|  | 735 | return NO_ERROR; | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 736 | } | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 737 | case GET_DISPLAY_CONFIGS: { | 
| Mathias Agopian | c666cae | 2012-07-25 18:56:13 -0700 | [diff] [blame] | 738 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 739 | Vector<DisplayInfo> configs; | 
| Jeff Brown | 9d4e3d2 | 2012-08-24 20:00:51 -0700 | [diff] [blame] | 740 | sp<IBinder> display = data.readStrongBinder(); | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 741 | status_t result = getDisplayConfigs(display, &configs); | 
|  | 742 | reply->writeInt32(result); | 
|  | 743 | if (result == NO_ERROR) { | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 744 | reply->writeUint32(static_cast<uint32_t>(configs.size())); | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 745 | for (size_t c = 0; c < configs.size(); ++c) { | 
|  | 746 | memcpy(reply->writeInplace(sizeof(DisplayInfo)), | 
|  | 747 | &configs[c], sizeof(DisplayInfo)); | 
|  | 748 | } | 
|  | 749 | } | 
|  | 750 | return NO_ERROR; | 
|  | 751 | } | 
| Lajos Molnar | 67d8bd6 | 2014-09-11 14:58:45 -0700 | [diff] [blame] | 752 | case GET_DISPLAY_STATS: { | 
|  | 753 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 754 | DisplayStatInfo stats; | 
|  | 755 | sp<IBinder> display = data.readStrongBinder(); | 
|  | 756 | status_t result = getDisplayStats(display, &stats); | 
|  | 757 | reply->writeInt32(result); | 
|  | 758 | if (result == NO_ERROR) { | 
|  | 759 | memcpy(reply->writeInplace(sizeof(DisplayStatInfo)), | 
|  | 760 | &stats, sizeof(DisplayStatInfo)); | 
|  | 761 | } | 
|  | 762 | return NO_ERROR; | 
|  | 763 | } | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 764 | case GET_ACTIVE_CONFIG: { | 
|  | 765 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 766 | sp<IBinder> display = data.readStrongBinder(); | 
|  | 767 | int id = getActiveConfig(display); | 
|  | 768 | reply->writeInt32(id); | 
|  | 769 | return NO_ERROR; | 
|  | 770 | } | 
|  | 771 | case SET_ACTIVE_CONFIG: { | 
|  | 772 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 773 | sp<IBinder> display = data.readStrongBinder(); | 
|  | 774 | int id = data.readInt32(); | 
|  | 775 | status_t result = setActiveConfig(display, id); | 
| Mathias Agopian | c666cae | 2012-07-25 18:56:13 -0700 | [diff] [blame] | 776 | reply->writeInt32(result); | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 777 | return NO_ERROR; | 
|  | 778 | } | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 779 | case GET_DISPLAY_COLOR_MODES: { | 
|  | 780 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 781 | Vector<ColorMode> colorModes; | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 782 | sp<IBinder> display = nullptr; | 
|  | 783 | status_t result = data.readStrongBinder(&display); | 
|  | 784 | if (result != NO_ERROR) { | 
|  | 785 | ALOGE("getDisplayColorModes failed to readStrongBinder: %d", result); | 
|  | 786 | return result; | 
|  | 787 | } | 
|  | 788 | result = getDisplayColorModes(display, &colorModes); | 
|  | 789 | reply->writeInt32(result); | 
|  | 790 | if (result == NO_ERROR) { | 
|  | 791 | reply->writeUint32(static_cast<uint32_t>(colorModes.size())); | 
|  | 792 | for (size_t i = 0; i < colorModes.size(); ++i) { | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 793 | reply->writeInt32(static_cast<int32_t>(colorModes[i])); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 794 | } | 
|  | 795 | } | 
|  | 796 | return NO_ERROR; | 
|  | 797 | } | 
|  | 798 | case GET_ACTIVE_COLOR_MODE: { | 
|  | 799 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 800 | sp<IBinder> display = nullptr; | 
|  | 801 | status_t result = data.readStrongBinder(&display); | 
|  | 802 | if (result != NO_ERROR) { | 
|  | 803 | ALOGE("getActiveColorMode failed to readStrongBinder: %d", result); | 
|  | 804 | return result; | 
|  | 805 | } | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 806 | ColorMode colorMode = getActiveColorMode(display); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 807 | result = reply->writeInt32(static_cast<int32_t>(colorMode)); | 
|  | 808 | return result; | 
|  | 809 | } | 
|  | 810 | case SET_ACTIVE_COLOR_MODE: { | 
|  | 811 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 812 | sp<IBinder> display = nullptr; | 
|  | 813 | status_t result = data.readStrongBinder(&display); | 
|  | 814 | if (result != NO_ERROR) { | 
|  | 815 | ALOGE("getActiveColorMode failed to readStrongBinder: %d", result); | 
|  | 816 | return result; | 
|  | 817 | } | 
|  | 818 | int32_t colorModeInt = 0; | 
|  | 819 | result = data.readInt32(&colorModeInt); | 
|  | 820 | if (result != NO_ERROR) { | 
|  | 821 | ALOGE("setActiveColorMode failed to readInt32: %d", result); | 
|  | 822 | return result; | 
|  | 823 | } | 
|  | 824 | result = setActiveColorMode(display, | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 825 | static_cast<ColorMode>(colorModeInt)); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 826 | result = reply->writeInt32(result); | 
|  | 827 | return result; | 
|  | 828 | } | 
| Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 829 | case CLEAR_ANIMATION_FRAME_STATS: { | 
|  | 830 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 831 | status_t result = clearAnimationFrameStats(); | 
|  | 832 | reply->writeInt32(result); | 
|  | 833 | return NO_ERROR; | 
|  | 834 | } | 
|  | 835 | case GET_ANIMATION_FRAME_STATS: { | 
|  | 836 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 837 | FrameStats stats; | 
|  | 838 | status_t result = getAnimationFrameStats(&stats); | 
|  | 839 | reply->write(stats); | 
|  | 840 | reply->writeInt32(result); | 
|  | 841 | return NO_ERROR; | 
|  | 842 | } | 
| Prashant Malani | 2c9b11f | 2014-05-25 01:36:31 -0700 | [diff] [blame] | 843 | case SET_POWER_MODE: { | 
|  | 844 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 845 | sp<IBinder> display = data.readStrongBinder(); | 
|  | 846 | int32_t mode = data.readInt32(); | 
|  | 847 | setPowerMode(display, mode); | 
|  | 848 | return NO_ERROR; | 
|  | 849 | } | 
| Dan Stoza | c4f471e | 2016-03-24 09:31:08 -0700 | [diff] [blame] | 850 | case GET_HDR_CAPABILITIES: { | 
|  | 851 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 852 | sp<IBinder> display = nullptr; | 
|  | 853 | status_t result = data.readStrongBinder(&display); | 
|  | 854 | if (result != NO_ERROR) { | 
|  | 855 | ALOGE("getHdrCapabilities failed to readStrongBinder: %d", | 
|  | 856 | result); | 
|  | 857 | return result; | 
|  | 858 | } | 
|  | 859 | HdrCapabilities capabilities; | 
|  | 860 | result = getHdrCapabilities(display, &capabilities); | 
|  | 861 | reply->writeInt32(result); | 
|  | 862 | if (result == NO_ERROR) { | 
| Mathias Agopian | e1f5e6f | 2017-02-06 16:34:41 -0800 | [diff] [blame] | 863 | reply->write(capabilities); | 
| Dan Stoza | c4f471e | 2016-03-24 09:31:08 -0700 | [diff] [blame] | 864 | } | 
|  | 865 | return NO_ERROR; | 
|  | 866 | } | 
| Sahil Dhanju | c1ba5c4 | 2016-06-07 20:09:20 -0700 | [diff] [blame] | 867 | case ENABLE_VSYNC_INJECTIONS: { | 
|  | 868 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 869 | bool enable = false; | 
|  | 870 | status_t result = data.readBool(&enable); | 
|  | 871 | if (result != NO_ERROR) { | 
|  | 872 | ALOGE("enableVSyncInjections failed to readBool: %d", result); | 
|  | 873 | return result; | 
|  | 874 | } | 
|  | 875 | return enableVSyncInjections(enable); | 
|  | 876 | } | 
|  | 877 | case INJECT_VSYNC: { | 
|  | 878 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 879 | int64_t when = 0; | 
|  | 880 | status_t result = data.readInt64(&when); | 
|  | 881 | if (result != NO_ERROR) { | 
|  | 882 | ALOGE("enableVSyncInjections failed to readInt64: %d", result); | 
|  | 883 | return result; | 
|  | 884 | } | 
|  | 885 | return injectVSync(when); | 
|  | 886 | } | 
| Kalle Raita | a099a24 | 2017-01-11 11:17:29 -0800 | [diff] [blame] | 887 | case GET_LAYER_DEBUG_INFO: { | 
|  | 888 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 889 | std::vector<LayerDebugInfo> outLayers; | 
|  | 890 | status_t result = getLayerDebugInfo(&outLayers); | 
|  | 891 | reply->writeInt32(result); | 
|  | 892 | if (result == NO_ERROR) | 
|  | 893 | { | 
|  | 894 | result = reply->writeParcelableVector(outLayers); | 
|  | 895 | } | 
|  | 896 | return result; | 
|  | 897 | } | 
| Peiyong Lin | 0256f72 | 2018-08-31 15:45:10 -0700 | [diff] [blame] | 898 | case GET_COMPOSITION_PREFERENCE: { | 
|  | 899 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 900 | ui::Dataspace dataSpace; | 
|  | 901 | ui::PixelFormat pixelFormat; | 
|  | 902 | status_t error = getCompositionPreference(&dataSpace, &pixelFormat); | 
|  | 903 | reply->writeInt32(error); | 
|  | 904 | if (error == NO_ERROR) { | 
|  | 905 | reply->writeInt32(static_cast<int32_t>(dataSpace)); | 
|  | 906 | reply->writeInt32(static_cast<int32_t>(pixelFormat)); | 
|  | 907 | } | 
|  | 908 | return NO_ERROR; | 
|  | 909 | } | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 910 | default: { | 
| Mathias Agopian | 83c0446 | 2009-05-22 19:00:22 -0700 | [diff] [blame] | 911 | return BBinder::onTransact(code, data, reply, flags); | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 912 | } | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 913 | } | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 914 | } | 
|  | 915 |  | 
|  | 916 | // ---------------------------------------------------------------------------- | 
|  | 917 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 918 | }; |