Fix reading NULL Surfaces from Parcels

Writing a NULL Surface was being read as a non-NULL Surface with NULL
mGraphicBufferProducer. Before the SurfaceTextureClient -> Surface
refactoring, you'd get a NULL Surface, and some code relies on that.

Bug: 8291161
Change-Id: I477bfe8882693e53a5f604a3d2c9e3cfe24473b4
This commit is contained in:
Jesse Hall 2013-03-02 16:25:32 -08:00
parent bbb57f3331
commit 006a601f22

View File

@ -735,7 +735,7 @@ status_t Surface::writeToParcel(
sp<Surface> Surface::readFromParcel(const Parcel& data) {
sp<IBinder> binder(data.readStrongBinder());
sp<IGraphicBufferProducer> bp(interface_cast<IGraphicBufferProducer>(binder));
return new Surface(bp);
return bp != NULL ? new Surface(bp): NULL;
}
// ----------------------------------------------------------------------------