Revert "ViewRootImpl: Fix child lifetime."

This reverts commit ba29dbc3b38d9efb743d6fa7f9f8c4bb75c38b28.

The original commit causes apps such as phone and clock to not wake the
device.

Fixes: 37197491
Change-Id: I1b45cafbcbf12991d8e1e716e4d1751cd077c556
(cherry picked from commit 16e5089eb5b58fb065ec05ee8a6afe229f48bf50)
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 31911cb..076b33c 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -683,8 +683,7 @@
                     mTranslator.translateRectInAppWindowToScreen(mScreenRect);
                 }
 
-                if (mSurfaceControl != null
-                        && (!isHardwareAccelerated() || !mRtHandlingPositionUpdates)) {
+                if (!isHardwareAccelerated() || !mRtHandlingPositionUpdates) {
                     try {
                         if (DEBUG) Log.d(TAG, String.format("%d updateSurfacePosition UI, " +
                                 "postion = [%d, %d, %d, %d]", System.identityHashCode(this),
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 4a7b16e..58ef0af 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1249,13 +1249,6 @@
         mIsAmbientMode = ambient;
     }
 
-    void setWindowVisibility(int visibility) {
-        if (visibility != mAttachInfo.mWindowVisibility) {
-            mAttachInfo.mWindowVisibility = visibility;
-            mView.dispatchWindowVisibilityChanged(visibility);
-        }
-    }
-
     void setWindowStopped(boolean stopped) {
         if (mStopped != stopped) {
             mStopped = stopped;
@@ -1270,7 +1263,6 @@
                 if (renderer != null) {
                     renderer.destroyHardwareResources(mView);
                 }
-                mView.dispatchWindowVisibilityChanged(View.GONE);
             }
         }
     }
@@ -1305,8 +1297,7 @@
     }
 
     int getHostVisibility() {
-        return (mAppVisible || mForceDecorViewVisibility) && !mStopped
-            ? mView.getVisibility() : View.GONE;
+        return (mAppVisible || mForceDecorViewVisibility) ? mView.getVisibility() : View.GONE;
     }
 
     /**
@@ -1663,8 +1654,8 @@
         }
 
         if (viewVisibilityChanged) {
-            setWindowVisibility(viewVisibility);
-
+            mAttachInfo.mWindowVisibility = viewVisibility;
+            host.dispatchWindowVisibilityChanged(viewVisibility);
             if (viewUserVisibilityChanged) {
                 host.dispatchVisibilityAggregated(viewVisibility == View.VISIBLE);
             }