audio policy: add audio policy ready flag.
The audio policy ready flag indicates that audio policy manager
intialization is done and that audioflinger can call back
into audio policy service without risk of deadlocking because the
service is not published yet.
Bug: 188502620
Test: boot and kill native audioserver process.
Change-Id: I671ed0aadd0c51342be5b57d1afb7577da6a7fa9
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index c55f4f6..e3402f9 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -269,6 +269,9 @@
/* Indicate JAVA services are ready (scheduling, power management ...) */
virtual status_t systemReady();
+ virtual status_t audioPolicyReady() { mAudioPolicyReady.store(true); return NO_ERROR; }
+ bool isAudioPolicyReady() const { return mAudioPolicyReady.load(); }
+
virtual status_t getMicrophones(std::vector<media::MicrophoneInfo> *microphones);
@@ -986,6 +989,7 @@
DeviceEffectManager mDeviceEffectManager;
bool mSystemReady;
+ std::atomic_bool mAudioPolicyReady{};
mediautils::UidInfo mUidInfo;