| 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> | 
| Dan Stoza | 84ab937 | 2018-12-17 15:27:57 -0800 | [diff] [blame] | 29 | #include <gui/IRegionSamplingListener.h> | 
| Mathias Agopian | 2b5dd40 | 2017-02-07 17:36:19 -0800 | [diff] [blame] | 30 | #include <gui/ISurfaceComposer.h> | 
|  | 31 | #include <gui/ISurfaceComposerClient.h> | 
| Kalle Raita | a099a24 | 2017-01-11 11:17:29 -0800 | [diff] [blame] | 32 | #include <gui/LayerDebugInfo.h> | 
| Robert Carr | 4cdc58f | 2017-08-23 14:22:20 -0700 | [diff] [blame] | 33 | #include <gui/LayerState.h> | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 34 |  | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 35 | #include <system/graphics.h> | 
|  | 36 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 37 | #include <ui/DisplayInfo.h> | 
| Lajos Molnar | 67d8bd6 | 2014-09-11 14:58:45 -0700 | [diff] [blame] | 38 | #include <ui/DisplayStatInfo.h> | 
| Dan Stoza | c4f471e | 2016-03-24 09:31:08 -0700 | [diff] [blame] | 39 | #include <ui/HdrCapabilities.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 40 |  | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 41 | #include <utils/Log.h> | 
| Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 42 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 43 | // --------------------------------------------------------------------------- | 
|  | 44 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | namespace android { | 
|  | 46 |  | 
| Peiyong Lin | 9f03447 | 2018-03-28 15:29:00 -0700 | [diff] [blame] | 47 | using ui::ColorMode; | 
|  | 48 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 49 | class BpSurfaceComposer : public BpInterface<ISurfaceComposer> | 
|  | 50 | { | 
|  | 51 | public: | 
| Chih-Hung Hsieh | e2347b7 | 2016-04-25 15:41:05 -0700 | [diff] [blame] | 52 | explicit BpSurfaceComposer(const sp<IBinder>& impl) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 53 | : BpInterface<ISurfaceComposer>(impl) | 
|  | 54 | { | 
|  | 55 | } | 
|  | 56 |  | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 57 | virtual ~BpSurfaceComposer(); | 
|  | 58 |  | 
| Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 59 | virtual sp<ISurfaceComposerClient> createConnection() | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 60 | { | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 61 | Parcel data, reply; | 
|  | 62 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 63 | remote()->transact(BnSurfaceComposer::CREATE_CONNECTION, data, &reply); | 
| Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 64 | return interface_cast<ISurfaceComposerClient>(reply.readStrongBinder()); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 65 | } | 
|  | 66 |  | 
| Marissa Wall | 713b63f | 2018-10-17 15:42:43 -0700 | [diff] [blame] | 67 | virtual void setTransactionState(const Vector<ComposerState>& state, | 
|  | 68 | const Vector<DisplayState>& displays, uint32_t flags, | 
| chaviw | 273171b | 2018-12-26 11:46:30 -0800 | [diff] [blame] | 69 | const sp<IBinder>& applyToken, | 
| Marissa Wall | 17b4e45 | 2018-12-26 16:32:34 -0800 | [diff] [blame] | 70 | const InputWindowCommands& commands, | 
| Marissa Wall | 78b7220 | 2019-03-15 14:58:34 -0700 | [diff] [blame] | 71 | int64_t desiredPresentTime, | 
| Marissa Wall | 947d34e | 2019-03-29 14:03:53 -0700 | [diff] [blame] | 72 | const client_cache_t& uncacheBuffer, | 
| Marissa Wall | 3dad52d | 2019-03-22 14:03:19 -0700 | [diff] [blame] | 73 | const std::vector<ListenerCallbacks>& listenerCallbacks) { | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 74 | Parcel data, reply; | 
|  | 75 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 76 |  | 
|  | 77 | data.writeUint32(static_cast<uint32_t>(state.size())); | 
|  | 78 | for (const auto& s : state) { | 
|  | 79 | s.write(data); | 
| Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 80 | } | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 81 |  | 
|  | 82 | data.writeUint32(static_cast<uint32_t>(displays.size())); | 
|  | 83 | for (const auto& d : displays) { | 
|  | 84 | d.write(data); | 
| Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 85 | } | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 86 |  | 
|  | 87 | data.writeUint32(flags); | 
| Marissa Wall | 713b63f | 2018-10-17 15:42:43 -0700 | [diff] [blame] | 88 | data.writeStrongBinder(applyToken); | 
| chaviw | 273171b | 2018-12-26 11:46:30 -0800 | [diff] [blame] | 89 | commands.write(data); | 
| Marissa Wall | 17b4e45 | 2018-12-26 16:32:34 -0800 | [diff] [blame] | 90 | data.writeInt64(desiredPresentTime); | 
| Marissa Wall | 947d34e | 2019-03-29 14:03:53 -0700 | [diff] [blame] | 91 | data.writeWeakBinder(uncacheBuffer.token); | 
|  | 92 | data.writeUint64(uncacheBuffer.id); | 
| Marissa Wall | 3dad52d | 2019-03-22 14:03:19 -0700 | [diff] [blame] | 93 |  | 
|  | 94 | if (data.writeVectorSize(listenerCallbacks) == NO_ERROR) { | 
|  | 95 | for (const auto& [listener, callbackIds] : listenerCallbacks) { | 
|  | 96 | data.writeStrongBinder(IInterface::asBinder(listener)); | 
|  | 97 | data.writeInt64Vector(callbackIds); | 
|  | 98 | } | 
|  | 99 | } | 
|  | 100 |  | 
| Jamie Gennis | b8d69a5 | 2011-10-10 15:48:06 -0700 | [diff] [blame] | 101 | remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 102 | } | 
|  | 103 |  | 
|  | 104 | virtual void bootFinished() | 
|  | 105 | { | 
|  | 106 | Parcel data, reply; | 
|  | 107 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 108 | remote()->transact(BnSurfaceComposer::BOOT_FINISHED, data, &reply); | 
|  | 109 | } | 
|  | 110 |  | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 111 | virtual status_t captureScreen(const sp<IBinder>& display, sp<GraphicBuffer>* outBuffer, | 
| Robert Carr | 108b2c7 | 2019-04-02 16:32:58 -0700 | [diff] [blame] | 112 | bool& outCapturedSecureLayers, const ui::Dataspace reqDataspace, | 
| Peiyong Lin | 0e003c9 | 2018-09-17 11:09:51 -0700 | [diff] [blame] | 113 | const ui::PixelFormat reqPixelFormat, Rect sourceCrop, | 
|  | 114 | uint32_t reqWidth, uint32_t reqHeight, bool useIdentityTransform, | 
| Robert Carr | fa8855f | 2019-02-19 10:05:00 -0800 | [diff] [blame] | 115 | ISurfaceComposer::Rotation rotation, bool captureSecureLayers) { | 
| Mathias Agopian | 2a9fc49 | 2013-03-01 13:42:57 -0800 | [diff] [blame] | 116 | Parcel data, reply; | 
|  | 117 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 118 | data.writeStrongBinder(display); | 
| Peiyong Lin | 0e003c9 | 2018-09-17 11:09:51 -0700 | [diff] [blame] | 119 | data.writeInt32(static_cast<int32_t>(reqDataspace)); | 
|  | 120 | data.writeInt32(static_cast<int32_t>(reqPixelFormat)); | 
| Dan Stoza | c187900 | 2014-05-22 15:59:05 -0700 | [diff] [blame] | 121 | data.write(sourceCrop); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 122 | data.writeUint32(reqWidth); | 
|  | 123 | data.writeUint32(reqHeight); | 
| Dan Stoza | c701401 | 2014-02-14 15:03:43 -0800 | [diff] [blame] | 124 | data.writeInt32(static_cast<int32_t>(useIdentityTransform)); | 
| Riley Andrews | c3ebe66 | 2014-09-04 16:20:31 -0700 | [diff] [blame] | 125 | data.writeInt32(static_cast<int32_t>(rotation)); | 
| Robert Carr | fa8855f | 2019-02-19 10:05:00 -0800 | [diff] [blame] | 126 | data.writeInt32(static_cast<int32_t>(captureSecureLayers)); | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 127 | status_t result = remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply); | 
|  | 128 | if (result != NO_ERROR) { | 
|  | 129 | ALOGE("captureScreen failed to transact: %d", result); | 
|  | 130 | return result; | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 131 | } | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 132 | result = reply.readInt32(); | 
|  | 133 | if (result != NO_ERROR) { | 
|  | 134 | ALOGE("captureScreen failed to readInt32: %d", result); | 
|  | 135 | return result; | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 136 | } | 
|  | 137 |  | 
|  | 138 | *outBuffer = new GraphicBuffer(); | 
|  | 139 | reply.read(**outBuffer); | 
| Robert Carr | 108b2c7 | 2019-04-02 16:32:58 -0700 | [diff] [blame] | 140 | outCapturedSecureLayers = reply.readBool(); | 
| Peiyong Lin | 0e003c9 | 2018-09-17 11:09:51 -0700 | [diff] [blame] | 141 |  | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 142 | return result; | 
| Mathias Agopian | 2a9fc49 | 2013-03-01 13:42:57 -0800 | [diff] [blame] | 143 | } | 
|  | 144 |  | 
| chaviw | 93df2ea | 2019-04-30 16:45:12 -0700 | [diff] [blame] | 145 | virtual status_t captureScreen(uint64_t displayOrLayerStack, ui::Dataspace* outDataspace, | 
|  | 146 | sp<GraphicBuffer>* outBuffer) { | 
|  | 147 | Parcel data, reply; | 
|  | 148 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 149 | data.writeUint64(displayOrLayerStack); | 
|  | 150 | status_t result = remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN_BY_ID, data, &reply); | 
|  | 151 | if (result != NO_ERROR) { | 
|  | 152 | ALOGE("captureScreen failed to transact: %d", result); | 
|  | 153 | return result; | 
|  | 154 | } | 
|  | 155 | result = reply.readInt32(); | 
|  | 156 | if (result != NO_ERROR) { | 
|  | 157 | ALOGE("captureScreen failed to readInt32: %d", result); | 
|  | 158 | return result; | 
|  | 159 | } | 
|  | 160 |  | 
|  | 161 | *outDataspace = static_cast<ui::Dataspace>(reply.readInt32()); | 
|  | 162 | *outBuffer = new GraphicBuffer(); | 
|  | 163 | reply.read(**outBuffer); | 
|  | 164 | return result; | 
|  | 165 | } | 
|  | 166 |  | 
| Robert Carr | 866455f | 2019-04-02 16:28:26 -0700 | [diff] [blame] | 167 | virtual status_t captureLayers( | 
|  | 168 | const sp<IBinder>& layerHandleBinder, sp<GraphicBuffer>* outBuffer, | 
|  | 169 | const ui::Dataspace reqDataspace, const ui::PixelFormat reqPixelFormat, | 
|  | 170 | const Rect& sourceCrop, | 
|  | 171 | const std::unordered_set<sp<IBinder>, SpHash<IBinder>>& excludeLayers, float frameScale, | 
|  | 172 | bool childrenOnly) { | 
| chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 173 | Parcel data, reply; | 
|  | 174 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 175 | data.writeStrongBinder(layerHandleBinder); | 
| Peiyong Lin | 0e003c9 | 2018-09-17 11:09:51 -0700 | [diff] [blame] | 176 | data.writeInt32(static_cast<int32_t>(reqDataspace)); | 
|  | 177 | data.writeInt32(static_cast<int32_t>(reqPixelFormat)); | 
| chaviw | 7206d49 | 2017-11-10 16:16:12 -0800 | [diff] [blame] | 178 | data.write(sourceCrop); | 
| Robert Carr | 866455f | 2019-04-02 16:28:26 -0700 | [diff] [blame] | 179 | data.writeInt32(excludeLayers.size()); | 
|  | 180 | for (auto el : excludeLayers) { | 
|  | 181 | data.writeStrongBinder(el); | 
|  | 182 | } | 
| chaviw | 7206d49 | 2017-11-10 16:16:12 -0800 | [diff] [blame] | 183 | data.writeFloat(frameScale); | 
| Robert Carr | 578038f | 2018-03-09 12:25:24 -0800 | [diff] [blame] | 184 | data.writeBool(childrenOnly); | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 185 | status_t result = remote()->transact(BnSurfaceComposer::CAPTURE_LAYERS, data, &reply); | 
|  | 186 | if (result != NO_ERROR) { | 
|  | 187 | ALOGE("captureLayers failed to transact: %d", result); | 
|  | 188 | return result; | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 189 | } | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 190 | result = reply.readInt32(); | 
|  | 191 | if (result != NO_ERROR) { | 
|  | 192 | ALOGE("captureLayers failed to readInt32: %d", result); | 
|  | 193 | return result; | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 194 | } | 
| Peiyong Lin | 0e003c9 | 2018-09-17 11:09:51 -0700 | [diff] [blame] | 195 |  | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 196 | *outBuffer = new GraphicBuffer(); | 
|  | 197 | reply.read(**outBuffer); | 
|  | 198 |  | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 199 | return result; | 
| chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 200 | } | 
|  | 201 |  | 
| Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 202 | virtual bool authenticateSurfaceTexture( | 
| Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 203 | const sp<IGraphicBufferProducer>& bufferProducer) const | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 204 | { | 
|  | 205 | Parcel data, reply; | 
|  | 206 | int err = NO_ERROR; | 
|  | 207 | err = data.writeInterfaceToken( | 
|  | 208 | ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 209 | if (err != NO_ERROR) { | 
| Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 210 | ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing " | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 211 | "interface descriptor: %s (%d)", strerror(-err), -err); | 
|  | 212 | return false; | 
|  | 213 | } | 
| Marco Nelissen | 2ea926b | 2014-11-14 08:01:01 -0800 | [diff] [blame] | 214 | err = data.writeStrongBinder(IInterface::asBinder(bufferProducer)); | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 215 | if (err != NO_ERROR) { | 
| Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 216 | ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing " | 
| Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 217 | "strong binder to parcel: %s (%d)", strerror(-err), -err); | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 218 | return false; | 
|  | 219 | } | 
|  | 220 | err = remote()->transact(BnSurfaceComposer::AUTHENTICATE_SURFACE, data, | 
|  | 221 | &reply); | 
|  | 222 | if (err != NO_ERROR) { | 
| Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 223 | ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error " | 
| Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 224 | "performing transaction: %s (%d)", strerror(-err), -err); | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 225 | return false; | 
|  | 226 | } | 
|  | 227 | int32_t result = 0; | 
|  | 228 | err = reply.readInt32(&result); | 
|  | 229 | if (err != NO_ERROR) { | 
| Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 230 | ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error " | 
| Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 231 | "retrieving result: %s (%d)", strerror(-err), -err); | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 232 | return false; | 
|  | 233 | } | 
|  | 234 | return result != 0; | 
|  | 235 | } | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 236 |  | 
| Brian Anderson | 6b37671 | 2017-04-04 10:51:39 -0700 | [diff] [blame] | 237 | virtual status_t getSupportedFrameTimestamps( | 
|  | 238 | std::vector<FrameEvent>* outSupported) const { | 
|  | 239 | if (!outSupported) { | 
|  | 240 | return UNEXPECTED_NULL; | 
|  | 241 | } | 
|  | 242 | outSupported->clear(); | 
|  | 243 |  | 
|  | 244 | Parcel data, reply; | 
|  | 245 |  | 
|  | 246 | status_t err = data.writeInterfaceToken( | 
|  | 247 | ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 248 | if (err != NO_ERROR) { | 
|  | 249 | return err; | 
|  | 250 | } | 
|  | 251 |  | 
|  | 252 | err = remote()->transact( | 
|  | 253 | BnSurfaceComposer::GET_SUPPORTED_FRAME_TIMESTAMPS, | 
|  | 254 | data, &reply); | 
|  | 255 | if (err != NO_ERROR) { | 
|  | 256 | return err; | 
|  | 257 | } | 
|  | 258 |  | 
|  | 259 | int32_t result = 0; | 
|  | 260 | err = reply.readInt32(&result); | 
|  | 261 | if (err != NO_ERROR) { | 
|  | 262 | return err; | 
|  | 263 | } | 
|  | 264 | if (result != NO_ERROR) { | 
|  | 265 | return result; | 
|  | 266 | } | 
|  | 267 |  | 
|  | 268 | std::vector<int32_t> supported; | 
|  | 269 | err = reply.readInt32Vector(&supported); | 
|  | 270 | if (err != NO_ERROR) { | 
|  | 271 | return err; | 
|  | 272 | } | 
|  | 273 |  | 
|  | 274 | outSupported->reserve(supported.size()); | 
|  | 275 | for (int32_t s : supported) { | 
|  | 276 | outSupported->push_back(static_cast<FrameEvent>(s)); | 
|  | 277 | } | 
|  | 278 | return NO_ERROR; | 
|  | 279 | } | 
|  | 280 |  | 
| Jorim Jaggi | b1e2f8d | 2017-06-08 15:43:59 -0700 | [diff] [blame] | 281 | virtual sp<IDisplayEventConnection> createDisplayEventConnection(VsyncSource vsyncSource) | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 282 | { | 
|  | 283 | Parcel data, reply; | 
|  | 284 | sp<IDisplayEventConnection> result; | 
|  | 285 | int err = data.writeInterfaceToken( | 
|  | 286 | ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 287 | if (err != NO_ERROR) { | 
|  | 288 | return result; | 
|  | 289 | } | 
| Jorim Jaggi | b1e2f8d | 2017-06-08 15:43:59 -0700 | [diff] [blame] | 290 | data.writeInt32(static_cast<int32_t>(vsyncSource)); | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 291 | err = remote()->transact( | 
|  | 292 | BnSurfaceComposer::CREATE_DISPLAY_EVENT_CONNECTION, | 
|  | 293 | data, &reply); | 
|  | 294 | if (err != NO_ERROR) { | 
| Steve Block | e6f43dd | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 295 | ALOGE("ISurfaceComposer::createDisplayEventConnection: error performing " | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 296 | "transaction: %s (%d)", strerror(-err), -err); | 
|  | 297 | return result; | 
|  | 298 | } | 
|  | 299 | result = interface_cast<IDisplayEventConnection>(reply.readStrongBinder()); | 
|  | 300 | return result; | 
|  | 301 | } | 
| Colin Cross | 8e53306 | 2012-06-07 13:17:52 -0700 | [diff] [blame] | 302 |  | 
| Jamie Gennis | dd3cb84 | 2012-10-19 18:19:11 -0700 | [diff] [blame] | 303 | virtual sp<IBinder> createDisplay(const String8& displayName, bool secure) | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 304 | { | 
|  | 305 | Parcel data, reply; | 
|  | 306 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
| Andy McFadden | 8dfa92f | 2012-09-17 18:27:17 -0700 | [diff] [blame] | 307 | data.writeString8(displayName); | 
| Jamie Gennis | dd3cb84 | 2012-10-19 18:19:11 -0700 | [diff] [blame] | 308 | data.writeInt32(secure ? 1 : 0); | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 309 | remote()->transact(BnSurfaceComposer::CREATE_DISPLAY, data, &reply); | 
|  | 310 | return reply.readStrongBinder(); | 
|  | 311 | } | 
|  | 312 |  | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 313 | virtual void destroyDisplay(const sp<IBinder>& display) | 
|  | 314 | { | 
|  | 315 | Parcel data, reply; | 
|  | 316 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 317 | data.writeStrongBinder(display); | 
|  | 318 | remote()->transact(BnSurfaceComposer::DESTROY_DISPLAY, data, &reply); | 
|  | 319 | } | 
|  | 320 |  | 
| Dominik Laskowski | dcb38bb | 2019-01-25 02:35:50 -0800 | [diff] [blame] | 321 | virtual std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const { | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 322 | Parcel data, reply; | 
|  | 323 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
| Dominik Laskowski | dcb38bb | 2019-01-25 02:35:50 -0800 | [diff] [blame] | 324 | if (remote()->transact(BnSurfaceComposer::GET_PHYSICAL_DISPLAY_IDS, data, &reply) == | 
|  | 325 | NO_ERROR) { | 
|  | 326 | std::vector<PhysicalDisplayId> displayIds; | 
|  | 327 | if (reply.readUint64Vector(&displayIds) == NO_ERROR) { | 
|  | 328 | return displayIds; | 
|  | 329 | } | 
|  | 330 | } | 
|  | 331 |  | 
|  | 332 | return {}; | 
|  | 333 | } | 
|  | 334 |  | 
|  | 335 | virtual sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId displayId) const { | 
|  | 336 | Parcel data, reply; | 
|  | 337 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 338 | data.writeUint64(displayId); | 
|  | 339 | remote()->transact(BnSurfaceComposer::GET_PHYSICAL_DISPLAY_TOKEN, data, &reply); | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 340 | return reply.readStrongBinder(); | 
|  | 341 | } | 
|  | 342 |  | 
| Prashant Malani | 2c9b11f | 2014-05-25 01:36:31 -0700 | [diff] [blame] | 343 | virtual void setPowerMode(const sp<IBinder>& display, int mode) | 
| Colin Cross | 8e53306 | 2012-06-07 13:17:52 -0700 | [diff] [blame] | 344 | { | 
|  | 345 | Parcel data, reply; | 
|  | 346 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
| Andy McFadden | c01a79d | 2012-09-27 16:02:06 -0700 | [diff] [blame] | 347 | data.writeStrongBinder(display); | 
| Prashant Malani | 2c9b11f | 2014-05-25 01:36:31 -0700 | [diff] [blame] | 348 | data.writeInt32(mode); | 
|  | 349 | remote()->transact(BnSurfaceComposer::SET_POWER_MODE, data, &reply); | 
| Colin Cross | 8e53306 | 2012-06-07 13:17:52 -0700 | [diff] [blame] | 350 | } | 
| Mathias Agopian | 3094df3 | 2012-06-18 18:06:45 -0700 | [diff] [blame] | 351 |  | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 352 | virtual status_t getDisplayConfigs(const sp<IBinder>& display, | 
|  | 353 | Vector<DisplayInfo>* configs) | 
| Mathias Agopian | c666cae | 2012-07-25 18:56:13 -0700 | [diff] [blame] | 354 | { | 
|  | 355 | Parcel data, reply; | 
|  | 356 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
| Jeff Brown | 9d4e3d2 | 2012-08-24 20:00:51 -0700 | [diff] [blame] | 357 | data.writeStrongBinder(display); | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 358 | remote()->transact(BnSurfaceComposer::GET_DISPLAY_CONFIGS, data, &reply); | 
|  | 359 | status_t result = reply.readInt32(); | 
|  | 360 | if (result == NO_ERROR) { | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 361 | size_t numConfigs = reply.readUint32(); | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 362 | configs->clear(); | 
|  | 363 | configs->resize(numConfigs); | 
|  | 364 | for (size_t c = 0; c < numConfigs; ++c) { | 
|  | 365 | memcpy(&(configs->editItemAt(c)), | 
|  | 366 | reply.readInplace(sizeof(DisplayInfo)), | 
|  | 367 | sizeof(DisplayInfo)); | 
|  | 368 | } | 
|  | 369 | } | 
|  | 370 | return result; | 
|  | 371 | } | 
|  | 372 |  | 
| Lajos Molnar | 67d8bd6 | 2014-09-11 14:58:45 -0700 | [diff] [blame] | 373 | virtual status_t getDisplayStats(const sp<IBinder>& display, | 
|  | 374 | DisplayStatInfo* stats) | 
|  | 375 | { | 
|  | 376 | Parcel data, reply; | 
|  | 377 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 378 | data.writeStrongBinder(display); | 
|  | 379 | remote()->transact(BnSurfaceComposer::GET_DISPLAY_STATS, data, &reply); | 
|  | 380 | status_t result = reply.readInt32(); | 
|  | 381 | if (result == NO_ERROR) { | 
|  | 382 | memcpy(stats, | 
|  | 383 | reply.readInplace(sizeof(DisplayStatInfo)), | 
|  | 384 | sizeof(DisplayStatInfo)); | 
|  | 385 | } | 
|  | 386 | return result; | 
|  | 387 | } | 
|  | 388 |  | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 389 | virtual int getActiveConfig(const sp<IBinder>& display) | 
|  | 390 | { | 
|  | 391 | Parcel data, reply; | 
|  | 392 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 393 | data.writeStrongBinder(display); | 
|  | 394 | remote()->transact(BnSurfaceComposer::GET_ACTIVE_CONFIG, data, &reply); | 
|  | 395 | return reply.readInt32(); | 
|  | 396 | } | 
|  | 397 |  | 
|  | 398 | virtual status_t setActiveConfig(const sp<IBinder>& display, int id) | 
|  | 399 | { | 
|  | 400 | Parcel data, reply; | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 401 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 402 | if (result != NO_ERROR) { | 
|  | 403 | ALOGE("setActiveConfig failed to writeInterfaceToken: %d", result); | 
|  | 404 | return result; | 
|  | 405 | } | 
|  | 406 | result = data.writeStrongBinder(display); | 
|  | 407 | if (result != NO_ERROR) { | 
|  | 408 | ALOGE("setActiveConfig failed to writeStrongBinder: %d", result); | 
|  | 409 | return result; | 
|  | 410 | } | 
|  | 411 | result = data.writeInt32(id); | 
|  | 412 | if (result != NO_ERROR) { | 
|  | 413 | ALOGE("setActiveConfig failed to writeInt32: %d", result); | 
|  | 414 | return result; | 
|  | 415 | } | 
|  | 416 | result = remote()->transact(BnSurfaceComposer::SET_ACTIVE_CONFIG, data, &reply); | 
|  | 417 | if (result != NO_ERROR) { | 
|  | 418 | ALOGE("setActiveConfig failed to transact: %d", result); | 
|  | 419 | return result; | 
|  | 420 | } | 
| Mathias Agopian | c666cae | 2012-07-25 18:56:13 -0700 | [diff] [blame] | 421 | return reply.readInt32(); | 
|  | 422 | } | 
| Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 423 |  | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 424 | virtual status_t getDisplayColorModes(const sp<IBinder>& display, | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 425 | Vector<ColorMode>* outColorModes) { | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 426 | Parcel data, reply; | 
|  | 427 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 428 | if (result != NO_ERROR) { | 
|  | 429 | ALOGE("getDisplayColorModes failed to writeInterfaceToken: %d", result); | 
|  | 430 | return result; | 
|  | 431 | } | 
|  | 432 | result = data.writeStrongBinder(display); | 
|  | 433 | if (result != NO_ERROR) { | 
|  | 434 | ALOGE("getDisplayColorModes failed to writeStrongBinder: %d", result); | 
|  | 435 | return result; | 
|  | 436 | } | 
|  | 437 | result = remote()->transact(BnSurfaceComposer::GET_DISPLAY_COLOR_MODES, data, &reply); | 
|  | 438 | if (result != NO_ERROR) { | 
|  | 439 | ALOGE("getDisplayColorModes failed to transact: %d", result); | 
|  | 440 | return result; | 
|  | 441 | } | 
|  | 442 | result = static_cast<status_t>(reply.readInt32()); | 
|  | 443 | if (result == NO_ERROR) { | 
|  | 444 | size_t numModes = reply.readUint32(); | 
|  | 445 | outColorModes->clear(); | 
|  | 446 | outColorModes->resize(numModes); | 
|  | 447 | for (size_t i = 0; i < numModes; ++i) { | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 448 | outColorModes->replaceAt(static_cast<ColorMode>(reply.readInt32()), i); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 449 | } | 
|  | 450 | } | 
|  | 451 | return result; | 
|  | 452 | } | 
|  | 453 |  | 
| Daniel Solomon | 42d0456 | 2019-01-20 21:03:19 -0800 | [diff] [blame] | 454 | virtual status_t getDisplayNativePrimaries(const sp<IBinder>& display, | 
|  | 455 | ui::DisplayPrimaries& primaries) { | 
|  | 456 | Parcel data, reply; | 
|  | 457 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 458 | if (result != NO_ERROR) { | 
|  | 459 | ALOGE("getDisplayNativePrimaries failed to writeInterfaceToken: %d", result); | 
|  | 460 | return result; | 
|  | 461 | } | 
|  | 462 | result = data.writeStrongBinder(display); | 
|  | 463 | if (result != NO_ERROR) { | 
|  | 464 | ALOGE("getDisplayNativePrimaries failed to writeStrongBinder: %d", result); | 
|  | 465 | return result; | 
|  | 466 | } | 
|  | 467 | result = remote()->transact(BnSurfaceComposer::GET_DISPLAY_NATIVE_PRIMARIES, data, &reply); | 
|  | 468 | if (result != NO_ERROR) { | 
|  | 469 | ALOGE("getDisplayNativePrimaries failed to transact: %d", result); | 
|  | 470 | return result; | 
|  | 471 | } | 
|  | 472 | result = reply.readInt32(); | 
|  | 473 | if (result == NO_ERROR) { | 
|  | 474 | memcpy(&primaries, reply.readInplace(sizeof(ui::DisplayPrimaries)), | 
|  | 475 | sizeof(ui::DisplayPrimaries)); | 
|  | 476 | } | 
|  | 477 | return result; | 
|  | 478 | } | 
|  | 479 |  | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 480 | virtual ColorMode getActiveColorMode(const sp<IBinder>& display) { | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 481 | Parcel data, reply; | 
|  | 482 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 483 | if (result != NO_ERROR) { | 
|  | 484 | ALOGE("getActiveColorMode failed to writeInterfaceToken: %d", result); | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 485 | return static_cast<ColorMode>(result); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 486 | } | 
|  | 487 | result = data.writeStrongBinder(display); | 
|  | 488 | if (result != NO_ERROR) { | 
|  | 489 | ALOGE("getActiveColorMode failed to writeStrongBinder: %d", result); | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 490 | return static_cast<ColorMode>(result); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 491 | } | 
|  | 492 | result = remote()->transact(BnSurfaceComposer::GET_ACTIVE_COLOR_MODE, data, &reply); | 
|  | 493 | if (result != NO_ERROR) { | 
|  | 494 | ALOGE("getActiveColorMode failed to transact: %d", result); | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 495 | return static_cast<ColorMode>(result); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 496 | } | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 497 | return static_cast<ColorMode>(reply.readInt32()); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 498 | } | 
|  | 499 |  | 
|  | 500 | virtual status_t setActiveColorMode(const sp<IBinder>& display, | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 501 | ColorMode colorMode) { | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 502 | Parcel data, reply; | 
|  | 503 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 504 | if (result != NO_ERROR) { | 
|  | 505 | ALOGE("setActiveColorMode failed to writeInterfaceToken: %d", result); | 
|  | 506 | return result; | 
|  | 507 | } | 
|  | 508 | result = data.writeStrongBinder(display); | 
|  | 509 | if (result != NO_ERROR) { | 
|  | 510 | ALOGE("setActiveColorMode failed to writeStrongBinder: %d", result); | 
|  | 511 | return result; | 
|  | 512 | } | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 513 | result = data.writeInt32(static_cast<int32_t>(colorMode)); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 514 | if (result != NO_ERROR) { | 
|  | 515 | ALOGE("setActiveColorMode failed to writeInt32: %d", result); | 
|  | 516 | return result; | 
|  | 517 | } | 
|  | 518 | result = remote()->transact(BnSurfaceComposer::SET_ACTIVE_COLOR_MODE, data, &reply); | 
|  | 519 | if (result != NO_ERROR) { | 
|  | 520 | ALOGE("setActiveColorMode failed to transact: %d", result); | 
|  | 521 | return result; | 
|  | 522 | } | 
|  | 523 | return static_cast<status_t>(reply.readInt32()); | 
|  | 524 | } | 
|  | 525 |  | 
| Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 526 | virtual status_t clearAnimationFrameStats() { | 
|  | 527 | Parcel data, reply; | 
| Ana Krulec | 2d41e42 | 2018-07-26 12:07:43 -0700 | [diff] [blame] | 528 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 529 | if (result != NO_ERROR) { | 
|  | 530 | ALOGE("clearAnimationFrameStats failed to writeInterfaceToken: %d", result); | 
|  | 531 | return result; | 
|  | 532 | } | 
|  | 533 | result = remote()->transact(BnSurfaceComposer::CLEAR_ANIMATION_FRAME_STATS, data, &reply); | 
|  | 534 | if (result != NO_ERROR) { | 
|  | 535 | ALOGE("clearAnimationFrameStats failed to transact: %d", result); | 
|  | 536 | return result; | 
|  | 537 | } | 
| Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 538 | return reply.readInt32(); | 
|  | 539 | } | 
|  | 540 |  | 
|  | 541 | virtual status_t getAnimationFrameStats(FrameStats* outStats) const { | 
|  | 542 | Parcel data, reply; | 
|  | 543 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 544 | remote()->transact(BnSurfaceComposer::GET_ANIMATION_FRAME_STATS, data, &reply); | 
|  | 545 | reply.read(*outStats); | 
|  | 546 | return reply.readInt32(); | 
|  | 547 | } | 
| Dan Stoza | c4f471e | 2016-03-24 09:31:08 -0700 | [diff] [blame] | 548 |  | 
|  | 549 | virtual status_t getHdrCapabilities(const sp<IBinder>& display, | 
|  | 550 | HdrCapabilities* outCapabilities) const { | 
|  | 551 | Parcel data, reply; | 
|  | 552 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 553 | status_t result = data.writeStrongBinder(display); | 
|  | 554 | if (result != NO_ERROR) { | 
|  | 555 | ALOGE("getHdrCapabilities failed to writeStrongBinder: %d", result); | 
|  | 556 | return result; | 
|  | 557 | } | 
|  | 558 | result = remote()->transact(BnSurfaceComposer::GET_HDR_CAPABILITIES, | 
|  | 559 | data, &reply); | 
|  | 560 | if (result != NO_ERROR) { | 
|  | 561 | ALOGE("getHdrCapabilities failed to transact: %d", result); | 
|  | 562 | return result; | 
|  | 563 | } | 
|  | 564 | result = reply.readInt32(); | 
|  | 565 | if (result == NO_ERROR) { | 
| Mathias Agopian | e1f5e6f | 2017-02-06 16:34:41 -0800 | [diff] [blame] | 566 | result = reply.read(*outCapabilities); | 
| Dan Stoza | c4f471e | 2016-03-24 09:31:08 -0700 | [diff] [blame] | 567 | } | 
|  | 568 | return result; | 
|  | 569 | } | 
| Sahil Dhanju | c1ba5c4 | 2016-06-07 20:09:20 -0700 | [diff] [blame] | 570 |  | 
|  | 571 | virtual status_t enableVSyncInjections(bool enable) { | 
|  | 572 | Parcel data, reply; | 
|  | 573 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 574 | if (result != NO_ERROR) { | 
|  | 575 | ALOGE("enableVSyncInjections failed to writeInterfaceToken: %d", result); | 
|  | 576 | return result; | 
|  | 577 | } | 
|  | 578 | result = data.writeBool(enable); | 
|  | 579 | if (result != NO_ERROR) { | 
|  | 580 | ALOGE("enableVSyncInjections failed to writeBool: %d", result); | 
|  | 581 | return result; | 
|  | 582 | } | 
| Steven Moreland | 366eb42 | 2019-04-01 19:22:32 -0700 | [diff] [blame] | 583 | result = remote()->transact(BnSurfaceComposer::ENABLE_VSYNC_INJECTIONS, data, &reply, | 
|  | 584 | IBinder::FLAG_ONEWAY); | 
| Sahil Dhanju | c1ba5c4 | 2016-06-07 20:09:20 -0700 | [diff] [blame] | 585 | if (result != NO_ERROR) { | 
|  | 586 | ALOGE("enableVSyncInjections failed to transact: %d", result); | 
|  | 587 | return result; | 
|  | 588 | } | 
|  | 589 | return result; | 
|  | 590 | } | 
|  | 591 |  | 
|  | 592 | virtual status_t injectVSync(nsecs_t when) { | 
|  | 593 | Parcel data, reply; | 
|  | 594 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 595 | if (result != NO_ERROR) { | 
|  | 596 | ALOGE("injectVSync failed to writeInterfaceToken: %d", result); | 
|  | 597 | return result; | 
|  | 598 | } | 
|  | 599 | result = data.writeInt64(when); | 
|  | 600 | if (result != NO_ERROR) { | 
|  | 601 | ALOGE("injectVSync failed to writeInt64: %d", result); | 
|  | 602 | return result; | 
|  | 603 | } | 
| Steven Moreland | 366eb42 | 2019-04-01 19:22:32 -0700 | [diff] [blame] | 604 | result = remote()->transact(BnSurfaceComposer::INJECT_VSYNC, data, &reply, | 
|  | 605 | IBinder::FLAG_ONEWAY); | 
| Sahil Dhanju | c1ba5c4 | 2016-06-07 20:09:20 -0700 | [diff] [blame] | 606 | if (result != NO_ERROR) { | 
|  | 607 | ALOGE("injectVSync failed to transact: %d", result); | 
|  | 608 | return result; | 
|  | 609 | } | 
|  | 610 | return result; | 
|  | 611 | } | 
|  | 612 |  | 
| Vishnu Nair | b123f47 | 2020-06-22 11:52:39 -0700 | [diff] [blame^] | 613 | virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) | 
| Kalle Raita | a099a24 | 2017-01-11 11:17:29 -0800 | [diff] [blame] | 614 | { | 
|  | 615 | if (!outLayers) { | 
|  | 616 | return UNEXPECTED_NULL; | 
|  | 617 | } | 
|  | 618 |  | 
|  | 619 | Parcel data, reply; | 
|  | 620 |  | 
|  | 621 | status_t err = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 622 | if (err != NO_ERROR) { | 
|  | 623 | return err; | 
|  | 624 | } | 
|  | 625 |  | 
|  | 626 | err = remote()->transact(BnSurfaceComposer::GET_LAYER_DEBUG_INFO, data, &reply); | 
|  | 627 | if (err != NO_ERROR) { | 
|  | 628 | return err; | 
|  | 629 | } | 
|  | 630 |  | 
|  | 631 | int32_t result = 0; | 
|  | 632 | err = reply.readInt32(&result); | 
|  | 633 | if (err != NO_ERROR) { | 
|  | 634 | return err; | 
|  | 635 | } | 
|  | 636 | if (result != NO_ERROR) { | 
|  | 637 | return result; | 
|  | 638 | } | 
|  | 639 |  | 
|  | 640 | outLayers->clear(); | 
|  | 641 | return reply.readParcelableVector(outLayers); | 
|  | 642 | } | 
| Peiyong Lin | 0256f72 | 2018-08-31 15:45:10 -0700 | [diff] [blame] | 643 |  | 
| Peiyong Lin | c678097 | 2018-10-28 15:24:08 -0700 | [diff] [blame] | 644 | virtual status_t getCompositionPreference(ui::Dataspace* defaultDataspace, | 
|  | 645 | ui::PixelFormat* defaultPixelFormat, | 
|  | 646 | ui::Dataspace* wideColorGamutDataspace, | 
|  | 647 | ui::PixelFormat* wideColorGamutPixelFormat) const { | 
| Peiyong Lin | 0256f72 | 2018-08-31 15:45:10 -0700 | [diff] [blame] | 648 | Parcel data, reply; | 
|  | 649 | status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 650 | if (error != NO_ERROR) { | 
|  | 651 | return error; | 
|  | 652 | } | 
|  | 653 | error = remote()->transact(BnSurfaceComposer::GET_COMPOSITION_PREFERENCE, data, &reply); | 
|  | 654 | if (error != NO_ERROR) { | 
|  | 655 | return error; | 
|  | 656 | } | 
|  | 657 | error = static_cast<status_t>(reply.readInt32()); | 
|  | 658 | if (error == NO_ERROR) { | 
| Peiyong Lin | c678097 | 2018-10-28 15:24:08 -0700 | [diff] [blame] | 659 | *defaultDataspace = static_cast<ui::Dataspace>(reply.readInt32()); | 
|  | 660 | *defaultPixelFormat = static_cast<ui::PixelFormat>(reply.readInt32()); | 
|  | 661 | *wideColorGamutDataspace = static_cast<ui::Dataspace>(reply.readInt32()); | 
|  | 662 | *wideColorGamutPixelFormat = static_cast<ui::PixelFormat>(reply.readInt32()); | 
| Peiyong Lin | 0256f72 | 2018-08-31 15:45:10 -0700 | [diff] [blame] | 663 | } | 
|  | 664 | return error; | 
|  | 665 | } | 
| Ady Abraham | 2a6ab2a | 2018-10-26 14:25:30 -0700 | [diff] [blame] | 666 |  | 
| Ady Abraham | 37965d4 | 2018-11-01 13:43:32 -0700 | [diff] [blame] | 667 | virtual status_t getColorManagement(bool* outGetColorManagement) const { | 
| Ady Abraham | 2a6ab2a | 2018-10-26 14:25:30 -0700 | [diff] [blame] | 668 | Parcel data, reply; | 
|  | 669 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
| Ady Abraham | 37965d4 | 2018-11-01 13:43:32 -0700 | [diff] [blame] | 670 | remote()->transact(BnSurfaceComposer::GET_COLOR_MANAGEMENT, data, &reply); | 
|  | 671 | bool result; | 
|  | 672 | status_t err = reply.readBool(&result); | 
|  | 673 | if (err == NO_ERROR) { | 
|  | 674 | *outGetColorManagement = result; | 
| Ady Abraham | 2a6ab2a | 2018-10-26 14:25:30 -0700 | [diff] [blame] | 675 | } | 
| Ady Abraham | 37965d4 | 2018-11-01 13:43:32 -0700 | [diff] [blame] | 676 | return err; | 
| Ady Abraham | 2a6ab2a | 2018-10-26 14:25:30 -0700 | [diff] [blame] | 677 | } | 
| Kevin DuBois | 9c0a176 | 2018-10-16 13:32:31 -0700 | [diff] [blame] | 678 |  | 
|  | 679 | virtual status_t getDisplayedContentSamplingAttributes(const sp<IBinder>& display, | 
|  | 680 | ui::PixelFormat* outFormat, | 
|  | 681 | ui::Dataspace* outDataspace, | 
|  | 682 | uint8_t* outComponentMask) const { | 
|  | 683 | if (!outFormat || !outDataspace || !outComponentMask) return BAD_VALUE; | 
|  | 684 | Parcel data, reply; | 
|  | 685 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 686 | data.writeStrongBinder(display); | 
|  | 687 |  | 
|  | 688 | status_t error = | 
|  | 689 | remote()->transact(BnSurfaceComposer::GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES, | 
|  | 690 | data, &reply); | 
|  | 691 | if (error != NO_ERROR) { | 
|  | 692 | return error; | 
|  | 693 | } | 
|  | 694 |  | 
|  | 695 | uint32_t value = 0; | 
|  | 696 | error = reply.readUint32(&value); | 
|  | 697 | if (error != NO_ERROR) { | 
|  | 698 | return error; | 
|  | 699 | } | 
|  | 700 | *outFormat = static_cast<ui::PixelFormat>(value); | 
|  | 701 |  | 
|  | 702 | error = reply.readUint32(&value); | 
|  | 703 | if (error != NO_ERROR) { | 
|  | 704 | return error; | 
|  | 705 | } | 
|  | 706 | *outDataspace = static_cast<ui::Dataspace>(value); | 
|  | 707 |  | 
|  | 708 | error = reply.readUint32(&value); | 
|  | 709 | if (error != NO_ERROR) { | 
|  | 710 | return error; | 
|  | 711 | } | 
|  | 712 | *outComponentMask = static_cast<uint8_t>(value); | 
|  | 713 | return error; | 
|  | 714 | } | 
| Kevin DuBois | 74e5377 | 2018-11-19 10:52:38 -0800 | [diff] [blame] | 715 |  | 
|  | 716 | virtual status_t setDisplayContentSamplingEnabled(const sp<IBinder>& display, bool enable, | 
|  | 717 | uint8_t componentMask, | 
|  | 718 | uint64_t maxFrames) const { | 
|  | 719 | Parcel data, reply; | 
|  | 720 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 721 | data.writeStrongBinder(display); | 
|  | 722 | data.writeBool(enable); | 
|  | 723 | data.writeByte(static_cast<int8_t>(componentMask)); | 
|  | 724 | data.writeUint64(maxFrames); | 
|  | 725 | status_t result = | 
|  | 726 | remote()->transact(BnSurfaceComposer::SET_DISPLAY_CONTENT_SAMPLING_ENABLED, data, | 
|  | 727 | &reply); | 
|  | 728 | return result; | 
|  | 729 | } | 
| Kevin DuBois | 1d4249a | 2018-08-29 10:45:14 -0700 | [diff] [blame] | 730 |  | 
|  | 731 | virtual status_t getDisplayedContentSample(const sp<IBinder>& display, uint64_t maxFrames, | 
|  | 732 | uint64_t timestamp, | 
|  | 733 | DisplayedFrameStats* outStats) const { | 
|  | 734 | if (!outStats) return BAD_VALUE; | 
|  | 735 |  | 
|  | 736 | Parcel data, reply; | 
|  | 737 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 738 | data.writeStrongBinder(display); | 
|  | 739 | data.writeUint64(maxFrames); | 
|  | 740 | data.writeUint64(timestamp); | 
|  | 741 |  | 
|  | 742 | status_t result = | 
|  | 743 | remote()->transact(BnSurfaceComposer::GET_DISPLAYED_CONTENT_SAMPLE, data, &reply); | 
|  | 744 |  | 
|  | 745 | if (result != NO_ERROR) { | 
|  | 746 | return result; | 
|  | 747 | } | 
|  | 748 |  | 
|  | 749 | result = reply.readUint64(&outStats->numFrames); | 
|  | 750 | if (result != NO_ERROR) { | 
|  | 751 | return result; | 
|  | 752 | } | 
|  | 753 |  | 
| Kevin DuBois | 1d4c6a6 | 2018-12-12 13:59:46 -0800 | [diff] [blame] | 754 | result = reply.readUint64Vector(&outStats->component_0_sample); | 
| Kevin DuBois | 1d4249a | 2018-08-29 10:45:14 -0700 | [diff] [blame] | 755 | if (result != NO_ERROR) { | 
|  | 756 | return result; | 
|  | 757 | } | 
| Kevin DuBois | 1d4c6a6 | 2018-12-12 13:59:46 -0800 | [diff] [blame] | 758 | result = reply.readUint64Vector(&outStats->component_1_sample); | 
| Kevin DuBois | 1d4249a | 2018-08-29 10:45:14 -0700 | [diff] [blame] | 759 | if (result != NO_ERROR) { | 
|  | 760 | return result; | 
|  | 761 | } | 
| Kevin DuBois | 1d4c6a6 | 2018-12-12 13:59:46 -0800 | [diff] [blame] | 762 | result = reply.readUint64Vector(&outStats->component_2_sample); | 
| Kevin DuBois | 1d4249a | 2018-08-29 10:45:14 -0700 | [diff] [blame] | 763 | if (result != NO_ERROR) { | 
|  | 764 | return result; | 
|  | 765 | } | 
| Kevin DuBois | 1d4c6a6 | 2018-12-12 13:59:46 -0800 | [diff] [blame] | 766 | result = reply.readUint64Vector(&outStats->component_3_sample); | 
| Kevin DuBois | 1d4249a | 2018-08-29 10:45:14 -0700 | [diff] [blame] | 767 | return result; | 
|  | 768 | } | 
| Peiyong Lin | 3c2791e | 2019-01-14 17:05:18 -0800 | [diff] [blame] | 769 |  | 
|  | 770 | virtual status_t getProtectedContentSupport(bool* outSupported) const { | 
|  | 771 | Parcel data, reply; | 
|  | 772 | data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
| Peiyong Lin | b6888fa | 2019-01-28 13:20:58 -0800 | [diff] [blame] | 773 | status_t error = | 
|  | 774 | remote()->transact(BnSurfaceComposer::GET_PROTECTED_CONTENT_SUPPORT, data, &reply); | 
|  | 775 | if (error != NO_ERROR) { | 
|  | 776 | return error; | 
| Peiyong Lin | 3c2791e | 2019-01-14 17:05:18 -0800 | [diff] [blame] | 777 | } | 
| Peiyong Lin | b6888fa | 2019-01-28 13:20:58 -0800 | [diff] [blame] | 778 | error = reply.readBool(outSupported); | 
|  | 779 | return error; | 
| Peiyong Lin | 3c2791e | 2019-01-14 17:05:18 -0800 | [diff] [blame] | 780 | } | 
| Marissa Wall | ebc2c05 | 2019-01-16 19:16:55 -0800 | [diff] [blame] | 781 |  | 
| Peiyong Lin | 4f3fddf | 2019-01-24 17:21:24 -0800 | [diff] [blame] | 782 | virtual status_t isWideColorDisplay(const sp<IBinder>& token, | 
|  | 783 | bool* outIsWideColorDisplay) const { | 
|  | 784 | Parcel data, reply; | 
|  | 785 | status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 786 | if (error != NO_ERROR) { | 
|  | 787 | return error; | 
|  | 788 | } | 
|  | 789 | error = data.writeStrongBinder(token); | 
|  | 790 | if (error != NO_ERROR) { | 
|  | 791 | return error; | 
|  | 792 | } | 
|  | 793 |  | 
|  | 794 | error = remote()->transact(BnSurfaceComposer::IS_WIDE_COLOR_DISPLAY, data, &reply); | 
|  | 795 | if (error != NO_ERROR) { | 
|  | 796 | return error; | 
|  | 797 | } | 
|  | 798 | error = reply.readBool(outIsWideColorDisplay); | 
|  | 799 | return error; | 
|  | 800 | } | 
| Dan Stoza | 84ab937 | 2018-12-17 15:27:57 -0800 | [diff] [blame] | 801 |  | 
|  | 802 | virtual status_t addRegionSamplingListener(const Rect& samplingArea, | 
|  | 803 | const sp<IBinder>& stopLayerHandle, | 
|  | 804 | const sp<IRegionSamplingListener>& listener) { | 
|  | 805 | Parcel data, reply; | 
|  | 806 | status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 807 | if (error != NO_ERROR) { | 
|  | 808 | ALOGE("addRegionSamplingListener: Failed to write interface token"); | 
|  | 809 | return error; | 
|  | 810 | } | 
|  | 811 | error = data.write(samplingArea); | 
|  | 812 | if (error != NO_ERROR) { | 
|  | 813 | ALOGE("addRegionSamplingListener: Failed to write sampling area"); | 
|  | 814 | return error; | 
|  | 815 | } | 
|  | 816 | error = data.writeStrongBinder(stopLayerHandle); | 
|  | 817 | if (error != NO_ERROR) { | 
|  | 818 | ALOGE("addRegionSamplingListener: Failed to write stop layer handle"); | 
|  | 819 | return error; | 
|  | 820 | } | 
|  | 821 | error = data.writeStrongBinder(IInterface::asBinder(listener)); | 
|  | 822 | if (error != NO_ERROR) { | 
|  | 823 | ALOGE("addRegionSamplingListener: Failed to write listener"); | 
|  | 824 | return error; | 
|  | 825 | } | 
|  | 826 | error = remote()->transact(BnSurfaceComposer::ADD_REGION_SAMPLING_LISTENER, data, &reply); | 
|  | 827 | if (error != NO_ERROR) { | 
|  | 828 | ALOGE("addRegionSamplingListener: Failed to transact"); | 
|  | 829 | } | 
|  | 830 | return error; | 
|  | 831 | } | 
|  | 832 |  | 
|  | 833 | virtual status_t removeRegionSamplingListener(const sp<IRegionSamplingListener>& listener) { | 
|  | 834 | Parcel data, reply; | 
|  | 835 | status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 836 | if (error != NO_ERROR) { | 
| tangrobin | af45f01 | 2019-02-26 18:10:10 +0800 | [diff] [blame] | 837 | ALOGE("removeRegionSamplingListener: Failed to write interface token"); | 
| Dan Stoza | 84ab937 | 2018-12-17 15:27:57 -0800 | [diff] [blame] | 838 | return error; | 
|  | 839 | } | 
|  | 840 | error = data.writeStrongBinder(IInterface::asBinder(listener)); | 
|  | 841 | if (error != NO_ERROR) { | 
| tangrobin | af45f01 | 2019-02-26 18:10:10 +0800 | [diff] [blame] | 842 | ALOGE("removeRegionSamplingListener: Failed to write listener"); | 
| Dan Stoza | 84ab937 | 2018-12-17 15:27:57 -0800 | [diff] [blame] | 843 | return error; | 
|  | 844 | } | 
|  | 845 | error = remote()->transact(BnSurfaceComposer::REMOVE_REGION_SAMPLING_LISTENER, data, | 
|  | 846 | &reply); | 
|  | 847 | if (error != NO_ERROR) { | 
| tangrobin | af45f01 | 2019-02-26 18:10:10 +0800 | [diff] [blame] | 848 | ALOGE("removeRegionSamplingListener: Failed to transact"); | 
| Dan Stoza | 84ab937 | 2018-12-17 15:27:57 -0800 | [diff] [blame] | 849 | } | 
|  | 850 | return error; | 
|  | 851 | } | 
| Ady Abraham | 838de06 | 2019-02-04 10:24:03 -0800 | [diff] [blame] | 852 |  | 
|  | 853 | virtual status_t setAllowedDisplayConfigs(const sp<IBinder>& displayToken, | 
|  | 854 | const std::vector<int32_t>& allowedConfigs) { | 
|  | 855 | Parcel data, reply; | 
|  | 856 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 857 | if (result != NO_ERROR) { | 
|  | 858 | ALOGE("setAllowedDisplayConfigs failed to writeInterfaceToken: %d", result); | 
|  | 859 | return result; | 
|  | 860 | } | 
|  | 861 | result = data.writeStrongBinder(displayToken); | 
|  | 862 | if (result != NO_ERROR) { | 
|  | 863 | ALOGE("setAllowedDisplayConfigs failed to writeStrongBinder: %d", result); | 
|  | 864 | return result; | 
|  | 865 | } | 
|  | 866 | result = data.writeInt32Vector(allowedConfigs); | 
|  | 867 | if (result != NO_ERROR) { | 
|  | 868 | ALOGE("setAllowedDisplayConfigs failed to writeInt32Vector: %d", result); | 
|  | 869 | return result; | 
|  | 870 | } | 
|  | 871 | result = remote()->transact(BnSurfaceComposer::SET_ALLOWED_DISPLAY_CONFIGS, data, &reply); | 
|  | 872 | if (result != NO_ERROR) { | 
|  | 873 | ALOGE("setAllowedDisplayConfigs failed to transact: %d", result); | 
|  | 874 | return result; | 
|  | 875 | } | 
|  | 876 | return reply.readInt32(); | 
|  | 877 | } | 
| Ady Abraham | d9b3ea6 | 2019-02-26 14:08:03 -0800 | [diff] [blame] | 878 |  | 
|  | 879 | virtual status_t getAllowedDisplayConfigs(const sp<IBinder>& displayToken, | 
|  | 880 | std::vector<int32_t>* outAllowedConfigs) { | 
|  | 881 | if (!outAllowedConfigs) return BAD_VALUE; | 
|  | 882 | Parcel data, reply; | 
|  | 883 | status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 884 | if (result != NO_ERROR) { | 
|  | 885 | ALOGE("getAllowedDisplayConfigs failed to writeInterfaceToken: %d", result); | 
|  | 886 | return result; | 
|  | 887 | } | 
|  | 888 | result = data.writeStrongBinder(displayToken); | 
|  | 889 | if (result != NO_ERROR) { | 
|  | 890 | ALOGE("getAllowedDisplayConfigs failed to writeStrongBinder: %d", result); | 
|  | 891 | return result; | 
|  | 892 | } | 
|  | 893 | result = remote()->transact(BnSurfaceComposer::GET_ALLOWED_DISPLAY_CONFIGS, data, &reply); | 
|  | 894 | if (result != NO_ERROR) { | 
|  | 895 | ALOGE("getAllowedDisplayConfigs failed to transact: %d", result); | 
|  | 896 | return result; | 
|  | 897 | } | 
|  | 898 | result = reply.readInt32Vector(outAllowedConfigs); | 
|  | 899 | if (result != NO_ERROR) { | 
|  | 900 | ALOGE("getAllowedDisplayConfigs failed to readInt32Vector: %d", result); | 
|  | 901 | return result; | 
|  | 902 | } | 
|  | 903 | return reply.readInt32(); | 
|  | 904 | } | 
| Dan Gittik | 57e63c5 | 2019-01-18 16:37:54 +0000 | [diff] [blame] | 905 |  | 
|  | 906 | virtual status_t getDisplayBrightnessSupport(const sp<IBinder>& displayToken, | 
|  | 907 | bool* outSupport) const { | 
|  | 908 | Parcel data, reply; | 
|  | 909 | status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 910 | if (error != NO_ERROR) { | 
|  | 911 | ALOGE("getDisplayBrightnessSupport: failed to write interface token: %d", error); | 
|  | 912 | return error; | 
|  | 913 | } | 
|  | 914 | error = data.writeStrongBinder(displayToken); | 
|  | 915 | if (error != NO_ERROR) { | 
|  | 916 | ALOGE("getDisplayBrightnessSupport: failed to write display token: %d", error); | 
|  | 917 | return error; | 
|  | 918 | } | 
|  | 919 | error = remote()->transact(BnSurfaceComposer::GET_DISPLAY_BRIGHTNESS_SUPPORT, data, &reply); | 
|  | 920 | if (error != NO_ERROR) { | 
|  | 921 | ALOGE("getDisplayBrightnessSupport: failed to transact: %d", error); | 
|  | 922 | return error; | 
|  | 923 | } | 
|  | 924 | bool support; | 
|  | 925 | error = reply.readBool(&support); | 
|  | 926 | if (error != NO_ERROR) { | 
|  | 927 | ALOGE("getDisplayBrightnessSupport: failed to read support: %d", error); | 
|  | 928 | return error; | 
|  | 929 | } | 
|  | 930 | *outSupport = support; | 
|  | 931 | return NO_ERROR; | 
|  | 932 | } | 
|  | 933 |  | 
|  | 934 | virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness) const { | 
|  | 935 | Parcel data, reply; | 
|  | 936 | status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 937 | if (error != NO_ERROR) { | 
|  | 938 | ALOGE("setDisplayBrightness: failed to write interface token: %d", error); | 
|  | 939 | return error; | 
|  | 940 | } | 
|  | 941 | error = data.writeStrongBinder(displayToken); | 
|  | 942 | if (error != NO_ERROR) { | 
|  | 943 | ALOGE("setDisplayBrightness: failed to write display token: %d", error); | 
|  | 944 | return error; | 
|  | 945 | } | 
|  | 946 | error = data.writeFloat(brightness); | 
|  | 947 | if (error != NO_ERROR) { | 
|  | 948 | ALOGE("setDisplayBrightness: failed to write brightness: %d", error); | 
|  | 949 | return error; | 
|  | 950 | } | 
|  | 951 | error = remote()->transact(BnSurfaceComposer::SET_DISPLAY_BRIGHTNESS, data, &reply); | 
|  | 952 | if (error != NO_ERROR) { | 
|  | 953 | ALOGE("setDisplayBrightness: failed to transact: %d", error); | 
|  | 954 | return error; | 
|  | 955 | } | 
|  | 956 | return NO_ERROR; | 
|  | 957 | } | 
| Ady Abraham | 8532d01 | 2019-05-08 14:50:56 -0700 | [diff] [blame] | 958 |  | 
|  | 959 | virtual status_t notifyPowerHint(int32_t hintId) { | 
|  | 960 | Parcel data, reply; | 
|  | 961 | status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); | 
|  | 962 | if (error != NO_ERROR) { | 
|  | 963 | ALOGE("notifyPowerHint: failed to write interface token: %d", error); | 
|  | 964 | return error; | 
|  | 965 | } | 
|  | 966 | error = data.writeInt32(hintId); | 
|  | 967 | if (error != NO_ERROR) { | 
|  | 968 | ALOGE("notifyPowerHint: failed to write hintId: %d", error); | 
|  | 969 | return error; | 
|  | 970 | } | 
|  | 971 | error = remote()->transact(BnSurfaceComposer::NOTIFY_POWER_HINT, data, &reply, | 
|  | 972 | IBinder::FLAG_ONEWAY); | 
|  | 973 | if (error != NO_ERROR) { | 
|  | 974 | ALOGE("notifyPowerHint: failed to transact: %d", error); | 
|  | 975 | return error; | 
|  | 976 | } | 
|  | 977 | return NO_ERROR; | 
|  | 978 | } | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 979 | }; | 
|  | 980 |  | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 981 | // Out-of-line virtual method definition to trigger vtable emission in this | 
|  | 982 | // translation unit (see clang warning -Wweak-vtables) | 
|  | 983 | BpSurfaceComposer::~BpSurfaceComposer() {} | 
|  | 984 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 985 | IMPLEMENT_META_INTERFACE(SurfaceComposer, "android.ui.ISurfaceComposer"); | 
|  | 986 |  | 
|  | 987 | // ---------------------------------------------------------------------- | 
|  | 988 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 989 | status_t BnSurfaceComposer::onTransact( | 
|  | 990 | uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) | 
|  | 991 | { | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 992 | switch(code) { | 
|  | 993 | case CREATE_CONNECTION: { | 
| Mathias Agopian | 83c0446 | 2009-05-22 19:00:22 -0700 | [diff] [blame] | 994 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Marco Nelissen | 2ea926b | 2014-11-14 08:01:01 -0800 | [diff] [blame] | 995 | sp<IBinder> b = IInterface::asBinder(createConnection()); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 996 | reply->writeStrongBinder(b); | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 997 | return NO_ERROR; | 
|  | 998 | } | 
| Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 999 | case SET_TRANSACTION_STATE: { | 
| Mathias Agopian | 83c0446 | 2009-05-22 19:00:22 -0700 | [diff] [blame] | 1000 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 1001 |  | 
|  | 1002 | size_t count = data.readUint32(); | 
| Michael Lentine | 8afa1c4 | 2014-10-31 11:10:13 -0700 | [diff] [blame] | 1003 | if (count > data.dataSize()) { | 
|  | 1004 | return BAD_VALUE; | 
|  | 1005 | } | 
| Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 1006 | Vector<ComposerState> state; | 
|  | 1007 | state.setCapacity(count); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 1008 | for (size_t i = 0; i < count; i++) { | 
| Marissa Wall | c837b5e | 2018-10-12 10:04:44 -0700 | [diff] [blame] | 1009 | ComposerState s; | 
| Michael Lentine | 8afa1c4 | 2014-10-31 11:10:13 -0700 | [diff] [blame] | 1010 | if (s.read(data) == BAD_VALUE) { | 
|  | 1011 | return BAD_VALUE; | 
|  | 1012 | } | 
| Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 1013 | state.add(s); | 
|  | 1014 | } | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 1015 |  | 
|  | 1016 | count = data.readUint32(); | 
| Michael Lentine | 8afa1c4 | 2014-10-31 11:10:13 -0700 | [diff] [blame] | 1017 | if (count > data.dataSize()) { | 
|  | 1018 | return BAD_VALUE; | 
|  | 1019 | } | 
| Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 1020 | DisplayState d; | 
|  | 1021 | Vector<DisplayState> displays; | 
|  | 1022 | displays.setCapacity(count); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 1023 | for (size_t i = 0; i < count; i++) { | 
| Michael Lentine | 8afa1c4 | 2014-10-31 11:10:13 -0700 | [diff] [blame] | 1024 | if (d.read(data) == BAD_VALUE) { | 
|  | 1025 | return BAD_VALUE; | 
|  | 1026 | } | 
| Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 1027 | displays.add(d); | 
|  | 1028 | } | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 1029 |  | 
|  | 1030 | uint32_t stateFlags = data.readUint32(); | 
| Marissa Wall | 713b63f | 2018-10-17 15:42:43 -0700 | [diff] [blame] | 1031 | sp<IBinder> applyToken = data.readStrongBinder(); | 
| chaviw | 273171b | 2018-12-26 11:46:30 -0800 | [diff] [blame] | 1032 | InputWindowCommands inputWindowCommands; | 
|  | 1033 | inputWindowCommands.read(data); | 
| Marissa Wall | 17b4e45 | 2018-12-26 16:32:34 -0800 | [diff] [blame] | 1034 |  | 
|  | 1035 | int64_t desiredPresentTime = data.readInt64(); | 
| Marissa Wall | 78b7220 | 2019-03-15 14:58:34 -0700 | [diff] [blame] | 1036 |  | 
| Marissa Wall | 947d34e | 2019-03-29 14:03:53 -0700 | [diff] [blame] | 1037 | client_cache_t uncachedBuffer; | 
|  | 1038 | uncachedBuffer.token = data.readWeakBinder(); | 
|  | 1039 | uncachedBuffer.id = data.readUint64(); | 
| Marissa Wall | 78b7220 | 2019-03-15 14:58:34 -0700 | [diff] [blame] | 1040 |  | 
| Marissa Wall | 3dad52d | 2019-03-22 14:03:19 -0700 | [diff] [blame] | 1041 | std::vector<ListenerCallbacks> listenerCallbacks; | 
|  | 1042 | int32_t listenersSize = data.readInt32(); | 
|  | 1043 | for (int32_t i = 0; i < listenersSize; i++) { | 
|  | 1044 | auto listener = | 
|  | 1045 | interface_cast<ITransactionCompletedListener>(data.readStrongBinder()); | 
|  | 1046 | std::vector<CallbackId> callbackIds; | 
|  | 1047 | data.readInt64Vector(&callbackIds); | 
|  | 1048 | listenerCallbacks.emplace_back(listener, callbackIds); | 
|  | 1049 | } | 
|  | 1050 |  | 
| Marissa Wall | 17b4e45 | 2018-12-26 16:32:34 -0800 | [diff] [blame] | 1051 | setTransactionState(state, displays, stateFlags, applyToken, inputWindowCommands, | 
| Marissa Wall | 3dad52d | 2019-03-22 14:03:19 -0700 | [diff] [blame] | 1052 | desiredPresentTime, uncachedBuffer, listenerCallbacks); | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 1053 | return NO_ERROR; | 
|  | 1054 | } | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1055 | case BOOT_FINISHED: { | 
| Mathias Agopian | 83c0446 | 2009-05-22 19:00:22 -0700 | [diff] [blame] | 1056 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1057 | bootFinished(); | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 1058 | return NO_ERROR; | 
|  | 1059 | } | 
| Mathias Agopian | 2a9fc49 | 2013-03-01 13:42:57 -0800 | [diff] [blame] | 1060 | case CAPTURE_SCREEN: { | 
|  | 1061 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1062 | sp<IBinder> display = data.readStrongBinder(); | 
| Peiyong Lin | 0e003c9 | 2018-09-17 11:09:51 -0700 | [diff] [blame] | 1063 | ui::Dataspace reqDataspace = static_cast<ui::Dataspace>(data.readInt32()); | 
|  | 1064 | ui::PixelFormat reqPixelFormat = static_cast<ui::PixelFormat>(data.readInt32()); | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 1065 | sp<GraphicBuffer> outBuffer; | 
| Pablo Ceballos | 60d6922 | 2015-08-07 14:47:20 -0700 | [diff] [blame] | 1066 | Rect sourceCrop(Rect::EMPTY_RECT); | 
| Dan Stoza | c187900 | 2014-05-22 15:59:05 -0700 | [diff] [blame] | 1067 | data.read(sourceCrop); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 1068 | uint32_t reqWidth = data.readUint32(); | 
|  | 1069 | uint32_t reqHeight = data.readUint32(); | 
| Dan Stoza | c701401 | 2014-02-14 15:03:43 -0800 | [diff] [blame] | 1070 | bool useIdentityTransform = static_cast<bool>(data.readInt32()); | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 1071 | int32_t rotation = data.readInt32(); | 
| Robert Carr | fa8855f | 2019-02-19 10:05:00 -0800 | [diff] [blame] | 1072 | bool captureSecureLayers = static_cast<bool>(data.readInt32()); | 
| Dan Stoza | c701401 | 2014-02-14 15:03:43 -0800 | [diff] [blame] | 1073 |  | 
| Robert Carr | 108b2c7 | 2019-04-02 16:32:58 -0700 | [diff] [blame] | 1074 | bool capturedSecureLayers = false; | 
|  | 1075 | status_t res = captureScreen(display, &outBuffer, capturedSecureLayers, reqDataspace, | 
|  | 1076 | reqPixelFormat, sourceCrop, reqWidth, reqHeight, | 
|  | 1077 | useIdentityTransform, | 
|  | 1078 | static_cast<ISurfaceComposer::Rotation>(rotation), | 
|  | 1079 | captureSecureLayers); | 
|  | 1080 |  | 
| Mathias Agopian | 2a9fc49 | 2013-03-01 13:42:57 -0800 | [diff] [blame] | 1081 | reply->writeInt32(res); | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 1082 | if (res == NO_ERROR) { | 
|  | 1083 | reply->write(*outBuffer); | 
| Robert Carr | 108b2c7 | 2019-04-02 16:32:58 -0700 | [diff] [blame] | 1084 | reply->writeBool(capturedSecureLayers); | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 1085 | } | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 1086 | return NO_ERROR; | 
|  | 1087 | } | 
| chaviw | 93df2ea | 2019-04-30 16:45:12 -0700 | [diff] [blame] | 1088 | case CAPTURE_SCREEN_BY_ID: { | 
|  | 1089 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1090 | uint64_t displayOrLayerStack = data.readUint64(); | 
|  | 1091 | ui::Dataspace outDataspace = ui::Dataspace::V0_SRGB; | 
|  | 1092 | sp<GraphicBuffer> outBuffer; | 
|  | 1093 | status_t res = captureScreen(displayOrLayerStack, &outDataspace, &outBuffer); | 
|  | 1094 | reply->writeInt32(res); | 
|  | 1095 | if (res == NO_ERROR) { | 
|  | 1096 | reply->writeInt32(static_cast<int32_t>(outDataspace)); | 
|  | 1097 | reply->write(*outBuffer); | 
|  | 1098 | } | 
|  | 1099 | return NO_ERROR; | 
|  | 1100 | } | 
| chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 1101 | case CAPTURE_LAYERS: { | 
|  | 1102 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1103 | sp<IBinder> layerHandleBinder = data.readStrongBinder(); | 
| Peiyong Lin | 0e003c9 | 2018-09-17 11:09:51 -0700 | [diff] [blame] | 1104 | ui::Dataspace reqDataspace = static_cast<ui::Dataspace>(data.readInt32()); | 
|  | 1105 | ui::PixelFormat reqPixelFormat = static_cast<ui::PixelFormat>(data.readInt32()); | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 1106 | sp<GraphicBuffer> outBuffer; | 
| chaviw | 7206d49 | 2017-11-10 16:16:12 -0800 | [diff] [blame] | 1107 | Rect sourceCrop(Rect::EMPTY_RECT); | 
|  | 1108 | data.read(sourceCrop); | 
| Robert Carr | 866455f | 2019-04-02 16:28:26 -0700 | [diff] [blame] | 1109 |  | 
|  | 1110 | std::unordered_set<sp<IBinder>, SpHash<IBinder>> excludeHandles; | 
|  | 1111 | int numExcludeHandles = data.readInt32(); | 
|  | 1112 | excludeHandles.reserve(numExcludeHandles); | 
|  | 1113 | for (int i = 0; i < numExcludeHandles; i++) { | 
|  | 1114 | excludeHandles.emplace(data.readStrongBinder()); | 
|  | 1115 | } | 
|  | 1116 |  | 
| chaviw | 7206d49 | 2017-11-10 16:16:12 -0800 | [diff] [blame] | 1117 | float frameScale = data.readFloat(); | 
| Robert Carr | 578038f | 2018-03-09 12:25:24 -0800 | [diff] [blame] | 1118 | bool childrenOnly = data.readBool(); | 
| chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 1119 |  | 
| Robert Carr | 866455f | 2019-04-02 16:28:26 -0700 | [diff] [blame] | 1120 | status_t res = | 
|  | 1121 | captureLayers(layerHandleBinder, &outBuffer, reqDataspace, reqPixelFormat, | 
|  | 1122 | sourceCrop, excludeHandles, frameScale, childrenOnly); | 
| chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 1123 | reply->writeInt32(res); | 
| Chavi Weingarten | 40482ff | 2017-11-30 01:51:40 +0000 | [diff] [blame] | 1124 | if (res == NO_ERROR) { | 
|  | 1125 | reply->write(*outBuffer); | 
|  | 1126 | } | 
| chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 1127 | return NO_ERROR; | 
|  | 1128 | } | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 1129 | case AUTHENTICATE_SURFACE: { | 
|  | 1130 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 1131 | sp<IGraphicBufferProducer> bufferProducer = | 
|  | 1132 | interface_cast<IGraphicBufferProducer>(data.readStrongBinder()); | 
|  | 1133 | int32_t result = authenticateSurfaceTexture(bufferProducer) ? 1 : 0; | 
| Jamie Gennis | 134f042 | 2011-03-08 12:18:54 -0800 | [diff] [blame] | 1134 | reply->writeInt32(result); | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 1135 | return NO_ERROR; | 
|  | 1136 | } | 
| Brian Anderson | 6b37671 | 2017-04-04 10:51:39 -0700 | [diff] [blame] | 1137 | case GET_SUPPORTED_FRAME_TIMESTAMPS: { | 
|  | 1138 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1139 | std::vector<FrameEvent> supportedTimestamps; | 
|  | 1140 | status_t result = getSupportedFrameTimestamps(&supportedTimestamps); | 
|  | 1141 | status_t err = reply->writeInt32(result); | 
|  | 1142 | if (err != NO_ERROR) { | 
|  | 1143 | return err; | 
|  | 1144 | } | 
|  | 1145 | if (result != NO_ERROR) { | 
|  | 1146 | return result; | 
|  | 1147 | } | 
|  | 1148 |  | 
|  | 1149 | std::vector<int32_t> supported; | 
|  | 1150 | supported.reserve(supportedTimestamps.size()); | 
|  | 1151 | for (FrameEvent s : supportedTimestamps) { | 
|  | 1152 | supported.push_back(static_cast<int32_t>(s)); | 
|  | 1153 | } | 
|  | 1154 | return reply->writeInt32Vector(supported); | 
|  | 1155 | } | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 1156 | case CREATE_DISPLAY_EVENT_CONNECTION: { | 
|  | 1157 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Jorim Jaggi | b1e2f8d | 2017-06-08 15:43:59 -0700 | [diff] [blame] | 1158 | sp<IDisplayEventConnection> connection(createDisplayEventConnection( | 
|  | 1159 | static_cast<ISurfaceComposer::VsyncSource>(data.readInt32()))); | 
| Marco Nelissen | 2ea926b | 2014-11-14 08:01:01 -0800 | [diff] [blame] | 1160 | reply->writeStrongBinder(IInterface::asBinder(connection)); | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 1161 | return NO_ERROR; | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 1162 | } | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 1163 | case CREATE_DISPLAY: { | 
|  | 1164 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Andy McFadden | 8dfa92f | 2012-09-17 18:27:17 -0700 | [diff] [blame] | 1165 | String8 displayName = data.readString8(); | 
| Jamie Gennis | dd3cb84 | 2012-10-19 18:19:11 -0700 | [diff] [blame] | 1166 | bool secure = bool(data.readInt32()); | 
|  | 1167 | sp<IBinder> display(createDisplay(displayName, secure)); | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 1168 | reply->writeStrongBinder(display); | 
|  | 1169 | return NO_ERROR; | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 1170 | } | 
|  | 1171 | case DESTROY_DISPLAY: { | 
|  | 1172 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1173 | sp<IBinder> display = data.readStrongBinder(); | 
|  | 1174 | destroyDisplay(display); | 
|  | 1175 | return NO_ERROR; | 
|  | 1176 | } | 
| Dominik Laskowski | dcb38bb | 2019-01-25 02:35:50 -0800 | [diff] [blame] | 1177 | case GET_PHYSICAL_DISPLAY_TOKEN: { | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 1178 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Dominik Laskowski | dcb38bb | 2019-01-25 02:35:50 -0800 | [diff] [blame] | 1179 | PhysicalDisplayId displayId = data.readUint64(); | 
|  | 1180 | sp<IBinder> display = getPhysicalDisplayToken(displayId); | 
| Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 1181 | reply->writeStrongBinder(display); | 
|  | 1182 | return NO_ERROR; | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 1183 | } | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 1184 | case GET_DISPLAY_CONFIGS: { | 
| Mathias Agopian | c666cae | 2012-07-25 18:56:13 -0700 | [diff] [blame] | 1185 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 1186 | Vector<DisplayInfo> configs; | 
| Jeff Brown | 9d4e3d2 | 2012-08-24 20:00:51 -0700 | [diff] [blame] | 1187 | sp<IBinder> display = data.readStrongBinder(); | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 1188 | status_t result = getDisplayConfigs(display, &configs); | 
|  | 1189 | reply->writeInt32(result); | 
|  | 1190 | if (result == NO_ERROR) { | 
| Dan Stoza | d723bd7 | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 1191 | reply->writeUint32(static_cast<uint32_t>(configs.size())); | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 1192 | for (size_t c = 0; c < configs.size(); ++c) { | 
|  | 1193 | memcpy(reply->writeInplace(sizeof(DisplayInfo)), | 
|  | 1194 | &configs[c], sizeof(DisplayInfo)); | 
|  | 1195 | } | 
|  | 1196 | } | 
|  | 1197 | return NO_ERROR; | 
|  | 1198 | } | 
| Lajos Molnar | 67d8bd6 | 2014-09-11 14:58:45 -0700 | [diff] [blame] | 1199 | case GET_DISPLAY_STATS: { | 
|  | 1200 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1201 | DisplayStatInfo stats; | 
|  | 1202 | sp<IBinder> display = data.readStrongBinder(); | 
|  | 1203 | status_t result = getDisplayStats(display, &stats); | 
|  | 1204 | reply->writeInt32(result); | 
|  | 1205 | if (result == NO_ERROR) { | 
|  | 1206 | memcpy(reply->writeInplace(sizeof(DisplayStatInfo)), | 
|  | 1207 | &stats, sizeof(DisplayStatInfo)); | 
|  | 1208 | } | 
|  | 1209 | return NO_ERROR; | 
|  | 1210 | } | 
| Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 1211 | case GET_ACTIVE_CONFIG: { | 
|  | 1212 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1213 | sp<IBinder> display = data.readStrongBinder(); | 
|  | 1214 | int id = getActiveConfig(display); | 
|  | 1215 | reply->writeInt32(id); | 
|  | 1216 | return NO_ERROR; | 
|  | 1217 | } | 
|  | 1218 | case SET_ACTIVE_CONFIG: { | 
|  | 1219 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1220 | sp<IBinder> display = data.readStrongBinder(); | 
|  | 1221 | int id = data.readInt32(); | 
|  | 1222 | status_t result = setActiveConfig(display, id); | 
| Mathias Agopian | c666cae | 2012-07-25 18:56:13 -0700 | [diff] [blame] | 1223 | reply->writeInt32(result); | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 1224 | return NO_ERROR; | 
|  | 1225 | } | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 1226 | case GET_DISPLAY_COLOR_MODES: { | 
|  | 1227 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 1228 | Vector<ColorMode> colorModes; | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 1229 | sp<IBinder> display = nullptr; | 
|  | 1230 | status_t result = data.readStrongBinder(&display); | 
|  | 1231 | if (result != NO_ERROR) { | 
|  | 1232 | ALOGE("getDisplayColorModes failed to readStrongBinder: %d", result); | 
|  | 1233 | return result; | 
|  | 1234 | } | 
|  | 1235 | result = getDisplayColorModes(display, &colorModes); | 
|  | 1236 | reply->writeInt32(result); | 
|  | 1237 | if (result == NO_ERROR) { | 
|  | 1238 | reply->writeUint32(static_cast<uint32_t>(colorModes.size())); | 
|  | 1239 | for (size_t i = 0; i < colorModes.size(); ++i) { | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 1240 | reply->writeInt32(static_cast<int32_t>(colorModes[i])); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 1241 | } | 
|  | 1242 | } | 
|  | 1243 | return NO_ERROR; | 
|  | 1244 | } | 
| Daniel Solomon | 42d0456 | 2019-01-20 21:03:19 -0800 | [diff] [blame] | 1245 | case GET_DISPLAY_NATIVE_PRIMARIES: { | 
|  | 1246 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1247 | ui::DisplayPrimaries primaries; | 
|  | 1248 | sp<IBinder> display = nullptr; | 
|  | 1249 |  | 
|  | 1250 | status_t result = data.readStrongBinder(&display); | 
|  | 1251 | if (result != NO_ERROR) { | 
|  | 1252 | ALOGE("getDisplayNativePrimaries failed to readStrongBinder: %d", result); | 
|  | 1253 | return result; | 
|  | 1254 | } | 
|  | 1255 |  | 
|  | 1256 | result = getDisplayNativePrimaries(display, primaries); | 
|  | 1257 | reply->writeInt32(result); | 
|  | 1258 | if (result == NO_ERROR) { | 
|  | 1259 | memcpy(reply->writeInplace(sizeof(ui::DisplayPrimaries)), &primaries, | 
|  | 1260 | sizeof(ui::DisplayPrimaries)); | 
|  | 1261 | } | 
|  | 1262 |  | 
|  | 1263 | return NO_ERROR; | 
|  | 1264 | } | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 1265 | case GET_ACTIVE_COLOR_MODE: { | 
|  | 1266 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1267 | sp<IBinder> display = nullptr; | 
|  | 1268 | status_t result = data.readStrongBinder(&display); | 
|  | 1269 | if (result != NO_ERROR) { | 
|  | 1270 | ALOGE("getActiveColorMode failed to readStrongBinder: %d", result); | 
|  | 1271 | return result; | 
|  | 1272 | } | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 1273 | ColorMode colorMode = getActiveColorMode(display); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 1274 | result = reply->writeInt32(static_cast<int32_t>(colorMode)); | 
|  | 1275 | return result; | 
|  | 1276 | } | 
|  | 1277 | case SET_ACTIVE_COLOR_MODE: { | 
|  | 1278 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1279 | sp<IBinder> display = nullptr; | 
|  | 1280 | status_t result = data.readStrongBinder(&display); | 
|  | 1281 | if (result != NO_ERROR) { | 
|  | 1282 | ALOGE("getActiveColorMode failed to readStrongBinder: %d", result); | 
|  | 1283 | return result; | 
|  | 1284 | } | 
|  | 1285 | int32_t colorModeInt = 0; | 
|  | 1286 | result = data.readInt32(&colorModeInt); | 
|  | 1287 | if (result != NO_ERROR) { | 
|  | 1288 | ALOGE("setActiveColorMode failed to readInt32: %d", result); | 
|  | 1289 | return result; | 
|  | 1290 | } | 
|  | 1291 | result = setActiveColorMode(display, | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 1292 | static_cast<ColorMode>(colorModeInt)); | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 1293 | result = reply->writeInt32(result); | 
|  | 1294 | return result; | 
|  | 1295 | } | 
| Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 1296 | case CLEAR_ANIMATION_FRAME_STATS: { | 
|  | 1297 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1298 | status_t result = clearAnimationFrameStats(); | 
|  | 1299 | reply->writeInt32(result); | 
|  | 1300 | return NO_ERROR; | 
|  | 1301 | } | 
|  | 1302 | case GET_ANIMATION_FRAME_STATS: { | 
|  | 1303 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1304 | FrameStats stats; | 
|  | 1305 | status_t result = getAnimationFrameStats(&stats); | 
|  | 1306 | reply->write(stats); | 
|  | 1307 | reply->writeInt32(result); | 
|  | 1308 | return NO_ERROR; | 
|  | 1309 | } | 
| Prashant Malani | 2c9b11f | 2014-05-25 01:36:31 -0700 | [diff] [blame] | 1310 | case SET_POWER_MODE: { | 
|  | 1311 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1312 | sp<IBinder> display = data.readStrongBinder(); | 
|  | 1313 | int32_t mode = data.readInt32(); | 
|  | 1314 | setPowerMode(display, mode); | 
|  | 1315 | return NO_ERROR; | 
|  | 1316 | } | 
| Dan Stoza | c4f471e | 2016-03-24 09:31:08 -0700 | [diff] [blame] | 1317 | case GET_HDR_CAPABILITIES: { | 
|  | 1318 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1319 | sp<IBinder> display = nullptr; | 
|  | 1320 | status_t result = data.readStrongBinder(&display); | 
|  | 1321 | if (result != NO_ERROR) { | 
|  | 1322 | ALOGE("getHdrCapabilities failed to readStrongBinder: %d", | 
|  | 1323 | result); | 
|  | 1324 | return result; | 
|  | 1325 | } | 
|  | 1326 | HdrCapabilities capabilities; | 
|  | 1327 | result = getHdrCapabilities(display, &capabilities); | 
|  | 1328 | reply->writeInt32(result); | 
|  | 1329 | if (result == NO_ERROR) { | 
| Mathias Agopian | e1f5e6f | 2017-02-06 16:34:41 -0800 | [diff] [blame] | 1330 | reply->write(capabilities); | 
| Dan Stoza | c4f471e | 2016-03-24 09:31:08 -0700 | [diff] [blame] | 1331 | } | 
|  | 1332 | return NO_ERROR; | 
|  | 1333 | } | 
| Sahil Dhanju | c1ba5c4 | 2016-06-07 20:09:20 -0700 | [diff] [blame] | 1334 | case ENABLE_VSYNC_INJECTIONS: { | 
|  | 1335 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1336 | bool enable = false; | 
|  | 1337 | status_t result = data.readBool(&enable); | 
|  | 1338 | if (result != NO_ERROR) { | 
|  | 1339 | ALOGE("enableVSyncInjections failed to readBool: %d", result); | 
|  | 1340 | return result; | 
|  | 1341 | } | 
|  | 1342 | return enableVSyncInjections(enable); | 
|  | 1343 | } | 
|  | 1344 | case INJECT_VSYNC: { | 
|  | 1345 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1346 | int64_t when = 0; | 
|  | 1347 | status_t result = data.readInt64(&when); | 
|  | 1348 | if (result != NO_ERROR) { | 
|  | 1349 | ALOGE("enableVSyncInjections failed to readInt64: %d", result); | 
|  | 1350 | return result; | 
|  | 1351 | } | 
|  | 1352 | return injectVSync(when); | 
|  | 1353 | } | 
| Kalle Raita | a099a24 | 2017-01-11 11:17:29 -0800 | [diff] [blame] | 1354 | case GET_LAYER_DEBUG_INFO: { | 
|  | 1355 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1356 | std::vector<LayerDebugInfo> outLayers; | 
|  | 1357 | status_t result = getLayerDebugInfo(&outLayers); | 
|  | 1358 | reply->writeInt32(result); | 
|  | 1359 | if (result == NO_ERROR) | 
|  | 1360 | { | 
|  | 1361 | result = reply->writeParcelableVector(outLayers); | 
|  | 1362 | } | 
|  | 1363 | return result; | 
|  | 1364 | } | 
| Peiyong Lin | 0256f72 | 2018-08-31 15:45:10 -0700 | [diff] [blame] | 1365 | case GET_COMPOSITION_PREFERENCE: { | 
|  | 1366 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Peiyong Lin | c678097 | 2018-10-28 15:24:08 -0700 | [diff] [blame] | 1367 | ui::Dataspace defaultDataspace; | 
|  | 1368 | ui::PixelFormat defaultPixelFormat; | 
|  | 1369 | ui::Dataspace wideColorGamutDataspace; | 
|  | 1370 | ui::PixelFormat wideColorGamutPixelFormat; | 
|  | 1371 | status_t error = | 
|  | 1372 | getCompositionPreference(&defaultDataspace, &defaultPixelFormat, | 
|  | 1373 | &wideColorGamutDataspace, &wideColorGamutPixelFormat); | 
| Peiyong Lin | 0256f72 | 2018-08-31 15:45:10 -0700 | [diff] [blame] | 1374 | reply->writeInt32(error); | 
|  | 1375 | if (error == NO_ERROR) { | 
| Peiyong Lin | c678097 | 2018-10-28 15:24:08 -0700 | [diff] [blame] | 1376 | reply->writeInt32(static_cast<int32_t>(defaultDataspace)); | 
|  | 1377 | reply->writeInt32(static_cast<int32_t>(defaultPixelFormat)); | 
|  | 1378 | reply->writeInt32(static_cast<int32_t>(wideColorGamutDataspace)); | 
| Peiyong Lin | aa3da6a | 2018-12-12 02:48:43 -0800 | [diff] [blame] | 1379 | reply->writeInt32(static_cast<int32_t>(wideColorGamutPixelFormat)); | 
| Peiyong Lin | 0256f72 | 2018-08-31 15:45:10 -0700 | [diff] [blame] | 1380 | } | 
| Peiyong Lin | 3c2791e | 2019-01-14 17:05:18 -0800 | [diff] [blame] | 1381 | return error; | 
| Peiyong Lin | 0256f72 | 2018-08-31 15:45:10 -0700 | [diff] [blame] | 1382 | } | 
| Ady Abraham | 37965d4 | 2018-11-01 13:43:32 -0700 | [diff] [blame] | 1383 | case GET_COLOR_MANAGEMENT: { | 
| Ady Abraham | 2a6ab2a | 2018-10-26 14:25:30 -0700 | [diff] [blame] | 1384 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
| Ady Abraham | 37965d4 | 2018-11-01 13:43:32 -0700 | [diff] [blame] | 1385 | bool result; | 
|  | 1386 | status_t error = getColorManagement(&result); | 
|  | 1387 | if (error == NO_ERROR) { | 
|  | 1388 | reply->writeBool(result); | 
|  | 1389 | } | 
| Peiyong Lin | 3c2791e | 2019-01-14 17:05:18 -0800 | [diff] [blame] | 1390 | return error; | 
| Ady Abraham | 2a6ab2a | 2018-10-26 14:25:30 -0700 | [diff] [blame] | 1391 | } | 
| Kevin DuBois | 9c0a176 | 2018-10-16 13:32:31 -0700 | [diff] [blame] | 1392 | case GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES: { | 
|  | 1393 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1394 |  | 
|  | 1395 | sp<IBinder> display = data.readStrongBinder(); | 
|  | 1396 | ui::PixelFormat format; | 
|  | 1397 | ui::Dataspace dataspace; | 
|  | 1398 | uint8_t component = 0; | 
|  | 1399 | auto result = | 
|  | 1400 | getDisplayedContentSamplingAttributes(display, &format, &dataspace, &component); | 
|  | 1401 | if (result == NO_ERROR) { | 
|  | 1402 | reply->writeUint32(static_cast<uint32_t>(format)); | 
|  | 1403 | reply->writeUint32(static_cast<uint32_t>(dataspace)); | 
|  | 1404 | reply->writeUint32(static_cast<uint32_t>(component)); | 
|  | 1405 | } | 
|  | 1406 | return result; | 
|  | 1407 | } | 
| Kevin DuBois | 74e5377 | 2018-11-19 10:52:38 -0800 | [diff] [blame] | 1408 | case SET_DISPLAY_CONTENT_SAMPLING_ENABLED: { | 
|  | 1409 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1410 |  | 
|  | 1411 | sp<IBinder> display = nullptr; | 
|  | 1412 | bool enable = false; | 
|  | 1413 | int8_t componentMask = 0; | 
|  | 1414 | uint64_t maxFrames = 0; | 
|  | 1415 | status_t result = data.readStrongBinder(&display); | 
|  | 1416 | if (result != NO_ERROR) { | 
|  | 1417 | ALOGE("setDisplayContentSamplingEnabled failure in reading Display token: %d", | 
|  | 1418 | result); | 
|  | 1419 | return result; | 
|  | 1420 | } | 
|  | 1421 |  | 
|  | 1422 | result = data.readBool(&enable); | 
|  | 1423 | if (result != NO_ERROR) { | 
|  | 1424 | ALOGE("setDisplayContentSamplingEnabled failure in reading enable: %d", result); | 
|  | 1425 | return result; | 
|  | 1426 | } | 
|  | 1427 |  | 
|  | 1428 | result = data.readByte(static_cast<int8_t*>(&componentMask)); | 
|  | 1429 | if (result != NO_ERROR) { | 
|  | 1430 | ALOGE("setDisplayContentSamplingEnabled failure in reading component mask: %d", | 
|  | 1431 | result); | 
|  | 1432 | return result; | 
|  | 1433 | } | 
|  | 1434 |  | 
|  | 1435 | result = data.readUint64(&maxFrames); | 
|  | 1436 | if (result != NO_ERROR) { | 
|  | 1437 | ALOGE("setDisplayContentSamplingEnabled failure in reading max frames: %d", result); | 
|  | 1438 | return result; | 
|  | 1439 | } | 
|  | 1440 |  | 
|  | 1441 | return setDisplayContentSamplingEnabled(display, enable, | 
|  | 1442 | static_cast<uint8_t>(componentMask), maxFrames); | 
|  | 1443 | } | 
| Kevin DuBois | 1d4249a | 2018-08-29 10:45:14 -0700 | [diff] [blame] | 1444 | case GET_DISPLAYED_CONTENT_SAMPLE: { | 
|  | 1445 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1446 |  | 
|  | 1447 | sp<IBinder> display = data.readStrongBinder(); | 
|  | 1448 | uint64_t maxFrames = 0; | 
|  | 1449 | uint64_t timestamp = 0; | 
|  | 1450 |  | 
|  | 1451 | status_t result = data.readUint64(&maxFrames); | 
|  | 1452 | if (result != NO_ERROR) { | 
|  | 1453 | ALOGE("getDisplayedContentSample failure in reading max frames: %d", result); | 
|  | 1454 | return result; | 
|  | 1455 | } | 
|  | 1456 |  | 
|  | 1457 | result = data.readUint64(×tamp); | 
|  | 1458 | if (result != NO_ERROR) { | 
|  | 1459 | ALOGE("getDisplayedContentSample failure in reading timestamp: %d", result); | 
|  | 1460 | return result; | 
|  | 1461 | } | 
|  | 1462 |  | 
|  | 1463 | DisplayedFrameStats stats; | 
|  | 1464 | result = getDisplayedContentSample(display, maxFrames, timestamp, &stats); | 
|  | 1465 | if (result == NO_ERROR) { | 
|  | 1466 | reply->writeUint64(stats.numFrames); | 
| Kevin DuBois | 1d4c6a6 | 2018-12-12 13:59:46 -0800 | [diff] [blame] | 1467 | reply->writeUint64Vector(stats.component_0_sample); | 
|  | 1468 | reply->writeUint64Vector(stats.component_1_sample); | 
|  | 1469 | reply->writeUint64Vector(stats.component_2_sample); | 
|  | 1470 | reply->writeUint64Vector(stats.component_3_sample); | 
| Kevin DuBois | 1d4249a | 2018-08-29 10:45:14 -0700 | [diff] [blame] | 1471 | } | 
|  | 1472 | return result; | 
|  | 1473 | } | 
| Peiyong Lin | 3c2791e | 2019-01-14 17:05:18 -0800 | [diff] [blame] | 1474 | case GET_PROTECTED_CONTENT_SUPPORT: { | 
|  | 1475 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1476 | bool result; | 
|  | 1477 | status_t error = getProtectedContentSupport(&result); | 
|  | 1478 | if (error == NO_ERROR) { | 
|  | 1479 | reply->writeBool(result); | 
|  | 1480 | } | 
|  | 1481 | return error; | 
|  | 1482 | } | 
| Peiyong Lin | 4f3fddf | 2019-01-24 17:21:24 -0800 | [diff] [blame] | 1483 | case IS_WIDE_COLOR_DISPLAY: { | 
|  | 1484 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1485 | sp<IBinder> display = nullptr; | 
|  | 1486 | status_t error = data.readStrongBinder(&display); | 
|  | 1487 | if (error != NO_ERROR) { | 
|  | 1488 | return error; | 
|  | 1489 | } | 
|  | 1490 | bool result; | 
|  | 1491 | error = isWideColorDisplay(display, &result); | 
|  | 1492 | if (error == NO_ERROR) { | 
|  | 1493 | reply->writeBool(result); | 
|  | 1494 | } | 
|  | 1495 | return error; | 
|  | 1496 | } | 
| Dominik Laskowski | dcb38bb | 2019-01-25 02:35:50 -0800 | [diff] [blame] | 1497 | case GET_PHYSICAL_DISPLAY_IDS: { | 
|  | 1498 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1499 | return reply->writeUint64Vector(getPhysicalDisplayIds()); | 
|  | 1500 | } | 
| Dan Stoza | 84ab937 | 2018-12-17 15:27:57 -0800 | [diff] [blame] | 1501 | case ADD_REGION_SAMPLING_LISTENER: { | 
|  | 1502 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1503 | Rect samplingArea; | 
|  | 1504 | status_t result = data.read(samplingArea); | 
|  | 1505 | if (result != NO_ERROR) { | 
|  | 1506 | ALOGE("addRegionSamplingListener: Failed to read sampling area"); | 
|  | 1507 | return result; | 
|  | 1508 | } | 
|  | 1509 | sp<IBinder> stopLayerHandle; | 
|  | 1510 | result = data.readNullableStrongBinder(&stopLayerHandle); | 
|  | 1511 | if (result != NO_ERROR) { | 
|  | 1512 | ALOGE("addRegionSamplingListener: Failed to read stop layer handle"); | 
|  | 1513 | return result; | 
|  | 1514 | } | 
|  | 1515 | sp<IRegionSamplingListener> listener; | 
|  | 1516 | result = data.readNullableStrongBinder(&listener); | 
|  | 1517 | if (result != NO_ERROR) { | 
|  | 1518 | ALOGE("addRegionSamplingListener: Failed to read listener"); | 
|  | 1519 | return result; | 
|  | 1520 | } | 
|  | 1521 | return addRegionSamplingListener(samplingArea, stopLayerHandle, listener); | 
|  | 1522 | } | 
|  | 1523 | case REMOVE_REGION_SAMPLING_LISTENER: { | 
|  | 1524 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1525 | sp<IRegionSamplingListener> listener; | 
|  | 1526 | status_t result = data.readNullableStrongBinder(&listener); | 
|  | 1527 | if (result != NO_ERROR) { | 
|  | 1528 | ALOGE("removeRegionSamplingListener: Failed to read listener"); | 
|  | 1529 | return result; | 
|  | 1530 | } | 
|  | 1531 | return removeRegionSamplingListener(listener); | 
|  | 1532 | } | 
| Ady Abraham | 838de06 | 2019-02-04 10:24:03 -0800 | [diff] [blame] | 1533 | case SET_ALLOWED_DISPLAY_CONFIGS: { | 
|  | 1534 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1535 | sp<IBinder> displayToken = data.readStrongBinder(); | 
|  | 1536 | std::vector<int32_t> allowedConfigs; | 
|  | 1537 | data.readInt32Vector(&allowedConfigs); | 
|  | 1538 | status_t result = setAllowedDisplayConfigs(displayToken, allowedConfigs); | 
|  | 1539 | reply->writeInt32(result); | 
|  | 1540 | return result; | 
|  | 1541 | } | 
| Ady Abraham | d9b3ea6 | 2019-02-26 14:08:03 -0800 | [diff] [blame] | 1542 | case GET_ALLOWED_DISPLAY_CONFIGS: { | 
|  | 1543 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1544 | sp<IBinder> displayToken = data.readStrongBinder(); | 
|  | 1545 | std::vector<int32_t> allowedConfigs; | 
|  | 1546 | status_t result = getAllowedDisplayConfigs(displayToken, &allowedConfigs); | 
|  | 1547 | reply->writeInt32Vector(allowedConfigs); | 
|  | 1548 | reply->writeInt32(result); | 
|  | 1549 | return result; | 
|  | 1550 | } | 
| Dan Gittik | 57e63c5 | 2019-01-18 16:37:54 +0000 | [diff] [blame] | 1551 | case GET_DISPLAY_BRIGHTNESS_SUPPORT: { | 
|  | 1552 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1553 | sp<IBinder> displayToken; | 
|  | 1554 | status_t error = data.readNullableStrongBinder(&displayToken); | 
|  | 1555 | if (error != NO_ERROR) { | 
|  | 1556 | ALOGE("getDisplayBrightnessSupport: failed to read display token: %d", error); | 
|  | 1557 | return error; | 
|  | 1558 | } | 
|  | 1559 | bool support = false; | 
|  | 1560 | error = getDisplayBrightnessSupport(displayToken, &support); | 
|  | 1561 | reply->writeBool(support); | 
|  | 1562 | return error; | 
|  | 1563 | } | 
|  | 1564 | case SET_DISPLAY_BRIGHTNESS: { | 
|  | 1565 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1566 | sp<IBinder> displayToken; | 
|  | 1567 | status_t error = data.readNullableStrongBinder(&displayToken); | 
|  | 1568 | if (error != NO_ERROR) { | 
|  | 1569 | ALOGE("setDisplayBrightness: failed to read display token: %d", error); | 
|  | 1570 | return error; | 
|  | 1571 | } | 
|  | 1572 | float brightness = -1.0f; | 
|  | 1573 | error = data.readFloat(&brightness); | 
|  | 1574 | if (error != NO_ERROR) { | 
|  | 1575 | ALOGE("setDisplayBrightness: failed to read brightness: %d", error); | 
|  | 1576 | return error; | 
|  | 1577 | } | 
|  | 1578 | return setDisplayBrightness(displayToken, brightness); | 
|  | 1579 | } | 
| Ady Abraham | 8532d01 | 2019-05-08 14:50:56 -0700 | [diff] [blame] | 1580 | case NOTIFY_POWER_HINT: { | 
|  | 1581 | CHECK_INTERFACE(ISurfaceComposer, data, reply); | 
|  | 1582 | int32_t hintId; | 
|  | 1583 | status_t error = data.readInt32(&hintId); | 
|  | 1584 | if (error != NO_ERROR) { | 
|  | 1585 | ALOGE("notifyPowerHint: failed to read hintId: %d", error); | 
|  | 1586 | return error; | 
|  | 1587 | } | 
|  | 1588 | return notifyPowerHint(hintId); | 
|  | 1589 | } | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 1590 | default: { | 
| Mathias Agopian | 83c0446 | 2009-05-22 19:00:22 -0700 | [diff] [blame] | 1591 | return BBinder::onTransact(code, data, reply, flags); | 
| Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 1592 | } | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1593 | } | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1594 | } | 
|  | 1595 |  | 
| Dominik Laskowski | dcb38bb | 2019-01-25 02:35:50 -0800 | [diff] [blame] | 1596 | } // namespace android |