blob: 91972624a45cab80ce8821735e0ae7b16516eb76 [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001/*
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 Agopianc5b2c0b2009-05-19 19:08:10 -070023#include <binder/Parcel.h>
Mathias Agopianc5b2c0b2009-05-19 19:08:10 -070024#include <binder/IPCThreadState.h>
25#include <binder/IServiceManager.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080026
Mathias Agopiand0566bc2011-11-17 17:49:17 -080027#include <gui/IDisplayEventConnection.h>
Andy McFadden2adaf042012-12-18 09:49:45 -080028#include <gui/IGraphicBufferProducer.h>
Dan Stoza84ab9372018-12-17 15:27:57 -080029#include <gui/IRegionSamplingListener.h>
Mathias Agopian2b5dd402017-02-07 17:36:19 -080030#include <gui/ISurfaceComposer.h>
31#include <gui/ISurfaceComposerClient.h>
Kalle Raitaa099a242017-01-11 11:17:29 -080032#include <gui/LayerDebugInfo.h>
Robert Carr4cdc58f2017-08-23 14:22:20 -070033#include <gui/LayerState.h>
Mathias Agopiand0566bc2011-11-17 17:49:17 -080034
Michael Wright28f24d02016-07-12 13:30:53 -070035#include <system/graphics.h>
36
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080037#include <ui/DisplayInfo.h>
Lajos Molnar67d8bd62014-09-11 14:58:45 -070038#include <ui/DisplayStatInfo.h>
Dan Stozac4f471e2016-03-24 09:31:08 -070039#include <ui/HdrCapabilities.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080040
Jamie Gennis134f0422011-03-08 12:18:54 -080041#include <utils/Log.h>
Mathias Agopian9cce3252010-02-09 17:46:37 -080042
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080043// ---------------------------------------------------------------------------
44
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080045namespace android {
46
Peiyong Lin9f034472018-03-28 15:29:00 -070047using ui::ColorMode;
48
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080049class BpSurfaceComposer : public BpInterface<ISurfaceComposer>
50{
51public:
Chih-Hung Hsiehe2347b72016-04-25 15:41:05 -070052 explicit BpSurfaceComposer(const sp<IBinder>& impl)
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080053 : BpInterface<ISurfaceComposer>(impl)
54 {
55 }
56
Dan Stozad723bd72014-11-18 10:24:03 -080057 virtual ~BpSurfaceComposer();
58
Mathias Agopian7e27f052010-05-28 14:22:23 -070059 virtual sp<ISurfaceComposerClient> createConnection()
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080060 {
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080061 Parcel data, reply;
62 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
63 remote()->transact(BnSurfaceComposer::CREATE_CONNECTION, data, &reply);
Mathias Agopian7e27f052010-05-28 14:22:23 -070064 return interface_cast<ISurfaceComposerClient>(reply.readStrongBinder());
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080065 }
66
Marissa Wall713b63f2018-10-17 15:42:43 -070067 virtual void setTransactionState(const Vector<ComposerState>& state,
68 const Vector<DisplayState>& displays, uint32_t flags,
chaviw273171b2018-12-26 11:46:30 -080069 const sp<IBinder>& applyToken,
Marissa Wall17b4e452018-12-26 16:32:34 -080070 const InputWindowCommands& commands,
71 int64_t desiredPresentTime) {
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080072 Parcel data, reply;
73 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
Dan Stozad723bd72014-11-18 10:24:03 -080074
75 data.writeUint32(static_cast<uint32_t>(state.size()));
76 for (const auto& s : state) {
77 s.write(data);
Mathias Agopian698c0872011-06-28 19:09:31 -070078 }
Dan Stozad723bd72014-11-18 10:24:03 -080079
80 data.writeUint32(static_cast<uint32_t>(displays.size()));
81 for (const auto& d : displays) {
82 d.write(data);
Mathias Agopian8b33f032012-07-24 20:43:54 -070083 }
Dan Stozad723bd72014-11-18 10:24:03 -080084
85 data.writeUint32(flags);
Marissa Wall713b63f2018-10-17 15:42:43 -070086 data.writeStrongBinder(applyToken);
chaviw273171b2018-12-26 11:46:30 -080087 commands.write(data);
Marissa Wall17b4e452018-12-26 16:32:34 -080088 data.writeInt64(desiredPresentTime);
Jamie Gennisb8d69a52011-10-10 15:48:06 -070089 remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply);
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080090 }
91
92 virtual void bootFinished()
93 {
94 Parcel data, reply;
95 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
96 remote()->transact(BnSurfaceComposer::BOOT_FINISHED, data, &reply);
97 }
98
Chavi Weingarten40482ff2017-11-30 01:51:40 +000099 virtual status_t captureScreen(const sp<IBinder>& display, sp<GraphicBuffer>* outBuffer,
Peiyong Lin0e003c92018-09-17 11:09:51 -0700100 const ui::Dataspace reqDataspace,
101 const ui::PixelFormat reqPixelFormat, Rect sourceCrop,
102 uint32_t reqWidth, uint32_t reqHeight, bool useIdentityTransform,
103 ISurfaceComposer::Rotation rotation) {
Mathias Agopian2a9fc492013-03-01 13:42:57 -0800104 Parcel data, reply;
105 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
106 data.writeStrongBinder(display);
Peiyong Lin0e003c92018-09-17 11:09:51 -0700107 data.writeInt32(static_cast<int32_t>(reqDataspace));
108 data.writeInt32(static_cast<int32_t>(reqPixelFormat));
Dan Stozac1879002014-05-22 15:59:05 -0700109 data.write(sourceCrop);
Dan Stozad723bd72014-11-18 10:24:03 -0800110 data.writeUint32(reqWidth);
111 data.writeUint32(reqHeight);
Dan Stozac7014012014-02-14 15:03:43 -0800112 data.writeInt32(static_cast<int32_t>(useIdentityTransform));
Riley Andrewsc3ebe662014-09-04 16:20:31 -0700113 data.writeInt32(static_cast<int32_t>(rotation));
Ana Krulec2d41e422018-07-26 12:07:43 -0700114 status_t result = remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply);
115 if (result != NO_ERROR) {
116 ALOGE("captureScreen failed to transact: %d", result);
117 return result;
Chavi Weingarten40482ff2017-11-30 01:51:40 +0000118 }
Ana Krulec2d41e422018-07-26 12:07:43 -0700119 result = reply.readInt32();
120 if (result != NO_ERROR) {
121 ALOGE("captureScreen failed to readInt32: %d", result);
122 return result;
Chavi Weingarten40482ff2017-11-30 01:51:40 +0000123 }
124
125 *outBuffer = new GraphicBuffer();
126 reply.read(**outBuffer);
Peiyong Lin0e003c92018-09-17 11:09:51 -0700127
Ana Krulec2d41e422018-07-26 12:07:43 -0700128 return result;
Mathias Agopian2a9fc492013-03-01 13:42:57 -0800129 }
130
chaviwa76b2712017-09-20 12:02:26 -0700131 virtual status_t captureLayers(const sp<IBinder>& layerHandleBinder,
Peiyong Lin0e003c92018-09-17 11:09:51 -0700132 sp<GraphicBuffer>* outBuffer, const ui::Dataspace reqDataspace,
133 const ui::PixelFormat reqPixelFormat, const Rect& sourceCrop,
Robert Carr578038f2018-03-09 12:25:24 -0800134 float frameScale, bool childrenOnly) {
chaviwa76b2712017-09-20 12:02:26 -0700135 Parcel data, reply;
136 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
137 data.writeStrongBinder(layerHandleBinder);
Peiyong Lin0e003c92018-09-17 11:09:51 -0700138 data.writeInt32(static_cast<int32_t>(reqDataspace));
139 data.writeInt32(static_cast<int32_t>(reqPixelFormat));
chaviw7206d492017-11-10 16:16:12 -0800140 data.write(sourceCrop);
141 data.writeFloat(frameScale);
Robert Carr578038f2018-03-09 12:25:24 -0800142 data.writeBool(childrenOnly);
Ana Krulec2d41e422018-07-26 12:07:43 -0700143 status_t result = remote()->transact(BnSurfaceComposer::CAPTURE_LAYERS, data, &reply);
144 if (result != NO_ERROR) {
145 ALOGE("captureLayers failed to transact: %d", result);
146 return result;
Chavi Weingarten40482ff2017-11-30 01:51:40 +0000147 }
Ana Krulec2d41e422018-07-26 12:07:43 -0700148 result = reply.readInt32();
149 if (result != NO_ERROR) {
150 ALOGE("captureLayers failed to readInt32: %d", result);
151 return result;
Chavi Weingarten40482ff2017-11-30 01:51:40 +0000152 }
Peiyong Lin0e003c92018-09-17 11:09:51 -0700153
Chavi Weingarten40482ff2017-11-30 01:51:40 +0000154 *outBuffer = new GraphicBuffer();
155 reply.read(**outBuffer);
156
Ana Krulec2d41e422018-07-26 12:07:43 -0700157 return result;
chaviwa76b2712017-09-20 12:02:26 -0700158 }
159
Jamie Gennis582270d2011-08-17 18:19:00 -0700160 virtual bool authenticateSurfaceTexture(
Andy McFadden2adaf042012-12-18 09:49:45 -0800161 const sp<IGraphicBufferProducer>& bufferProducer) const
Jamie Gennis134f0422011-03-08 12:18:54 -0800162 {
163 Parcel data, reply;
164 int err = NO_ERROR;
165 err = data.writeInterfaceToken(
166 ISurfaceComposer::getInterfaceDescriptor());
167 if (err != NO_ERROR) {
Steve Blocke6f43dd2012-01-06 19:20:56 +0000168 ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing "
Jamie Gennis134f0422011-03-08 12:18:54 -0800169 "interface descriptor: %s (%d)", strerror(-err), -err);
170 return false;
171 }
Marco Nelissen2ea926b2014-11-14 08:01:01 -0800172 err = data.writeStrongBinder(IInterface::asBinder(bufferProducer));
Jamie Gennis134f0422011-03-08 12:18:54 -0800173 if (err != NO_ERROR) {
Steve Blocke6f43dd2012-01-06 19:20:56 +0000174 ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing "
Jamie Gennis582270d2011-08-17 18:19:00 -0700175 "strong binder to parcel: %s (%d)", strerror(-err), -err);
Jamie Gennis134f0422011-03-08 12:18:54 -0800176 return false;
177 }
178 err = remote()->transact(BnSurfaceComposer::AUTHENTICATE_SURFACE, data,
179 &reply);
180 if (err != NO_ERROR) {
Steve Blocke6f43dd2012-01-06 19:20:56 +0000181 ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error "
Jamie Gennis582270d2011-08-17 18:19:00 -0700182 "performing transaction: %s (%d)", strerror(-err), -err);
Jamie Gennis134f0422011-03-08 12:18:54 -0800183 return false;
184 }
185 int32_t result = 0;
186 err = reply.readInt32(&result);
187 if (err != NO_ERROR) {
Steve Blocke6f43dd2012-01-06 19:20:56 +0000188 ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error "
Jamie Gennis582270d2011-08-17 18:19:00 -0700189 "retrieving result: %s (%d)", strerror(-err), -err);
Jamie Gennis134f0422011-03-08 12:18:54 -0800190 return false;
191 }
192 return result != 0;
193 }
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800194
Brian Anderson6b376712017-04-04 10:51:39 -0700195 virtual status_t getSupportedFrameTimestamps(
196 std::vector<FrameEvent>* outSupported) const {
197 if (!outSupported) {
198 return UNEXPECTED_NULL;
199 }
200 outSupported->clear();
201
202 Parcel data, reply;
203
204 status_t err = data.writeInterfaceToken(
205 ISurfaceComposer::getInterfaceDescriptor());
206 if (err != NO_ERROR) {
207 return err;
208 }
209
210 err = remote()->transact(
211 BnSurfaceComposer::GET_SUPPORTED_FRAME_TIMESTAMPS,
212 data, &reply);
213 if (err != NO_ERROR) {
214 return err;
215 }
216
217 int32_t result = 0;
218 err = reply.readInt32(&result);
219 if (err != NO_ERROR) {
220 return err;
221 }
222 if (result != NO_ERROR) {
223 return result;
224 }
225
226 std::vector<int32_t> supported;
227 err = reply.readInt32Vector(&supported);
228 if (err != NO_ERROR) {
229 return err;
230 }
231
232 outSupported->reserve(supported.size());
233 for (int32_t s : supported) {
234 outSupported->push_back(static_cast<FrameEvent>(s));
235 }
236 return NO_ERROR;
237 }
238
Jorim Jaggib1e2f8d2017-06-08 15:43:59 -0700239 virtual sp<IDisplayEventConnection> createDisplayEventConnection(VsyncSource vsyncSource)
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800240 {
241 Parcel data, reply;
242 sp<IDisplayEventConnection> result;
243 int err = data.writeInterfaceToken(
244 ISurfaceComposer::getInterfaceDescriptor());
245 if (err != NO_ERROR) {
246 return result;
247 }
Jorim Jaggib1e2f8d2017-06-08 15:43:59 -0700248 data.writeInt32(static_cast<int32_t>(vsyncSource));
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800249 err = remote()->transact(
250 BnSurfaceComposer::CREATE_DISPLAY_EVENT_CONNECTION,
251 data, &reply);
252 if (err != NO_ERROR) {
Steve Blocke6f43dd2012-01-06 19:20:56 +0000253 ALOGE("ISurfaceComposer::createDisplayEventConnection: error performing "
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800254 "transaction: %s (%d)", strerror(-err), -err);
255 return result;
256 }
257 result = interface_cast<IDisplayEventConnection>(reply.readStrongBinder());
258 return result;
259 }
Colin Cross8e533062012-06-07 13:17:52 -0700260
Jamie Gennisdd3cb842012-10-19 18:19:11 -0700261 virtual sp<IBinder> createDisplay(const String8& displayName, bool secure)
Mathias Agopiane57f2922012-08-09 16:29:12 -0700262 {
263 Parcel data, reply;
264 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
Andy McFadden8dfa92f2012-09-17 18:27:17 -0700265 data.writeString8(displayName);
Jamie Gennisdd3cb842012-10-19 18:19:11 -0700266 data.writeInt32(secure ? 1 : 0);
Mathias Agopiane57f2922012-08-09 16:29:12 -0700267 remote()->transact(BnSurfaceComposer::CREATE_DISPLAY, data, &reply);
268 return reply.readStrongBinder();
269 }
270
Jesse Hall6c913be2013-08-08 12:15:49 -0700271 virtual void destroyDisplay(const sp<IBinder>& display)
272 {
273 Parcel data, reply;
274 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
275 data.writeStrongBinder(display);
276 remote()->transact(BnSurfaceComposer::DESTROY_DISPLAY, data, &reply);
277 }
278
Dominik Laskowskidcb38bb2019-01-25 02:35:50 -0800279 virtual std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const {
Mathias Agopiane57f2922012-08-09 16:29:12 -0700280 Parcel data, reply;
281 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
Dominik Laskowskidcb38bb2019-01-25 02:35:50 -0800282 if (remote()->transact(BnSurfaceComposer::GET_PHYSICAL_DISPLAY_IDS, data, &reply) ==
283 NO_ERROR) {
284 std::vector<PhysicalDisplayId> displayIds;
285 if (reply.readUint64Vector(&displayIds) == NO_ERROR) {
286 return displayIds;
287 }
288 }
289
290 return {};
291 }
292
293 virtual sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId displayId) const {
294 Parcel data, reply;
295 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
296 data.writeUint64(displayId);
297 remote()->transact(BnSurfaceComposer::GET_PHYSICAL_DISPLAY_TOKEN, data, &reply);
Mathias Agopiane57f2922012-08-09 16:29:12 -0700298 return reply.readStrongBinder();
299 }
300
Prashant Malani2c9b11f2014-05-25 01:36:31 -0700301 virtual void setPowerMode(const sp<IBinder>& display, int mode)
Colin Cross8e533062012-06-07 13:17:52 -0700302 {
303 Parcel data, reply;
304 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
Andy McFaddenc01a79d2012-09-27 16:02:06 -0700305 data.writeStrongBinder(display);
Prashant Malani2c9b11f2014-05-25 01:36:31 -0700306 data.writeInt32(mode);
307 remote()->transact(BnSurfaceComposer::SET_POWER_MODE, data, &reply);
Colin Cross8e533062012-06-07 13:17:52 -0700308 }
Mathias Agopian3094df32012-06-18 18:06:45 -0700309
Dan Stoza7f7da322014-05-02 15:26:25 -0700310 virtual status_t getDisplayConfigs(const sp<IBinder>& display,
311 Vector<DisplayInfo>* configs)
Mathias Agopianc666cae2012-07-25 18:56:13 -0700312 {
313 Parcel data, reply;
314 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
Jeff Brown9d4e3d22012-08-24 20:00:51 -0700315 data.writeStrongBinder(display);
Dan Stoza7f7da322014-05-02 15:26:25 -0700316 remote()->transact(BnSurfaceComposer::GET_DISPLAY_CONFIGS, data, &reply);
317 status_t result = reply.readInt32();
318 if (result == NO_ERROR) {
Dan Stozad723bd72014-11-18 10:24:03 -0800319 size_t numConfigs = reply.readUint32();
Dan Stoza7f7da322014-05-02 15:26:25 -0700320 configs->clear();
321 configs->resize(numConfigs);
322 for (size_t c = 0; c < numConfigs; ++c) {
323 memcpy(&(configs->editItemAt(c)),
324 reply.readInplace(sizeof(DisplayInfo)),
325 sizeof(DisplayInfo));
326 }
327 }
328 return result;
329 }
330
Lajos Molnar67d8bd62014-09-11 14:58:45 -0700331 virtual status_t getDisplayStats(const sp<IBinder>& display,
332 DisplayStatInfo* stats)
333 {
334 Parcel data, reply;
335 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
336 data.writeStrongBinder(display);
337 remote()->transact(BnSurfaceComposer::GET_DISPLAY_STATS, data, &reply);
338 status_t result = reply.readInt32();
339 if (result == NO_ERROR) {
340 memcpy(stats,
341 reply.readInplace(sizeof(DisplayStatInfo)),
342 sizeof(DisplayStatInfo));
343 }
344 return result;
345 }
346
Dan Stoza7f7da322014-05-02 15:26:25 -0700347 virtual int getActiveConfig(const sp<IBinder>& display)
348 {
349 Parcel data, reply;
350 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
351 data.writeStrongBinder(display);
352 remote()->transact(BnSurfaceComposer::GET_ACTIVE_CONFIG, data, &reply);
353 return reply.readInt32();
354 }
355
356 virtual status_t setActiveConfig(const sp<IBinder>& display, int id)
357 {
358 Parcel data, reply;
Ana Krulec2d41e422018-07-26 12:07:43 -0700359 status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
360 if (result != NO_ERROR) {
361 ALOGE("setActiveConfig failed to writeInterfaceToken: %d", result);
362 return result;
363 }
364 result = data.writeStrongBinder(display);
365 if (result != NO_ERROR) {
366 ALOGE("setActiveConfig failed to writeStrongBinder: %d", result);
367 return result;
368 }
369 result = data.writeInt32(id);
370 if (result != NO_ERROR) {
371 ALOGE("setActiveConfig failed to writeInt32: %d", result);
372 return result;
373 }
374 result = remote()->transact(BnSurfaceComposer::SET_ACTIVE_CONFIG, data, &reply);
375 if (result != NO_ERROR) {
376 ALOGE("setActiveConfig failed to transact: %d", result);
377 return result;
378 }
Mathias Agopianc666cae2012-07-25 18:56:13 -0700379 return reply.readInt32();
380 }
Svetoslavd85084b2014-03-20 10:28:31 -0700381
Michael Wright28f24d02016-07-12 13:30:53 -0700382 virtual status_t getDisplayColorModes(const sp<IBinder>& display,
Peiyong Lina52f0292018-03-14 17:26:31 -0700383 Vector<ColorMode>* outColorModes) {
Michael Wright28f24d02016-07-12 13:30:53 -0700384 Parcel data, reply;
385 status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
386 if (result != NO_ERROR) {
387 ALOGE("getDisplayColorModes failed to writeInterfaceToken: %d", result);
388 return result;
389 }
390 result = data.writeStrongBinder(display);
391 if (result != NO_ERROR) {
392 ALOGE("getDisplayColorModes failed to writeStrongBinder: %d", result);
393 return result;
394 }
395 result = remote()->transact(BnSurfaceComposer::GET_DISPLAY_COLOR_MODES, data, &reply);
396 if (result != NO_ERROR) {
397 ALOGE("getDisplayColorModes failed to transact: %d", result);
398 return result;
399 }
400 result = static_cast<status_t>(reply.readInt32());
401 if (result == NO_ERROR) {
402 size_t numModes = reply.readUint32();
403 outColorModes->clear();
404 outColorModes->resize(numModes);
405 for (size_t i = 0; i < numModes; ++i) {
Peiyong Lina52f0292018-03-14 17:26:31 -0700406 outColorModes->replaceAt(static_cast<ColorMode>(reply.readInt32()), i);
Michael Wright28f24d02016-07-12 13:30:53 -0700407 }
408 }
409 return result;
410 }
411
Daniel Solomon42d04562019-01-20 21:03:19 -0800412 virtual status_t getDisplayNativePrimaries(const sp<IBinder>& display,
413 ui::DisplayPrimaries& primaries) {
414 Parcel data, reply;
415 status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
416 if (result != NO_ERROR) {
417 ALOGE("getDisplayNativePrimaries failed to writeInterfaceToken: %d", result);
418 return result;
419 }
420 result = data.writeStrongBinder(display);
421 if (result != NO_ERROR) {
422 ALOGE("getDisplayNativePrimaries failed to writeStrongBinder: %d", result);
423 return result;
424 }
425 result = remote()->transact(BnSurfaceComposer::GET_DISPLAY_NATIVE_PRIMARIES, data, &reply);
426 if (result != NO_ERROR) {
427 ALOGE("getDisplayNativePrimaries failed to transact: %d", result);
428 return result;
429 }
430 result = reply.readInt32();
431 if (result == NO_ERROR) {
432 memcpy(&primaries, reply.readInplace(sizeof(ui::DisplayPrimaries)),
433 sizeof(ui::DisplayPrimaries));
434 }
435 return result;
436 }
437
Peiyong Lina52f0292018-03-14 17:26:31 -0700438 virtual ColorMode getActiveColorMode(const sp<IBinder>& display) {
Michael Wright28f24d02016-07-12 13:30:53 -0700439 Parcel data, reply;
440 status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
441 if (result != NO_ERROR) {
442 ALOGE("getActiveColorMode failed to writeInterfaceToken: %d", result);
Peiyong Lina52f0292018-03-14 17:26:31 -0700443 return static_cast<ColorMode>(result);
Michael Wright28f24d02016-07-12 13:30:53 -0700444 }
445 result = data.writeStrongBinder(display);
446 if (result != NO_ERROR) {
447 ALOGE("getActiveColorMode failed to writeStrongBinder: %d", result);
Peiyong Lina52f0292018-03-14 17:26:31 -0700448 return static_cast<ColorMode>(result);
Michael Wright28f24d02016-07-12 13:30:53 -0700449 }
450 result = remote()->transact(BnSurfaceComposer::GET_ACTIVE_COLOR_MODE, data, &reply);
451 if (result != NO_ERROR) {
452 ALOGE("getActiveColorMode failed to transact: %d", result);
Peiyong Lina52f0292018-03-14 17:26:31 -0700453 return static_cast<ColorMode>(result);
Michael Wright28f24d02016-07-12 13:30:53 -0700454 }
Peiyong Lina52f0292018-03-14 17:26:31 -0700455 return static_cast<ColorMode>(reply.readInt32());
Michael Wright28f24d02016-07-12 13:30:53 -0700456 }
457
458 virtual status_t setActiveColorMode(const sp<IBinder>& display,
Peiyong Lina52f0292018-03-14 17:26:31 -0700459 ColorMode colorMode) {
Michael Wright28f24d02016-07-12 13:30:53 -0700460 Parcel data, reply;
461 status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
462 if (result != NO_ERROR) {
463 ALOGE("setActiveColorMode failed to writeInterfaceToken: %d", result);
464 return result;
465 }
466 result = data.writeStrongBinder(display);
467 if (result != NO_ERROR) {
468 ALOGE("setActiveColorMode failed to writeStrongBinder: %d", result);
469 return result;
470 }
Peiyong Lina52f0292018-03-14 17:26:31 -0700471 result = data.writeInt32(static_cast<int32_t>(colorMode));
Michael Wright28f24d02016-07-12 13:30:53 -0700472 if (result != NO_ERROR) {
473 ALOGE("setActiveColorMode failed to writeInt32: %d", result);
474 return result;
475 }
476 result = remote()->transact(BnSurfaceComposer::SET_ACTIVE_COLOR_MODE, data, &reply);
477 if (result != NO_ERROR) {
478 ALOGE("setActiveColorMode failed to transact: %d", result);
479 return result;
480 }
481 return static_cast<status_t>(reply.readInt32());
482 }
483
Svetoslavd85084b2014-03-20 10:28:31 -0700484 virtual status_t clearAnimationFrameStats() {
485 Parcel data, reply;
Ana Krulec2d41e422018-07-26 12:07:43 -0700486 status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
487 if (result != NO_ERROR) {
488 ALOGE("clearAnimationFrameStats failed to writeInterfaceToken: %d", result);
489 return result;
490 }
491 result = remote()->transact(BnSurfaceComposer::CLEAR_ANIMATION_FRAME_STATS, data, &reply);
492 if (result != NO_ERROR) {
493 ALOGE("clearAnimationFrameStats failed to transact: %d", result);
494 return result;
495 }
Svetoslavd85084b2014-03-20 10:28:31 -0700496 return reply.readInt32();
497 }
498
499 virtual status_t getAnimationFrameStats(FrameStats* outStats) const {
500 Parcel data, reply;
501 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
502 remote()->transact(BnSurfaceComposer::GET_ANIMATION_FRAME_STATS, data, &reply);
503 reply.read(*outStats);
504 return reply.readInt32();
505 }
Dan Stozac4f471e2016-03-24 09:31:08 -0700506
507 virtual status_t getHdrCapabilities(const sp<IBinder>& display,
508 HdrCapabilities* outCapabilities) const {
509 Parcel data, reply;
510 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
511 status_t result = data.writeStrongBinder(display);
512 if (result != NO_ERROR) {
513 ALOGE("getHdrCapabilities failed to writeStrongBinder: %d", result);
514 return result;
515 }
516 result = remote()->transact(BnSurfaceComposer::GET_HDR_CAPABILITIES,
517 data, &reply);
518 if (result != NO_ERROR) {
519 ALOGE("getHdrCapabilities failed to transact: %d", result);
520 return result;
521 }
522 result = reply.readInt32();
523 if (result == NO_ERROR) {
Mathias Agopiane1f5e6f2017-02-06 16:34:41 -0800524 result = reply.read(*outCapabilities);
Dan Stozac4f471e2016-03-24 09:31:08 -0700525 }
526 return result;
527 }
Sahil Dhanjuc1ba5c42016-06-07 20:09:20 -0700528
529 virtual status_t enableVSyncInjections(bool enable) {
530 Parcel data, reply;
531 status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
532 if (result != NO_ERROR) {
533 ALOGE("enableVSyncInjections failed to writeInterfaceToken: %d", result);
534 return result;
535 }
536 result = data.writeBool(enable);
537 if (result != NO_ERROR) {
538 ALOGE("enableVSyncInjections failed to writeBool: %d", result);
539 return result;
540 }
541 result = remote()->transact(BnSurfaceComposer::ENABLE_VSYNC_INJECTIONS,
542 data, &reply, TF_ONE_WAY);
543 if (result != NO_ERROR) {
544 ALOGE("enableVSyncInjections failed to transact: %d", result);
545 return result;
546 }
547 return result;
548 }
549
550 virtual status_t injectVSync(nsecs_t when) {
551 Parcel data, reply;
552 status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
553 if (result != NO_ERROR) {
554 ALOGE("injectVSync failed to writeInterfaceToken: %d", result);
555 return result;
556 }
557 result = data.writeInt64(when);
558 if (result != NO_ERROR) {
559 ALOGE("injectVSync failed to writeInt64: %d", result);
560 return result;
561 }
562 result = remote()->transact(BnSurfaceComposer::INJECT_VSYNC, data, &reply, TF_ONE_WAY);
563 if (result != NO_ERROR) {
564 ALOGE("injectVSync failed to transact: %d", result);
565 return result;
566 }
567 return result;
568 }
569
Kalle Raitaa099a242017-01-11 11:17:29 -0800570 virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) const
571 {
572 if (!outLayers) {
573 return UNEXPECTED_NULL;
574 }
575
576 Parcel data, reply;
577
578 status_t err = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
579 if (err != NO_ERROR) {
580 return err;
581 }
582
583 err = remote()->transact(BnSurfaceComposer::GET_LAYER_DEBUG_INFO, data, &reply);
584 if (err != NO_ERROR) {
585 return err;
586 }
587
588 int32_t result = 0;
589 err = reply.readInt32(&result);
590 if (err != NO_ERROR) {
591 return err;
592 }
593 if (result != NO_ERROR) {
594 return result;
595 }
596
597 outLayers->clear();
598 return reply.readParcelableVector(outLayers);
599 }
Peiyong Lin0256f722018-08-31 15:45:10 -0700600
Peiyong Linc6780972018-10-28 15:24:08 -0700601 virtual status_t getCompositionPreference(ui::Dataspace* defaultDataspace,
602 ui::PixelFormat* defaultPixelFormat,
603 ui::Dataspace* wideColorGamutDataspace,
604 ui::PixelFormat* wideColorGamutPixelFormat) const {
Peiyong Lin0256f722018-08-31 15:45:10 -0700605 Parcel data, reply;
606 status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
607 if (error != NO_ERROR) {
608 return error;
609 }
610 error = remote()->transact(BnSurfaceComposer::GET_COMPOSITION_PREFERENCE, data, &reply);
611 if (error != NO_ERROR) {
612 return error;
613 }
614 error = static_cast<status_t>(reply.readInt32());
615 if (error == NO_ERROR) {
Peiyong Linc6780972018-10-28 15:24:08 -0700616 *defaultDataspace = static_cast<ui::Dataspace>(reply.readInt32());
617 *defaultPixelFormat = static_cast<ui::PixelFormat>(reply.readInt32());
618 *wideColorGamutDataspace = static_cast<ui::Dataspace>(reply.readInt32());
619 *wideColorGamutPixelFormat = static_cast<ui::PixelFormat>(reply.readInt32());
Peiyong Lin0256f722018-08-31 15:45:10 -0700620 }
621 return error;
622 }
Ady Abraham2a6ab2a2018-10-26 14:25:30 -0700623
Ady Abraham37965d42018-11-01 13:43:32 -0700624 virtual status_t getColorManagement(bool* outGetColorManagement) const {
Ady Abraham2a6ab2a2018-10-26 14:25:30 -0700625 Parcel data, reply;
626 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
Ady Abraham37965d42018-11-01 13:43:32 -0700627 remote()->transact(BnSurfaceComposer::GET_COLOR_MANAGEMENT, data, &reply);
628 bool result;
629 status_t err = reply.readBool(&result);
630 if (err == NO_ERROR) {
631 *outGetColorManagement = result;
Ady Abraham2a6ab2a2018-10-26 14:25:30 -0700632 }
Ady Abraham37965d42018-11-01 13:43:32 -0700633 return err;
Ady Abraham2a6ab2a2018-10-26 14:25:30 -0700634 }
Kevin DuBois9c0a1762018-10-16 13:32:31 -0700635
636 virtual status_t getDisplayedContentSamplingAttributes(const sp<IBinder>& display,
637 ui::PixelFormat* outFormat,
638 ui::Dataspace* outDataspace,
639 uint8_t* outComponentMask) const {
640 if (!outFormat || !outDataspace || !outComponentMask) return BAD_VALUE;
641 Parcel data, reply;
642 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
643 data.writeStrongBinder(display);
644
645 status_t error =
646 remote()->transact(BnSurfaceComposer::GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES,
647 data, &reply);
648 if (error != NO_ERROR) {
649 return error;
650 }
651
652 uint32_t value = 0;
653 error = reply.readUint32(&value);
654 if (error != NO_ERROR) {
655 return error;
656 }
657 *outFormat = static_cast<ui::PixelFormat>(value);
658
659 error = reply.readUint32(&value);
660 if (error != NO_ERROR) {
661 return error;
662 }
663 *outDataspace = static_cast<ui::Dataspace>(value);
664
665 error = reply.readUint32(&value);
666 if (error != NO_ERROR) {
667 return error;
668 }
669 *outComponentMask = static_cast<uint8_t>(value);
670 return error;
671 }
Kevin DuBois74e53772018-11-19 10:52:38 -0800672
673 virtual status_t setDisplayContentSamplingEnabled(const sp<IBinder>& display, bool enable,
674 uint8_t componentMask,
675 uint64_t maxFrames) const {
676 Parcel data, reply;
677 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
678 data.writeStrongBinder(display);
679 data.writeBool(enable);
680 data.writeByte(static_cast<int8_t>(componentMask));
681 data.writeUint64(maxFrames);
682 status_t result =
683 remote()->transact(BnSurfaceComposer::SET_DISPLAY_CONTENT_SAMPLING_ENABLED, data,
684 &reply);
685 return result;
686 }
Kevin DuBois1d4249a2018-08-29 10:45:14 -0700687
688 virtual status_t getDisplayedContentSample(const sp<IBinder>& display, uint64_t maxFrames,
689 uint64_t timestamp,
690 DisplayedFrameStats* outStats) const {
691 if (!outStats) return BAD_VALUE;
692
693 Parcel data, reply;
694 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
695 data.writeStrongBinder(display);
696 data.writeUint64(maxFrames);
697 data.writeUint64(timestamp);
698
699 status_t result =
700 remote()->transact(BnSurfaceComposer::GET_DISPLAYED_CONTENT_SAMPLE, data, &reply);
701
702 if (result != NO_ERROR) {
703 return result;
704 }
705
706 result = reply.readUint64(&outStats->numFrames);
707 if (result != NO_ERROR) {
708 return result;
709 }
710
Kevin DuBois1d4c6a62018-12-12 13:59:46 -0800711 result = reply.readUint64Vector(&outStats->component_0_sample);
Kevin DuBois1d4249a2018-08-29 10:45:14 -0700712 if (result != NO_ERROR) {
713 return result;
714 }
Kevin DuBois1d4c6a62018-12-12 13:59:46 -0800715 result = reply.readUint64Vector(&outStats->component_1_sample);
Kevin DuBois1d4249a2018-08-29 10:45:14 -0700716 if (result != NO_ERROR) {
717 return result;
718 }
Kevin DuBois1d4c6a62018-12-12 13:59:46 -0800719 result = reply.readUint64Vector(&outStats->component_2_sample);
Kevin DuBois1d4249a2018-08-29 10:45:14 -0700720 if (result != NO_ERROR) {
721 return result;
722 }
Kevin DuBois1d4c6a62018-12-12 13:59:46 -0800723 result = reply.readUint64Vector(&outStats->component_3_sample);
Kevin DuBois1d4249a2018-08-29 10:45:14 -0700724 return result;
725 }
Peiyong Lin3c2791e2019-01-14 17:05:18 -0800726
727 virtual status_t getProtectedContentSupport(bool* outSupported) const {
728 Parcel data, reply;
729 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
Peiyong Linb6888fa2019-01-28 13:20:58 -0800730 status_t error =
731 remote()->transact(BnSurfaceComposer::GET_PROTECTED_CONTENT_SUPPORT, data, &reply);
732 if (error != NO_ERROR) {
733 return error;
Peiyong Lin3c2791e2019-01-14 17:05:18 -0800734 }
Peiyong Linb6888fa2019-01-28 13:20:58 -0800735 error = reply.readBool(outSupported);
736 return error;
Peiyong Lin3c2791e2019-01-14 17:05:18 -0800737 }
Marissa Wallebc2c052019-01-16 19:16:55 -0800738
Peiyong Lin4f3fddf2019-01-24 17:21:24 -0800739 virtual status_t isWideColorDisplay(const sp<IBinder>& token,
740 bool* outIsWideColorDisplay) const {
741 Parcel data, reply;
742 status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
743 if (error != NO_ERROR) {
744 return error;
745 }
746 error = data.writeStrongBinder(token);
747 if (error != NO_ERROR) {
748 return error;
749 }
750
751 error = remote()->transact(BnSurfaceComposer::IS_WIDE_COLOR_DISPLAY, data, &reply);
752 if (error != NO_ERROR) {
753 return error;
754 }
755 error = reply.readBool(outIsWideColorDisplay);
756 return error;
757 }
Dan Stoza84ab9372018-12-17 15:27:57 -0800758
759 virtual status_t addRegionSamplingListener(const Rect& samplingArea,
760 const sp<IBinder>& stopLayerHandle,
761 const sp<IRegionSamplingListener>& listener) {
762 Parcel data, reply;
763 status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
764 if (error != NO_ERROR) {
765 ALOGE("addRegionSamplingListener: Failed to write interface token");
766 return error;
767 }
768 error = data.write(samplingArea);
769 if (error != NO_ERROR) {
770 ALOGE("addRegionSamplingListener: Failed to write sampling area");
771 return error;
772 }
773 error = data.writeStrongBinder(stopLayerHandle);
774 if (error != NO_ERROR) {
775 ALOGE("addRegionSamplingListener: Failed to write stop layer handle");
776 return error;
777 }
778 error = data.writeStrongBinder(IInterface::asBinder(listener));
779 if (error != NO_ERROR) {
780 ALOGE("addRegionSamplingListener: Failed to write listener");
781 return error;
782 }
783 error = remote()->transact(BnSurfaceComposer::ADD_REGION_SAMPLING_LISTENER, data, &reply);
784 if (error != NO_ERROR) {
785 ALOGE("addRegionSamplingListener: Failed to transact");
786 }
787 return error;
788 }
789
790 virtual status_t removeRegionSamplingListener(const sp<IRegionSamplingListener>& listener) {
791 Parcel data, reply;
792 status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
793 if (error != NO_ERROR) {
794 ALOGE("addRegionSamplingListener: Failed to write interface token");
795 return error;
796 }
797 error = data.writeStrongBinder(IInterface::asBinder(listener));
798 if (error != NO_ERROR) {
799 ALOGE("addRegionSamplingListener: Failed to write listener");
800 return error;
801 }
802 error = remote()->transact(BnSurfaceComposer::REMOVE_REGION_SAMPLING_LISTENER, data,
803 &reply);
804 if (error != NO_ERROR) {
805 ALOGE("addRegionSamplingListener: Failed to transact");
806 }
807 return error;
808 }
chaviw5f21a5e2019-02-14 10:00:34 -0800809
810 virtual void setInputWindowsFinished() {
811 Parcel data, reply;
812 data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
813 remote()->transact(BnSurfaceComposer::SET_INPUT_WINDOWS_FINISHED, data, &reply);
814 }
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800815};
816
Dan Stozad723bd72014-11-18 10:24:03 -0800817// Out-of-line virtual method definition to trigger vtable emission in this
818// translation unit (see clang warning -Wweak-vtables)
819BpSurfaceComposer::~BpSurfaceComposer() {}
820
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800821IMPLEMENT_META_INTERFACE(SurfaceComposer, "android.ui.ISurfaceComposer");
822
823// ----------------------------------------------------------------------
824
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800825status_t BnSurfaceComposer::onTransact(
826 uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
827{
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800828 switch(code) {
829 case CREATE_CONNECTION: {
Mathias Agopian83c04462009-05-22 19:00:22 -0700830 CHECK_INTERFACE(ISurfaceComposer, data, reply);
Marco Nelissen2ea926b2014-11-14 08:01:01 -0800831 sp<IBinder> b = IInterface::asBinder(createConnection());
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800832 reply->writeStrongBinder(b);
Jesse Hall6c913be2013-08-08 12:15:49 -0700833 return NO_ERROR;
834 }
Mathias Agopian698c0872011-06-28 19:09:31 -0700835 case SET_TRANSACTION_STATE: {
Mathias Agopian83c04462009-05-22 19:00:22 -0700836 CHECK_INTERFACE(ISurfaceComposer, data, reply);
Dan Stozad723bd72014-11-18 10:24:03 -0800837
838 size_t count = data.readUint32();
Michael Lentine8afa1c42014-10-31 11:10:13 -0700839 if (count > data.dataSize()) {
840 return BAD_VALUE;
841 }
Mathias Agopian698c0872011-06-28 19:09:31 -0700842 Vector<ComposerState> state;
843 state.setCapacity(count);
Dan Stozad723bd72014-11-18 10:24:03 -0800844 for (size_t i = 0; i < count; i++) {
Marissa Wallc837b5e2018-10-12 10:04:44 -0700845 ComposerState s;
Michael Lentine8afa1c42014-10-31 11:10:13 -0700846 if (s.read(data) == BAD_VALUE) {
847 return BAD_VALUE;
848 }
Mathias Agopian698c0872011-06-28 19:09:31 -0700849 state.add(s);
850 }
Dan Stozad723bd72014-11-18 10:24:03 -0800851
852 count = data.readUint32();
Michael Lentine8afa1c42014-10-31 11:10:13 -0700853 if (count > data.dataSize()) {
854 return BAD_VALUE;
855 }
Mathias Agopian8b33f032012-07-24 20:43:54 -0700856 DisplayState d;
857 Vector<DisplayState> displays;
858 displays.setCapacity(count);
Dan Stozad723bd72014-11-18 10:24:03 -0800859 for (size_t i = 0; i < count; i++) {
Michael Lentine8afa1c42014-10-31 11:10:13 -0700860 if (d.read(data) == BAD_VALUE) {
861 return BAD_VALUE;
862 }
Mathias Agopian8b33f032012-07-24 20:43:54 -0700863 displays.add(d);
864 }
Dan Stozad723bd72014-11-18 10:24:03 -0800865
866 uint32_t stateFlags = data.readUint32();
Marissa Wall713b63f2018-10-17 15:42:43 -0700867 sp<IBinder> applyToken = data.readStrongBinder();
chaviw273171b2018-12-26 11:46:30 -0800868 InputWindowCommands inputWindowCommands;
869 inputWindowCommands.read(data);
Marissa Wall17b4e452018-12-26 16:32:34 -0800870
871 int64_t desiredPresentTime = data.readInt64();
872 setTransactionState(state, displays, stateFlags, applyToken, inputWindowCommands,
873 desiredPresentTime);
Jesse Hall6c913be2013-08-08 12:15:49 -0700874 return NO_ERROR;
875 }
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800876 case BOOT_FINISHED: {
Mathias Agopian83c04462009-05-22 19:00:22 -0700877 CHECK_INTERFACE(ISurfaceComposer, data, reply);
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800878 bootFinished();
Jesse Hall6c913be2013-08-08 12:15:49 -0700879 return NO_ERROR;
880 }
Mathias Agopian2a9fc492013-03-01 13:42:57 -0800881 case CAPTURE_SCREEN: {
882 CHECK_INTERFACE(ISurfaceComposer, data, reply);
883 sp<IBinder> display = data.readStrongBinder();
Peiyong Lin0e003c92018-09-17 11:09:51 -0700884 ui::Dataspace reqDataspace = static_cast<ui::Dataspace>(data.readInt32());
885 ui::PixelFormat reqPixelFormat = static_cast<ui::PixelFormat>(data.readInt32());
Chavi Weingarten40482ff2017-11-30 01:51:40 +0000886 sp<GraphicBuffer> outBuffer;
Pablo Ceballos60d69222015-08-07 14:47:20 -0700887 Rect sourceCrop(Rect::EMPTY_RECT);
Dan Stozac1879002014-05-22 15:59:05 -0700888 data.read(sourceCrop);
Dan Stozad723bd72014-11-18 10:24:03 -0800889 uint32_t reqWidth = data.readUint32();
890 uint32_t reqHeight = data.readUint32();
Dan Stozac7014012014-02-14 15:03:43 -0800891 bool useIdentityTransform = static_cast<bool>(data.readInt32());
Dan Stozad723bd72014-11-18 10:24:03 -0800892 int32_t rotation = data.readInt32();
Dan Stozac7014012014-02-14 15:03:43 -0800893
Peiyong Lin0e003c92018-09-17 11:09:51 -0700894 status_t res = captureScreen(display, &outBuffer, reqDataspace, reqPixelFormat,
895 sourceCrop, reqWidth, reqHeight, useIdentityTransform,
Chavi Weingarten40482ff2017-11-30 01:51:40 +0000896 static_cast<ISurfaceComposer::Rotation>(rotation));
Mathias Agopian2a9fc492013-03-01 13:42:57 -0800897 reply->writeInt32(res);
Chavi Weingarten40482ff2017-11-30 01:51:40 +0000898 if (res == NO_ERROR) {
899 reply->write(*outBuffer);
900 }
Jesse Hall6c913be2013-08-08 12:15:49 -0700901 return NO_ERROR;
902 }
chaviwa76b2712017-09-20 12:02:26 -0700903 case CAPTURE_LAYERS: {
904 CHECK_INTERFACE(ISurfaceComposer, data, reply);
905 sp<IBinder> layerHandleBinder = data.readStrongBinder();
Peiyong Lin0e003c92018-09-17 11:09:51 -0700906 ui::Dataspace reqDataspace = static_cast<ui::Dataspace>(data.readInt32());
907 ui::PixelFormat reqPixelFormat = static_cast<ui::PixelFormat>(data.readInt32());
Chavi Weingarten40482ff2017-11-30 01:51:40 +0000908 sp<GraphicBuffer> outBuffer;
chaviw7206d492017-11-10 16:16:12 -0800909 Rect sourceCrop(Rect::EMPTY_RECT);
910 data.read(sourceCrop);
911 float frameScale = data.readFloat();
Robert Carr578038f2018-03-09 12:25:24 -0800912 bool childrenOnly = data.readBool();
chaviwa76b2712017-09-20 12:02:26 -0700913
Peiyong Lin0e003c92018-09-17 11:09:51 -0700914 status_t res = captureLayers(layerHandleBinder, &outBuffer, reqDataspace,
915 reqPixelFormat, sourceCrop, frameScale, childrenOnly);
chaviwa76b2712017-09-20 12:02:26 -0700916 reply->writeInt32(res);
Chavi Weingarten40482ff2017-11-30 01:51:40 +0000917 if (res == NO_ERROR) {
918 reply->write(*outBuffer);
919 }
chaviwa76b2712017-09-20 12:02:26 -0700920 return NO_ERROR;
921 }
Jamie Gennis134f0422011-03-08 12:18:54 -0800922 case AUTHENTICATE_SURFACE: {
923 CHECK_INTERFACE(ISurfaceComposer, data, reply);
Andy McFadden2adaf042012-12-18 09:49:45 -0800924 sp<IGraphicBufferProducer> bufferProducer =
925 interface_cast<IGraphicBufferProducer>(data.readStrongBinder());
926 int32_t result = authenticateSurfaceTexture(bufferProducer) ? 1 : 0;
Jamie Gennis134f0422011-03-08 12:18:54 -0800927 reply->writeInt32(result);
Jesse Hall6c913be2013-08-08 12:15:49 -0700928 return NO_ERROR;
929 }
Brian Anderson6b376712017-04-04 10:51:39 -0700930 case GET_SUPPORTED_FRAME_TIMESTAMPS: {
931 CHECK_INTERFACE(ISurfaceComposer, data, reply);
932 std::vector<FrameEvent> supportedTimestamps;
933 status_t result = getSupportedFrameTimestamps(&supportedTimestamps);
934 status_t err = reply->writeInt32(result);
935 if (err != NO_ERROR) {
936 return err;
937 }
938 if (result != NO_ERROR) {
939 return result;
940 }
941
942 std::vector<int32_t> supported;
943 supported.reserve(supportedTimestamps.size());
944 for (FrameEvent s : supportedTimestamps) {
945 supported.push_back(static_cast<int32_t>(s));
946 }
947 return reply->writeInt32Vector(supported);
948 }
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800949 case CREATE_DISPLAY_EVENT_CONNECTION: {
950 CHECK_INTERFACE(ISurfaceComposer, data, reply);
Jorim Jaggib1e2f8d2017-06-08 15:43:59 -0700951 sp<IDisplayEventConnection> connection(createDisplayEventConnection(
952 static_cast<ISurfaceComposer::VsyncSource>(data.readInt32())));
Marco Nelissen2ea926b2014-11-14 08:01:01 -0800953 reply->writeStrongBinder(IInterface::asBinder(connection));
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800954 return NO_ERROR;
Jesse Hall6c913be2013-08-08 12:15:49 -0700955 }
Mathias Agopiane57f2922012-08-09 16:29:12 -0700956 case CREATE_DISPLAY: {
957 CHECK_INTERFACE(ISurfaceComposer, data, reply);
Andy McFadden8dfa92f2012-09-17 18:27:17 -0700958 String8 displayName = data.readString8();
Jamie Gennisdd3cb842012-10-19 18:19:11 -0700959 bool secure = bool(data.readInt32());
960 sp<IBinder> display(createDisplay(displayName, secure));
Mathias Agopiane57f2922012-08-09 16:29:12 -0700961 reply->writeStrongBinder(display);
962 return NO_ERROR;
Jesse Hall6c913be2013-08-08 12:15:49 -0700963 }
964 case DESTROY_DISPLAY: {
965 CHECK_INTERFACE(ISurfaceComposer, data, reply);
966 sp<IBinder> display = data.readStrongBinder();
967 destroyDisplay(display);
968 return NO_ERROR;
969 }
Dominik Laskowskidcb38bb2019-01-25 02:35:50 -0800970 case GET_PHYSICAL_DISPLAY_TOKEN: {
Mathias Agopiane57f2922012-08-09 16:29:12 -0700971 CHECK_INTERFACE(ISurfaceComposer, data, reply);
Dominik Laskowskidcb38bb2019-01-25 02:35:50 -0800972 PhysicalDisplayId displayId = data.readUint64();
973 sp<IBinder> display = getPhysicalDisplayToken(displayId);
Mathias Agopiane57f2922012-08-09 16:29:12 -0700974 reply->writeStrongBinder(display);
975 return NO_ERROR;
Jesse Hall6c913be2013-08-08 12:15:49 -0700976 }
Dan Stoza7f7da322014-05-02 15:26:25 -0700977 case GET_DISPLAY_CONFIGS: {
Mathias Agopianc666cae2012-07-25 18:56:13 -0700978 CHECK_INTERFACE(ISurfaceComposer, data, reply);
Dan Stoza7f7da322014-05-02 15:26:25 -0700979 Vector<DisplayInfo> configs;
Jeff Brown9d4e3d22012-08-24 20:00:51 -0700980 sp<IBinder> display = data.readStrongBinder();
Dan Stoza7f7da322014-05-02 15:26:25 -0700981 status_t result = getDisplayConfigs(display, &configs);
982 reply->writeInt32(result);
983 if (result == NO_ERROR) {
Dan Stozad723bd72014-11-18 10:24:03 -0800984 reply->writeUint32(static_cast<uint32_t>(configs.size()));
Dan Stoza7f7da322014-05-02 15:26:25 -0700985 for (size_t c = 0; c < configs.size(); ++c) {
986 memcpy(reply->writeInplace(sizeof(DisplayInfo)),
987 &configs[c], sizeof(DisplayInfo));
988 }
989 }
990 return NO_ERROR;
991 }
Lajos Molnar67d8bd62014-09-11 14:58:45 -0700992 case GET_DISPLAY_STATS: {
993 CHECK_INTERFACE(ISurfaceComposer, data, reply);
994 DisplayStatInfo stats;
995 sp<IBinder> display = data.readStrongBinder();
996 status_t result = getDisplayStats(display, &stats);
997 reply->writeInt32(result);
998 if (result == NO_ERROR) {
999 memcpy(reply->writeInplace(sizeof(DisplayStatInfo)),
1000 &stats, sizeof(DisplayStatInfo));
1001 }
1002 return NO_ERROR;
1003 }
Dan Stoza7f7da322014-05-02 15:26:25 -07001004 case GET_ACTIVE_CONFIG: {
1005 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1006 sp<IBinder> display = data.readStrongBinder();
1007 int id = getActiveConfig(display);
1008 reply->writeInt32(id);
1009 return NO_ERROR;
1010 }
1011 case SET_ACTIVE_CONFIG: {
1012 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1013 sp<IBinder> display = data.readStrongBinder();
1014 int id = data.readInt32();
1015 status_t result = setActiveConfig(display, id);
Mathias Agopianc666cae2012-07-25 18:56:13 -07001016 reply->writeInt32(result);
Jesse Hall6c913be2013-08-08 12:15:49 -07001017 return NO_ERROR;
1018 }
Michael Wright28f24d02016-07-12 13:30:53 -07001019 case GET_DISPLAY_COLOR_MODES: {
1020 CHECK_INTERFACE(ISurfaceComposer, data, reply);
Peiyong Lina52f0292018-03-14 17:26:31 -07001021 Vector<ColorMode> colorModes;
Michael Wright28f24d02016-07-12 13:30:53 -07001022 sp<IBinder> display = nullptr;
1023 status_t result = data.readStrongBinder(&display);
1024 if (result != NO_ERROR) {
1025 ALOGE("getDisplayColorModes failed to readStrongBinder: %d", result);
1026 return result;
1027 }
1028 result = getDisplayColorModes(display, &colorModes);
1029 reply->writeInt32(result);
1030 if (result == NO_ERROR) {
1031 reply->writeUint32(static_cast<uint32_t>(colorModes.size()));
1032 for (size_t i = 0; i < colorModes.size(); ++i) {
Peiyong Lina52f0292018-03-14 17:26:31 -07001033 reply->writeInt32(static_cast<int32_t>(colorModes[i]));
Michael Wright28f24d02016-07-12 13:30:53 -07001034 }
1035 }
1036 return NO_ERROR;
1037 }
Daniel Solomon42d04562019-01-20 21:03:19 -08001038 case GET_DISPLAY_NATIVE_PRIMARIES: {
1039 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1040 ui::DisplayPrimaries primaries;
1041 sp<IBinder> display = nullptr;
1042
1043 status_t result = data.readStrongBinder(&display);
1044 if (result != NO_ERROR) {
1045 ALOGE("getDisplayNativePrimaries failed to readStrongBinder: %d", result);
1046 return result;
1047 }
1048
1049 result = getDisplayNativePrimaries(display, primaries);
1050 reply->writeInt32(result);
1051 if (result == NO_ERROR) {
1052 memcpy(reply->writeInplace(sizeof(ui::DisplayPrimaries)), &primaries,
1053 sizeof(ui::DisplayPrimaries));
1054 }
1055
1056 return NO_ERROR;
1057 }
Michael Wright28f24d02016-07-12 13:30:53 -07001058 case GET_ACTIVE_COLOR_MODE: {
1059 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1060 sp<IBinder> display = nullptr;
1061 status_t result = data.readStrongBinder(&display);
1062 if (result != NO_ERROR) {
1063 ALOGE("getActiveColorMode failed to readStrongBinder: %d", result);
1064 return result;
1065 }
Peiyong Lina52f0292018-03-14 17:26:31 -07001066 ColorMode colorMode = getActiveColorMode(display);
Michael Wright28f24d02016-07-12 13:30:53 -07001067 result = reply->writeInt32(static_cast<int32_t>(colorMode));
1068 return result;
1069 }
1070 case SET_ACTIVE_COLOR_MODE: {
1071 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1072 sp<IBinder> display = nullptr;
1073 status_t result = data.readStrongBinder(&display);
1074 if (result != NO_ERROR) {
1075 ALOGE("getActiveColorMode failed to readStrongBinder: %d", result);
1076 return result;
1077 }
1078 int32_t colorModeInt = 0;
1079 result = data.readInt32(&colorModeInt);
1080 if (result != NO_ERROR) {
1081 ALOGE("setActiveColorMode failed to readInt32: %d", result);
1082 return result;
1083 }
1084 result = setActiveColorMode(display,
Peiyong Lina52f0292018-03-14 17:26:31 -07001085 static_cast<ColorMode>(colorModeInt));
Michael Wright28f24d02016-07-12 13:30:53 -07001086 result = reply->writeInt32(result);
1087 return result;
1088 }
Svetoslavd85084b2014-03-20 10:28:31 -07001089 case CLEAR_ANIMATION_FRAME_STATS: {
1090 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1091 status_t result = clearAnimationFrameStats();
1092 reply->writeInt32(result);
1093 return NO_ERROR;
1094 }
1095 case GET_ANIMATION_FRAME_STATS: {
1096 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1097 FrameStats stats;
1098 status_t result = getAnimationFrameStats(&stats);
1099 reply->write(stats);
1100 reply->writeInt32(result);
1101 return NO_ERROR;
1102 }
Prashant Malani2c9b11f2014-05-25 01:36:31 -07001103 case SET_POWER_MODE: {
1104 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1105 sp<IBinder> display = data.readStrongBinder();
1106 int32_t mode = data.readInt32();
1107 setPowerMode(display, mode);
1108 return NO_ERROR;
1109 }
Dan Stozac4f471e2016-03-24 09:31:08 -07001110 case GET_HDR_CAPABILITIES: {
1111 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1112 sp<IBinder> display = nullptr;
1113 status_t result = data.readStrongBinder(&display);
1114 if (result != NO_ERROR) {
1115 ALOGE("getHdrCapabilities failed to readStrongBinder: %d",
1116 result);
1117 return result;
1118 }
1119 HdrCapabilities capabilities;
1120 result = getHdrCapabilities(display, &capabilities);
1121 reply->writeInt32(result);
1122 if (result == NO_ERROR) {
Mathias Agopiane1f5e6f2017-02-06 16:34:41 -08001123 reply->write(capabilities);
Dan Stozac4f471e2016-03-24 09:31:08 -07001124 }
1125 return NO_ERROR;
1126 }
Sahil Dhanjuc1ba5c42016-06-07 20:09:20 -07001127 case ENABLE_VSYNC_INJECTIONS: {
1128 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1129 bool enable = false;
1130 status_t result = data.readBool(&enable);
1131 if (result != NO_ERROR) {
1132 ALOGE("enableVSyncInjections failed to readBool: %d", result);
1133 return result;
1134 }
1135 return enableVSyncInjections(enable);
1136 }
1137 case INJECT_VSYNC: {
1138 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1139 int64_t when = 0;
1140 status_t result = data.readInt64(&when);
1141 if (result != NO_ERROR) {
1142 ALOGE("enableVSyncInjections failed to readInt64: %d", result);
1143 return result;
1144 }
1145 return injectVSync(when);
1146 }
Kalle Raitaa099a242017-01-11 11:17:29 -08001147 case GET_LAYER_DEBUG_INFO: {
1148 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1149 std::vector<LayerDebugInfo> outLayers;
1150 status_t result = getLayerDebugInfo(&outLayers);
1151 reply->writeInt32(result);
1152 if (result == NO_ERROR)
1153 {
1154 result = reply->writeParcelableVector(outLayers);
1155 }
1156 return result;
1157 }
Peiyong Lin0256f722018-08-31 15:45:10 -07001158 case GET_COMPOSITION_PREFERENCE: {
1159 CHECK_INTERFACE(ISurfaceComposer, data, reply);
Peiyong Linc6780972018-10-28 15:24:08 -07001160 ui::Dataspace defaultDataspace;
1161 ui::PixelFormat defaultPixelFormat;
1162 ui::Dataspace wideColorGamutDataspace;
1163 ui::PixelFormat wideColorGamutPixelFormat;
1164 status_t error =
1165 getCompositionPreference(&defaultDataspace, &defaultPixelFormat,
1166 &wideColorGamutDataspace, &wideColorGamutPixelFormat);
Peiyong Lin0256f722018-08-31 15:45:10 -07001167 reply->writeInt32(error);
1168 if (error == NO_ERROR) {
Peiyong Linc6780972018-10-28 15:24:08 -07001169 reply->writeInt32(static_cast<int32_t>(defaultDataspace));
1170 reply->writeInt32(static_cast<int32_t>(defaultPixelFormat));
1171 reply->writeInt32(static_cast<int32_t>(wideColorGamutDataspace));
Peiyong Linaa3da6a2018-12-12 02:48:43 -08001172 reply->writeInt32(static_cast<int32_t>(wideColorGamutPixelFormat));
Peiyong Lin0256f722018-08-31 15:45:10 -07001173 }
Peiyong Lin3c2791e2019-01-14 17:05:18 -08001174 return error;
Peiyong Lin0256f722018-08-31 15:45:10 -07001175 }
Ady Abraham37965d42018-11-01 13:43:32 -07001176 case GET_COLOR_MANAGEMENT: {
Ady Abraham2a6ab2a2018-10-26 14:25:30 -07001177 CHECK_INTERFACE(ISurfaceComposer, data, reply);
Ady Abraham37965d42018-11-01 13:43:32 -07001178 bool result;
1179 status_t error = getColorManagement(&result);
1180 if (error == NO_ERROR) {
1181 reply->writeBool(result);
1182 }
Peiyong Lin3c2791e2019-01-14 17:05:18 -08001183 return error;
Ady Abraham2a6ab2a2018-10-26 14:25:30 -07001184 }
Kevin DuBois9c0a1762018-10-16 13:32:31 -07001185 case GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES: {
1186 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1187
1188 sp<IBinder> display = data.readStrongBinder();
1189 ui::PixelFormat format;
1190 ui::Dataspace dataspace;
1191 uint8_t component = 0;
1192 auto result =
1193 getDisplayedContentSamplingAttributes(display, &format, &dataspace, &component);
1194 if (result == NO_ERROR) {
1195 reply->writeUint32(static_cast<uint32_t>(format));
1196 reply->writeUint32(static_cast<uint32_t>(dataspace));
1197 reply->writeUint32(static_cast<uint32_t>(component));
1198 }
1199 return result;
1200 }
Kevin DuBois74e53772018-11-19 10:52:38 -08001201 case SET_DISPLAY_CONTENT_SAMPLING_ENABLED: {
1202 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1203
1204 sp<IBinder> display = nullptr;
1205 bool enable = false;
1206 int8_t componentMask = 0;
1207 uint64_t maxFrames = 0;
1208 status_t result = data.readStrongBinder(&display);
1209 if (result != NO_ERROR) {
1210 ALOGE("setDisplayContentSamplingEnabled failure in reading Display token: %d",
1211 result);
1212 return result;
1213 }
1214
1215 result = data.readBool(&enable);
1216 if (result != NO_ERROR) {
1217 ALOGE("setDisplayContentSamplingEnabled failure in reading enable: %d", result);
1218 return result;
1219 }
1220
1221 result = data.readByte(static_cast<int8_t*>(&componentMask));
1222 if (result != NO_ERROR) {
1223 ALOGE("setDisplayContentSamplingEnabled failure in reading component mask: %d",
1224 result);
1225 return result;
1226 }
1227
1228 result = data.readUint64(&maxFrames);
1229 if (result != NO_ERROR) {
1230 ALOGE("setDisplayContentSamplingEnabled failure in reading max frames: %d", result);
1231 return result;
1232 }
1233
1234 return setDisplayContentSamplingEnabled(display, enable,
1235 static_cast<uint8_t>(componentMask), maxFrames);
1236 }
Kevin DuBois1d4249a2018-08-29 10:45:14 -07001237 case GET_DISPLAYED_CONTENT_SAMPLE: {
1238 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1239
1240 sp<IBinder> display = data.readStrongBinder();
1241 uint64_t maxFrames = 0;
1242 uint64_t timestamp = 0;
1243
1244 status_t result = data.readUint64(&maxFrames);
1245 if (result != NO_ERROR) {
1246 ALOGE("getDisplayedContentSample failure in reading max frames: %d", result);
1247 return result;
1248 }
1249
1250 result = data.readUint64(&timestamp);
1251 if (result != NO_ERROR) {
1252 ALOGE("getDisplayedContentSample failure in reading timestamp: %d", result);
1253 return result;
1254 }
1255
1256 DisplayedFrameStats stats;
1257 result = getDisplayedContentSample(display, maxFrames, timestamp, &stats);
1258 if (result == NO_ERROR) {
1259 reply->writeUint64(stats.numFrames);
Kevin DuBois1d4c6a62018-12-12 13:59:46 -08001260 reply->writeUint64Vector(stats.component_0_sample);
1261 reply->writeUint64Vector(stats.component_1_sample);
1262 reply->writeUint64Vector(stats.component_2_sample);
1263 reply->writeUint64Vector(stats.component_3_sample);
Kevin DuBois1d4249a2018-08-29 10:45:14 -07001264 }
1265 return result;
1266 }
Peiyong Lin3c2791e2019-01-14 17:05:18 -08001267 case GET_PROTECTED_CONTENT_SUPPORT: {
1268 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1269 bool result;
1270 status_t error = getProtectedContentSupport(&result);
1271 if (error == NO_ERROR) {
1272 reply->writeBool(result);
1273 }
1274 return error;
1275 }
Peiyong Lin4f3fddf2019-01-24 17:21:24 -08001276 case IS_WIDE_COLOR_DISPLAY: {
1277 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1278 sp<IBinder> display = nullptr;
1279 status_t error = data.readStrongBinder(&display);
1280 if (error != NO_ERROR) {
1281 return error;
1282 }
1283 bool result;
1284 error = isWideColorDisplay(display, &result);
1285 if (error == NO_ERROR) {
1286 reply->writeBool(result);
1287 }
1288 return error;
1289 }
Dominik Laskowskidcb38bb2019-01-25 02:35:50 -08001290 case GET_PHYSICAL_DISPLAY_IDS: {
1291 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1292 return reply->writeUint64Vector(getPhysicalDisplayIds());
1293 }
Dan Stoza84ab9372018-12-17 15:27:57 -08001294 case ADD_REGION_SAMPLING_LISTENER: {
1295 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1296 Rect samplingArea;
1297 status_t result = data.read(samplingArea);
1298 if (result != NO_ERROR) {
1299 ALOGE("addRegionSamplingListener: Failed to read sampling area");
1300 return result;
1301 }
1302 sp<IBinder> stopLayerHandle;
1303 result = data.readNullableStrongBinder(&stopLayerHandle);
1304 if (result != NO_ERROR) {
1305 ALOGE("addRegionSamplingListener: Failed to read stop layer handle");
1306 return result;
1307 }
1308 sp<IRegionSamplingListener> listener;
1309 result = data.readNullableStrongBinder(&listener);
1310 if (result != NO_ERROR) {
1311 ALOGE("addRegionSamplingListener: Failed to read listener");
1312 return result;
1313 }
1314 return addRegionSamplingListener(samplingArea, stopLayerHandle, listener);
1315 }
1316 case REMOVE_REGION_SAMPLING_LISTENER: {
1317 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1318 sp<IRegionSamplingListener> listener;
1319 status_t result = data.readNullableStrongBinder(&listener);
1320 if (result != NO_ERROR) {
1321 ALOGE("removeRegionSamplingListener: Failed to read listener");
1322 return result;
1323 }
1324 return removeRegionSamplingListener(listener);
1325 }
chaviw5f21a5e2019-02-14 10:00:34 -08001326 case SET_INPUT_WINDOWS_FINISHED: {
1327 CHECK_INTERFACE(ISurfaceComposer, data, reply);
1328 setInputWindowsFinished();
1329 return NO_ERROR;
1330 }
Jesse Hall6c913be2013-08-08 12:15:49 -07001331 default: {
Mathias Agopian83c04462009-05-22 19:00:22 -07001332 return BBinder::onTransact(code, data, reply, flags);
Jesse Hall6c913be2013-08-08 12:15:49 -07001333 }
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001334 }
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001335}
1336
Dominik Laskowskidcb38bb2019-01-25 02:35:50 -08001337} // namespace android