blob: f23f10a1a96a8b2a1531e335bd543329ae4ee508 [file] [log] [blame]
Chia-I Wu5bac7f32017-04-06 12:34:32 -07001/*
2 * Copyright 2016 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#define LOG_TAG "Gralloc2"
18
Jesse Hall5dac7812017-07-06 14:02:29 -070019#include <hidl/ServiceManagement.h>
Chia-I Wud8091b92017-05-16 14:30:34 -070020#include <hwbinder/IPCThreadState.h>
Chia-I Wu5bac7f32017-04-06 12:34:32 -070021#include <ui/Gralloc2.h>
22
Craig Donnere6ecb922017-12-27 14:59:29 -080023#include <inttypes.h>
Chia-I Wu5bac7f32017-04-06 12:34:32 -070024#include <log/log.h>
25#pragma clang diagnostic push
26#pragma clang diagnostic ignored "-Wzero-length-array"
27#include <sync/sync.h>
28#pragma clang diagnostic pop
29
Marissa Wall925bf7f2018-12-29 14:27:11 -080030using android::hardware::graphics::allocator::V2_0::IAllocator;
Marissa Wall1e779252018-12-29 12:01:57 -080031using android::hardware::graphics::common::V1_1::BufferUsage;
32using android::hardware::graphics::common::V1_1::PixelFormat;
33using android::hardware::graphics::mapper::V2_0::BufferDescriptor;
34using android::hardware::graphics::mapper::V2_0::Error;
35using android::hardware::graphics::mapper::V2_0::YCbCrLayout;
Marissa Wall925bf7f2018-12-29 14:27:11 -080036using android::hardware::graphics::mapper::V2_1::IMapper;
Marissa Wall1e779252018-12-29 12:01:57 -080037
Chia-I Wu5bac7f32017-04-06 12:34:32 -070038namespace android {
39
Craig Donnere6ecb922017-12-27 14:59:29 -080040namespace {
41
Chia-I Wu5bac7f32017-04-06 12:34:32 -070042static constexpr Error kTransactionError = Error::NO_RESOURCES;
43
Craig Donnere6ecb922017-12-27 14:59:29 -080044uint64_t getValid10UsageBits() {
45 static const uint64_t valid10UsageBits = []() -> uint64_t {
46 using hardware::graphics::common::V1_0::BufferUsage;
47 uint64_t bits = 0;
Steven Moreland3cde8752018-05-01 16:54:17 -070048 for (const auto bit : hardware::hidl_enum_range<BufferUsage>()) {
Craig Donnere6ecb922017-12-27 14:59:29 -080049 bits = bits | bit;
50 }
Craig Donnere6ecb922017-12-27 14:59:29 -080051 return bits;
52 }();
53 return valid10UsageBits;
54}
55
56uint64_t getValid11UsageBits() {
57 static const uint64_t valid11UsageBits = []() -> uint64_t {
58 using hardware::graphics::common::V1_1::BufferUsage;
59 uint64_t bits = 0;
Steven Moreland3cde8752018-05-01 16:54:17 -070060 for (const auto bit : hardware::hidl_enum_range<BufferUsage>()) {
Craig Donnere6ecb922017-12-27 14:59:29 -080061 bits = bits | bit;
62 }
Chia-I Wu4f55f162018-01-16 21:58:18 -080063 return bits;
Craig Donnere6ecb922017-12-27 14:59:29 -080064 }();
65 return valid11UsageBits;
66}
67
Marissa Walld380e2c2018-12-29 14:17:29 -080068static inline IMapper::Rect sGralloc2Rect(const Rect& rect) {
69 IMapper::Rect outRect{};
Marissa Wall1e779252018-12-29 12:01:57 -080070 outRect.left = rect.left;
71 outRect.top = rect.top;
72 outRect.width = rect.width();
73 outRect.height = rect.height();
74 return outRect;
75}
76
Craig Donnere6ecb922017-12-27 14:59:29 -080077} // anonymous namespace
78
Marissa Walld380e2c2018-12-29 14:17:29 -080079void Gralloc2Mapper::preload() {
Jesse Hall5dac7812017-07-06 14:02:29 -070080 android::hardware::preloadPassthroughService<hardware::graphics::mapper::V2_0::IMapper>();
81}
82
Marissa Walld380e2c2018-12-29 14:17:29 -080083Gralloc2Mapper::Gralloc2Mapper() {
Chia-I Wu4f55f162018-01-16 21:58:18 -080084 mMapper = hardware::graphics::mapper::V2_0::IMapper::getService();
Chia-I Wudbbe33b2017-09-27 15:22:21 -070085 if (mMapper == nullptr) {
Marissa Wall925bf7f2018-12-29 14:27:11 -080086 ALOGW("mapper 2.x is not supported");
87 return;
Chia-I Wudbbe33b2017-09-27 15:22:21 -070088 }
89 if (mMapper->isRemote()) {
Chia-I Wu5bac7f32017-04-06 12:34:32 -070090 LOG_ALWAYS_FATAL("gralloc-mapper must be in passthrough mode");
91 }
Chia-I Wudbbe33b2017-09-27 15:22:21 -070092
93 // IMapper 2.1 is optional
Chia-I Wu4f55f162018-01-16 21:58:18 -080094 mMapperV2_1 = IMapper::castFrom(mMapper);
Chia-I Wu5bac7f32017-04-06 12:34:32 -070095}
96
Valerie Hau250c6542019-01-31 14:23:43 -080097bool Gralloc2Mapper::isLoaded() const {
Marissa Wall925bf7f2018-12-29 14:27:11 -080098 return mMapper != nullptr;
99}
100
Marissa Walld380e2c2018-12-29 14:17:29 -0800101status_t Gralloc2Mapper::validateBufferDescriptorInfo(
102 IMapper::BufferDescriptorInfo* descriptorInfo) const {
Craig Donnere6ecb922017-12-27 14:59:29 -0800103 uint64_t validUsageBits = getValid10UsageBits();
104 if (mMapperV2_1 != nullptr) {
105 validUsageBits = validUsageBits | getValid11UsageBits();
106 }
107
Marissa Wall1e779252018-12-29 12:01:57 -0800108 if (descriptorInfo->usage & ~validUsageBits) {
Craig Donnere6ecb922017-12-27 14:59:29 -0800109 ALOGE("buffer descriptor contains invalid usage bits 0x%" PRIx64,
Marissa Wall1e779252018-12-29 12:01:57 -0800110 descriptorInfo->usage & ~validUsageBits);
111 return BAD_VALUE;
Craig Donnere6ecb922017-12-27 14:59:29 -0800112 }
Chris Forbes6c09ee72022-01-26 18:48:55 +1300113
114 // Gralloc2 implementations never understand non-BLOB with GPU_DATA_BUFFER
115 // and do not reliably reject it.
116 if (descriptorInfo->usage & BufferUsage::GPU_DATA_BUFFER &&
117 descriptorInfo->format != hardware::graphics::common::V1_1::PixelFormat::BLOB) {
118 ALOGE("gralloc2 does not support non-BLOB pixel formats with GPU_DATA_BUFFER usage");
119 return BAD_VALUE;
120 }
121
Marissa Wall1e779252018-12-29 12:01:57 -0800122 return NO_ERROR;
Craig Donnere6ecb922017-12-27 14:59:29 -0800123}
124
Marissa Walld380e2c2018-12-29 14:17:29 -0800125status_t Gralloc2Mapper::createDescriptor(void* bufferDescriptorInfo,
126 void* outBufferDescriptor) const {
Marissa Wall1e779252018-12-29 12:01:57 -0800127 IMapper::BufferDescriptorInfo* descriptorInfo =
128 static_cast<IMapper::BufferDescriptorInfo*>(bufferDescriptorInfo);
129 BufferDescriptor* outDescriptor = static_cast<BufferDescriptor*>(outBufferDescriptor);
130
131 status_t status = validateBufferDescriptorInfo(descriptorInfo);
132 if (status != NO_ERROR) {
133 return status;
Craig Donnere6ecb922017-12-27 14:59:29 -0800134 }
135
Marissa Wall1e779252018-12-29 12:01:57 -0800136 Error error;
Chia-I Wu4f55f162018-01-16 21:58:18 -0800137 auto hidl_cb = [&](const auto& tmpError, const auto& tmpDescriptor)
138 {
139 error = tmpError;
140 if (error != Error::NONE) {
141 return;
142 }
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700143
Chia-I Wu4f55f162018-01-16 21:58:18 -0800144 *outDescriptor = tmpDescriptor;
145 };
146
147 hardware::Return<void> ret;
148 if (mMapperV2_1 != nullptr) {
Marissa Wall1e779252018-12-29 12:01:57 -0800149 ret = mMapperV2_1->createDescriptor_2_1(*descriptorInfo, hidl_cb);
Chia-I Wu4f55f162018-01-16 21:58:18 -0800150 } else {
151 const hardware::graphics::mapper::V2_0::IMapper::BufferDescriptorInfo info = {
Marissa Wall1e779252018-12-29 12:01:57 -0800152 descriptorInfo->width,
153 descriptorInfo->height,
154 descriptorInfo->layerCount,
155 static_cast<hardware::graphics::common::V1_0::PixelFormat>(descriptorInfo->format),
156 descriptorInfo->usage,
Chia-I Wu4f55f162018-01-16 21:58:18 -0800157 };
158 ret = mMapper->createDescriptor(info, hidl_cb);
159 }
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700160
Marissa Wall1e779252018-12-29 12:01:57 -0800161 return static_cast<status_t>((ret.isOk()) ? error : kTransactionError);
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700162}
163
Marissa Walld380e2c2018-12-29 14:17:29 -0800164status_t Gralloc2Mapper::importBuffer(const hardware::hidl_handle& rawHandle,
165 buffer_handle_t* outBufferHandle) const {
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700166 Error error;
167 auto ret = mMapper->importBuffer(rawHandle,
168 [&](const auto& tmpError, const auto& tmpBuffer)
169 {
170 error = tmpError;
171 if (error != Error::NONE) {
172 return;
173 }
174
175 *outBufferHandle = static_cast<buffer_handle_t>(tmpBuffer);
176 });
177
Marissa Wall1e779252018-12-29 12:01:57 -0800178 return static_cast<status_t>((ret.isOk()) ? error : kTransactionError);
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700179}
180
Marissa Walld380e2c2018-12-29 14:17:29 -0800181void Gralloc2Mapper::freeBuffer(buffer_handle_t bufferHandle) const {
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700182 auto buffer = const_cast<native_handle_t*>(bufferHandle);
183 auto ret = mMapper->freeBuffer(buffer);
184
185 auto error = (ret.isOk()) ? static_cast<Error>(ret) : kTransactionError;
186 ALOGE_IF(error != Error::NONE, "freeBuffer(%p) failed with %d",
187 buffer, error);
188}
189
Marissa Walld380e2c2018-12-29 14:17:29 -0800190status_t Gralloc2Mapper::validateBufferSize(buffer_handle_t bufferHandle, uint32_t width,
191 uint32_t height, android::PixelFormat format,
192 uint32_t layerCount, uint64_t usage,
193 uint32_t stride) const {
Chia-I Wudbbe33b2017-09-27 15:22:21 -0700194 if (mMapperV2_1 == nullptr) {
Marissa Wall1e779252018-12-29 12:01:57 -0800195 return NO_ERROR;
Chia-I Wudbbe33b2017-09-27 15:22:21 -0700196 }
197
Marissa Wall1e779252018-12-29 12:01:57 -0800198 IMapper::BufferDescriptorInfo descriptorInfo = {};
199 descriptorInfo.width = width;
200 descriptorInfo.height = height;
201 descriptorInfo.layerCount = layerCount;
202 descriptorInfo.format = static_cast<hardware::graphics::common::V1_1::PixelFormat>(format);
203 descriptorInfo.usage = usage;
204
Chia-I Wudbbe33b2017-09-27 15:22:21 -0700205 auto buffer = const_cast<native_handle_t*>(bufferHandle);
206 auto ret = mMapperV2_1->validateBufferSize(buffer, descriptorInfo, stride);
207
Marissa Wall1e779252018-12-29 12:01:57 -0800208 return static_cast<status_t>((ret.isOk()) ? static_cast<Error>(ret) : kTransactionError);
Chia-I Wudbbe33b2017-09-27 15:22:21 -0700209}
210
Marissa Walld380e2c2018-12-29 14:17:29 -0800211void Gralloc2Mapper::getTransportSize(buffer_handle_t bufferHandle, uint32_t* outNumFds,
212 uint32_t* outNumInts) const {
Chia-I Wudbbe33b2017-09-27 15:22:21 -0700213 *outNumFds = uint32_t(bufferHandle->numFds);
214 *outNumInts = uint32_t(bufferHandle->numInts);
215
216 if (mMapperV2_1 == nullptr) {
217 return;
218 }
219
220 Error error;
221 auto buffer = const_cast<native_handle_t*>(bufferHandle);
222 auto ret = mMapperV2_1->getTransportSize(buffer,
223 [&](const auto& tmpError, const auto& tmpNumFds, const auto& tmpNumInts) {
224 error = tmpError;
225 if (error != Error::NONE) {
226 return;
227 }
228
229 *outNumFds = tmpNumFds;
230 *outNumInts = tmpNumInts;
231 });
232
Marissa Wall1e779252018-12-29 12:01:57 -0800233 error = (ret.isOk()) ? error : kTransactionError;
234
235 ALOGE_IF(error != Error::NONE, "getTransportSize(%p) failed with %d", buffer, error);
Chia-I Wudbbe33b2017-09-27 15:22:21 -0700236}
237
Marissa Walld380e2c2018-12-29 14:17:29 -0800238status_t Gralloc2Mapper::lock(buffer_handle_t bufferHandle, uint64_t usage, const Rect& bounds,
Valerie Hau0c9fc362019-01-22 09:17:19 -0800239 int acquireFence, void** outData, int32_t* outBytesPerPixel,
240 int32_t* outBytesPerStride) const {
241 if (outBytesPerPixel) {
242 *outBytesPerPixel = -1;
243 }
244 if (outBytesPerStride) {
245 *outBytesPerStride = -1;
246 }
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700247 auto buffer = const_cast<native_handle_t*>(bufferHandle);
248
Marissa Wall1e779252018-12-29 12:01:57 -0800249 IMapper::Rect accessRegion = sGralloc2Rect(bounds);
250
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700251 // put acquireFence in a hidl_handle
252 hardware::hidl_handle acquireFenceHandle;
253 NATIVE_HANDLE_DECLARE_STORAGE(acquireFenceStorage, 1, 0);
254 if (acquireFence >= 0) {
255 auto h = native_handle_init(acquireFenceStorage, 1, 0);
256 h->data[0] = acquireFence;
257 acquireFenceHandle = h;
258 }
259
260 Error error;
261 auto ret = mMapper->lock(buffer, usage, accessRegion, acquireFenceHandle,
262 [&](const auto& tmpError, const auto& tmpData)
263 {
264 error = tmpError;
265 if (error != Error::NONE) {
266 return;
267 }
268
269 *outData = tmpData;
270 });
271
272 // we own acquireFence even on errors
273 if (acquireFence >= 0) {
274 close(acquireFence);
275 }
276
Marissa Wall1e779252018-12-29 12:01:57 -0800277 error = (ret.isOk()) ? error : kTransactionError;
278
279 ALOGW_IF(error != Error::NONE, "lock(%p, ...) failed: %d", bufferHandle, error);
280
281 return static_cast<status_t>(error);
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700282}
283
Marissa Walld380e2c2018-12-29 14:17:29 -0800284status_t Gralloc2Mapper::lock(buffer_handle_t bufferHandle, uint64_t usage, const Rect& bounds,
285 int acquireFence, android_ycbcr* ycbcr) const {
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700286 auto buffer = const_cast<native_handle_t*>(bufferHandle);
287
Marissa Wall1e779252018-12-29 12:01:57 -0800288 IMapper::Rect accessRegion = sGralloc2Rect(bounds);
289
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700290 // put acquireFence in a hidl_handle
291 hardware::hidl_handle acquireFenceHandle;
292 NATIVE_HANDLE_DECLARE_STORAGE(acquireFenceStorage, 1, 0);
293 if (acquireFence >= 0) {
294 auto h = native_handle_init(acquireFenceStorage, 1, 0);
295 h->data[0] = acquireFence;
296 acquireFenceHandle = h;
297 }
298
Marissa Wall1e779252018-12-29 12:01:57 -0800299 YCbCrLayout layout;
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700300 Error error;
301 auto ret = mMapper->lockYCbCr(buffer, usage, accessRegion,
302 acquireFenceHandle,
303 [&](const auto& tmpError, const auto& tmpLayout)
304 {
305 error = tmpError;
306 if (error != Error::NONE) {
307 return;
308 }
309
Marissa Wall1e779252018-12-29 12:01:57 -0800310 layout = tmpLayout;
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700311 });
312
Marissa Wall1e779252018-12-29 12:01:57 -0800313 if (error == Error::NONE) {
314 ycbcr->y = layout.y;
315 ycbcr->cb = layout.cb;
316 ycbcr->cr = layout.cr;
317 ycbcr->ystride = static_cast<size_t>(layout.yStride);
318 ycbcr->cstride = static_cast<size_t>(layout.cStride);
319 ycbcr->chroma_step = static_cast<size_t>(layout.chromaStep);
320 }
321
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700322 // we own acquireFence even on errors
323 if (acquireFence >= 0) {
324 close(acquireFence);
325 }
326
Marissa Wall1e779252018-12-29 12:01:57 -0800327 return static_cast<status_t>((ret.isOk()) ? error : kTransactionError);
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700328}
329
Marissa Walld380e2c2018-12-29 14:17:29 -0800330int Gralloc2Mapper::unlock(buffer_handle_t bufferHandle) const {
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700331 auto buffer = const_cast<native_handle_t*>(bufferHandle);
332
333 int releaseFence = -1;
334 Error error;
335 auto ret = mMapper->unlock(buffer,
336 [&](const auto& tmpError, const auto& tmpReleaseFence)
337 {
338 error = tmpError;
339 if (error != Error::NONE) {
340 return;
341 }
342
343 auto fenceHandle = tmpReleaseFence.getNativeHandle();
344 if (fenceHandle && fenceHandle->numFds == 1) {
345 int fd = dup(fenceHandle->data[0]);
346 if (fd >= 0) {
347 releaseFence = fd;
348 } else {
349 ALOGD("failed to dup unlock release fence");
350 sync_wait(fenceHandle->data[0], -1);
351 }
352 }
353 });
354
Marissa Wall1e779252018-12-29 12:01:57 -0800355 error = (ret.isOk()) ? error : kTransactionError;
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700356 if (error != Error::NONE) {
357 ALOGE("unlock(%p) failed with %d", buffer, error);
358 }
359
360 return releaseFence;
361}
362
Marissa Walld380e2c2018-12-29 14:17:29 -0800363Gralloc2Allocator::Gralloc2Allocator(const Gralloc2Mapper& mapper) : mMapper(mapper) {
Chia-I Wucb8405e2017-04-17 15:20:19 -0700364 mAllocator = IAllocator::getService();
365 if (mAllocator == nullptr) {
Marissa Wall925bf7f2018-12-29 14:27:11 -0800366 ALOGW("allocator 2.x is not supported");
367 return;
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700368 }
369}
370
Valerie Hau250c6542019-01-31 14:23:43 -0800371bool Gralloc2Allocator::isLoaded() const {
Marissa Wall925bf7f2018-12-29 14:27:11 -0800372 return mAllocator != nullptr;
373}
374
Marissa Wall22b2de12019-12-02 18:11:43 -0800375std::string Gralloc2Allocator::dumpDebugInfo(bool /*less*/) const {
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700376 std::string debugInfo;
377
378 mAllocator->dumpDebugInfo([&](const auto& tmpDebugInfo) {
379 debugInfo = tmpDebugInfo.c_str();
380 });
381
382 return debugInfo;
383}
384
Marissa Wall22b2de12019-12-02 18:11:43 -0800385status_t Gralloc2Allocator::allocate(std::string /*requestorName*/, uint32_t width, uint32_t height,
386 PixelFormat format, uint32_t layerCount, uint64_t usage,
387 uint32_t bufferCount, uint32_t* outStride,
388 buffer_handle_t* outBufferHandles, bool importBuffers) const {
Marissa Wall1e779252018-12-29 12:01:57 -0800389 IMapper::BufferDescriptorInfo descriptorInfo = {};
390 descriptorInfo.width = width;
391 descriptorInfo.height = height;
392 descriptorInfo.layerCount = layerCount;
393 descriptorInfo.format = static_cast<hardware::graphics::common::V1_1::PixelFormat>(format);
394 descriptorInfo.usage = usage;
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700395
Marissa Wall1e779252018-12-29 12:01:57 -0800396 BufferDescriptor descriptor;
397 status_t error = mMapper.createDescriptor(static_cast<void*>(&descriptorInfo),
398 static_cast<void*>(&descriptor));
399 if (error != NO_ERROR) {
400 return error;
401 }
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700402
Marissa Wall1e779252018-12-29 12:01:57 -0800403 auto ret = mAllocator->allocate(descriptor, bufferCount,
404 [&](const auto& tmpError, const auto& tmpStride,
405 const auto& tmpBuffers) {
406 error = static_cast<status_t>(tmpError);
407 if (tmpError != Error::NONE) {
408 return;
409 }
410
Marissa Wallbfcf81f2019-11-27 10:36:29 -0800411 if (importBuffers) {
412 for (uint32_t i = 0; i < bufferCount; i++) {
413 error = mMapper.importBuffer(tmpBuffers[i],
414 &outBufferHandles[i]);
415 if (error != NO_ERROR) {
416 for (uint32_t j = 0; j < i; j++) {
417 mMapper.freeBuffer(outBufferHandles[j]);
418 outBufferHandles[j] = nullptr;
419 }
420 return;
Marissa Wall1e779252018-12-29 12:01:57 -0800421 }
Marissa Wallbfcf81f2019-11-27 10:36:29 -0800422 }
423 } else {
424 for (uint32_t i = 0; i < bufferCount; i++) {
425 outBufferHandles[i] = native_handle_clone(
426 tmpBuffers[i].getNativeHandle());
427 if (!outBufferHandles[i]) {
428 for (uint32_t j = 0; j < i; j++) {
429 auto buffer = const_cast<native_handle_t*>(
430 outBufferHandles[j]);
431 native_handle_close(buffer);
432 native_handle_delete(buffer);
433 outBufferHandles[j] = nullptr;
434 }
435 }
Marissa Wall1e779252018-12-29 12:01:57 -0800436 }
437 }
Marissa Wall1e779252018-12-29 12:01:57 -0800438 *outStride = tmpStride;
439 });
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700440
Chia-I Wud8091b92017-05-16 14:30:34 -0700441 // make sure the kernel driver sees BC_FREE_BUFFER and closes the fds now
442 hardware::IPCThreadState::self()->flushCommands();
443
Marissa Wall1e779252018-12-29 12:01:57 -0800444 return (ret.isOk()) ? error : static_cast<status_t>(kTransactionError);
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700445}
446
Chia-I Wu5bac7f32017-04-06 12:34:32 -0700447} // namespace android