AudioService: wait for init completed to handle media server restart

Bug: 16458506.
Change-Id: I25804e6e7209d52fd5dd6c622cae85d1e7d2317f
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index e4102e9..ef42549 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -3756,7 +3756,8 @@
                     break;
 
                 case MSG_MEDIA_SERVER_DIED:
-                    if (AudioSystem.checkAudioFlinger() != AudioSystem.AUDIO_STATUS_OK) {
+                    if (!mSystemReady ||
+                            (AudioSystem.checkAudioFlinger() != AudioSystem.AUDIO_STATUS_OK)) {
                         Log.e(TAG, "Media server died.");
                         sendMsg(mAudioHandler, MSG_MEDIA_SERVER_DIED, SENDMSG_NOOP, 0, 0,
                                 null, 500);