audioserver: Initialize services before making public.

This avoids inconsistencies and TimeCheck aborts when
the AudioFlinger interface is made public before
AudioPolicy is initialized.

Test: boot, check logcat, kill audioserver, check logcat
Bug: 240234432
Bug: 262821105
Merged-In: I2259105eb86110fafe4e3d7ba5820f6557382447
Change-Id: I2259105eb86110fafe4e3d7ba5820f6557382447
(cherry picked from commit 1d312b975483e6fc4f4b50c09707c49b60b19414)
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 9079be9..769a997 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -131,6 +131,7 @@
 
 class AudioFlinger : public AudioFlingerServerAdapter::Delegate
 {
+    friend class sp<AudioFlinger>;
 public:
     static void instantiate() ANDROID_API;