Apply synced relayout if we have FLAG_WINDOW_VISIBILITY_CHANGED

The client needs to call relayout to get the valid surface if
- mFirst,
- mViewVisibility != viewVisibility,
- mNewSurfaceNeeded, or
- mAppVisibilityChanged.

We didn't cover mNewSurfaceNeeded or mAppVisibilityChanged previously.
All of them are covered by FLAG_WINDOW_VISIBILITY_CHANGED.

Bug: 244521023
Bug: 161810301
Test: 1. Enable LOCAL_LAYOUT
      2. Open Camera and double press the power button.
      See if the preview screen of Camera become blank.
Change-Id: I37fb8ffc9063b72bf3abba5d29fc2f750e7fc64f
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index ec6b4ac..108d177 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -8085,7 +8085,8 @@
         final int measuredWidth = mView.getMeasuredWidth();
         final int measuredHeight = mView.getMeasuredHeight();
         final boolean relayoutAsync;
-        if (LOCAL_LAYOUT && !mFirst && viewVisibility == mViewVisibility
+        if (LOCAL_LAYOUT
+                && (mViewFrameInfo.flags & FrameInfo.FLAG_WINDOW_VISIBILITY_CHANGED) == 0
                 && mWindowAttributes.type != TYPE_APPLICATION_STARTING
                 && mSyncSeqId <= mLastSyncSeqId
                 && winConfigFromAm.diff(winConfigFromWm, false /* compareUndefined */) == 0) {