SF: Check ViewFrame validity before sending to hwc

Check if ViewFrame is valid before sending to hwc to make sure
composition produces valid values.

A ViewFrame can get invalid values when the framework is disconnected
which is a step necessary for some testing scenarios.

Change-Id: I2ad76061b6664dbb7d2aa3d66acaf99b880aedfe
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 33036e6..e0558ab 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1347,7 +1347,8 @@
                             }
                             // Set the view frame of each display only of its
                             // default orientation.
-                            if(orient == DisplayState::eOrientationDefault) {
+                            if(orient == DisplayState::eOrientationDefault and
+                                    state.frame.isValid()) {
                                 qdutils::setViewFrame(disp->getHwcDisplayId(),
                                     state.frame.left, state.frame.top,
                                     state.frame.right, state.frame.bottom);