Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit def97eb7 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "Audio: clarify client service timeout naming" into main

parents 7375a819 a5af5074
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ sp<CaptureStateListenerImpl> AudioSystem::gSoundTriggerCaptureStateListener;
// ServiceSingleton to provide interaction with the service notifications and
// binder death notifications.
//
// If the AF/AP service is unavailable for kServiceWaitMs from ServiceManager,
// If the AF/AP service is unavailable for kServiceClientWaitMs from ServiceManager,
// ServiceSingleton will return a nullptr service handle resulting in the same dead object error
// as if the service died (which it did, otherwise we'd be returning the cached handle).
//
@@ -129,9 +129,10 @@ sp<CaptureStateListenerImpl> AudioSystem::gSoundTriggerCaptureStateListener;
//
// TODO(b/375691003) We use 10s as a conservative timeout value, and will tune closer to 3s.
// Too small a value (i.e. less than 1s would churn repeated calls to get the service).
static constexpr int32_t kServiceWaitMs = 10'000;
// The value can be tuned by the property audio.service.client_wait_ms.
static constexpr int32_t kServiceClientWaitMs = 10'000;

static constexpr const char kServiceWaitProperty[] = "audio.service.wait_ms";
static constexpr const char kServiceWaitProperty[] = "audio.service.client_wait_ms";

// AudioFlingerServiceTraits is a collection of methods that parameterize the
// ServiceSingleton handler for IAudioFlinger
@@ -172,7 +173,7 @@ public:
            }
            mediautils::initService<media::IAudioFlingerService, AudioFlingerServiceTraits>();
            mWaitMs = std::chrono::milliseconds(
                property_get_int32(kServiceWaitProperty, kServiceWaitMs));
                property_get_int32(kServiceWaitProperty, kServiceClientWaitMs));
            init = true;
        }
        if (mValid) return mService;
@@ -272,7 +273,8 @@ private:
    static inline constinit std::mutex mMutex;
    static inline constinit sp<AudioSystem::AudioFlingerClient> mClient GUARDED_BY(mMutex);
    static inline constinit sp<IAudioFlinger> mService GUARDED_BY(mMutex);
    static inline constinit std::chrono::milliseconds mWaitMs GUARDED_BY(mMutex) {kServiceWaitMs};
    static inline constinit std::chrono::milliseconds mWaitMs
            GUARDED_BY(mMutex) {kServiceClientWaitMs};
    static inline constinit bool mValid GUARDED_BY(mMutex) = false;
    static inline constinit std::atomic_bool mDisableThreadPoolStart = false;
};
@@ -1014,7 +1016,7 @@ public:
            }
            mediautils::initService<IAudioPolicyService, AudioPolicyServiceTraits>();
            mWaitMs = std::chrono::milliseconds(
                    property_get_int32(kServiceWaitProperty, kServiceWaitMs));
                    property_get_int32(kServiceWaitProperty, kServiceClientWaitMs));
            init = true;
        }
        if (mValid) return mService;
@@ -1071,7 +1073,8 @@ private:
    static inline constinit sp<AudioSystem::AudioPolicyServiceClient> mClient GUARDED_BY(mMutex);
    static inline constinit sp<IAudioPolicyService> mService GUARDED_BY(mMutex);
    static inline constinit bool mValid GUARDED_BY(mMutex) = false;
    static inline constinit std::chrono::milliseconds mWaitMs GUARDED_BY(mMutex) {kServiceWaitMs};
    static inline constinit std::chrono::milliseconds mWaitMs
            GUARDED_BY(mMutex) {kServiceClientWaitMs};
    static inline constinit std::atomic_bool mDisableThreadPoolStart = false;
};