Surface: Allow nullable IGBPs when unparceling a Surface
We will write a null IGBP, so we shouldn't error out when reading one;
leave semantics of that to higher-level code.
Test: No camera crash after lots of front-back camera switches
Bug: 31373143
Change-Id: I5f7cf7489aca721057c5731e3a79cf6f8f260774
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index ab223ff..a0a742c 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -1393,14 +1393,18 @@
int isSingleBuffered;
res = parcel->readInt32(&isSingleBuffered);
if (res != OK) {
+ ALOGE("Can't read isSingleBuffered");
return res;
}
}
sp<IBinder> binder;
- res = parcel->readStrongBinder(&binder);
- if (res != OK) return res;
+ res = parcel->readNullableStrongBinder(&binder);
+ if (res != OK) {
+ ALOGE("%s: Can't read strong binder", __FUNCTION__);
+ return res;
+ }
graphicBufferProducer = interface_cast<IGraphicBufferProducer>(binder);