Camera: Check whether the preview surface is valid

The preview surface view can sometimes be re-used in case
its current size matches. However in some scenario the preview
surface itself can be re-created and the test case could
try to use the non-valid instance.
Check whether the current preview surface is valid before
trying to re-use it.

Bug: 298242153
Test: atest -c -d cts/tests/camera/src/android/hardware/camera2/cts/FastBasicsTest.java#testCamera2 --iterations=10
Change-Id: Id5386ee528ca4c7079fc15859ff189a8c1af6d89
1 file changed