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

Commit ce3d1106 authored by Andy Hung's avatar Andy Hung
Browse files

AudioSystem: new service cache reduces ANRs and improves performance.

Reduced ANRs:
1) Do not block on AudioFlinger or AudioPolicy for more than 10 seconds
to prevent ANRs.  Audioserver failure is returned to the AudioService which
can be ignored as the ground truth is stored in AudioService and
audioserver is currently dead.

2) Always check for audio services upon each thread request to avoid
ServiceManager notification failure when ThreadPool is locked up.

Improved performance:
1) Trigger actions based on binder driver death notifications and
ServiceManager service notifications, saves about 300ms on Track restore.

2) Single notification handling is shared among all clients.

Flag: EXEMPT bugfix
Test: instrumented audioserver delay, audio setting responsiveness
Test: instrumented audioserver delay, avoid ANR (see bug).
Test: hotword service works
Test: atest powerstats_collector_tests
Bug: 372348587
Change-Id: Ifd5b5457f4ca181ed30b6aea7ed4effad7aebef5
parent d9567a3f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -37,12 +37,16 @@ cc_fuzz {
    ],
    shared_libs: [
        "com.android.media.aaudio-aconfig-cc",
        "libaconfig_storage_read_api_cc",
        "libaudio_aidl_conversion_common_cpp",
        "libaudioclient_aidl_conversion",
        "libaudiomanager",
        "libaudiopolicy",
        "libbinder",
        "libbinder_ndk",
        "libmediautils",
        "libutils",
        "server_configurable_flags",
    ],
    static_libs: [
        "aaudio-aidl-cpp",
+0 −5
Original line number Diff line number Diff line
@@ -1577,11 +1577,6 @@ status_t AudioRecord::restoreRecord_l(const char *from)
    const int INITIAL_RETRIES = 3;
    int retries = INITIAL_RETRIES;
retry:
    if (retries < INITIAL_RETRIES) {
        // refresh the audio configuration cache in this process to make sure we get new
        // input parameters and new IAudioRecord in createRecord_l()
        AudioSystem::clearAudioConfigCache();
    }
    mFlags = mOrigFlags;

    // if the new IAudioRecord is created, createRecord_l() will modify the