Allow extending the SurfacePackage lifetime

Caller may need to keep the SurfacePackage alive after attaching it
to a SurfaceView. We allow this by creating a copy of the
SurfaceControl inside the SurfacePackage. Since the native layer
handle is ref counted, this will keep the encapsulated Surface hierarchy
alive after it has been released by SurfaceView.

Bug: 182838860
Test: atest SurfaceControlViewHostTests
Change-Id: I49e228b561d7aca23691d683747edc5365fc4206
2 files changed