Merge "ImageWriter: Check Surface is valid before use" into main