Fix bugs with takeSurface and preserveWindows.

When reusing a ViewRoot and DecorView as we do with preserveWindows
there are two issues with SurfaceHolders.  First, we update the
SurfaceHolder callbacks when we call ViewRootImpl.setView. In the
case of preserved window relaunch, the DecorView is reused and there is
no call to setView. We need the ActivityThread to notify the ViewRoot
that something has changed. Secondly, we were assuming the only time
a new surface would be created for the purposes of SurfaceHolder
notification was when we previously did not have a valid surface.
Instead we need to check if the native Surface object has changed each time we
get a result from relayout.

Bug: 28331264
Change-Id: If1b4aab9b2ba579fa040e2a3ab4471842476d82f
2 files changed