Ensure MediaSession2Record is initialized before used

NPE happens at mController.close() if session is destroyed while the
MediaController2 instance is being created in the constructor of
MediaSession2Record. It ensures the MediaSession2Record instance is
initialized before the instance is used by Controller2Callback.

Bug: 189119798
Fix: 189119798
Test: atest CtsMediaTestCases:android.media.cts.MediaSessionTest
Change-Id: I23ca2f3dbc657ac38f4154a0fb428a4c25e6b5ad
1 file changed