Merge "nativewindow: report errors on error to allocate a handle" am: 04a1d0ddfe am: 2bb81b0c10 am: 280bc1fcc6

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1555466

Change-Id: I63d5d1b1970f54bf7b0b15dd82e2409c318c2211
This commit is contained in:
Treehugger Robot 2021-03-23 22:37:44 +00:00 committed by Automerger Merge Worker
commit 4fadb9e566

View file

@ -51,13 +51,13 @@ int AHardwareBuffer_allocate(const AHardwareBuffer_Desc* desc, AHardwareBuffer**
std::string("AHardwareBuffer pid [") + std::to_string(getpid()) + "]"));
status_t err = gbuffer->initCheck();
if (err != 0 || gbuffer->handle == 0) {
if (err != 0 || gbuffer->handle == nullptr) {
if (err == NO_MEMORY) {
GraphicBuffer::dumpAllocationsToSystemLog();
}
ALOGE("GraphicBuffer(w=%u, h=%u, lc=%u) failed (%s), handle=%p",
desc->width, desc->height, desc->layers, strerror(-err), gbuffer->handle);
return err;
return err == 0 ? UNKNOWN_ERROR : err;
}
*outBuffer = AHardwareBuffer_from_GraphicBuffer(gbuffer.get());