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

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

Merge "audioserver: Fix boottime delay due to priority boost" into main

parents d075118d 8e8a4b9e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@ service audioserver /system/bin/audioserver
    # media gid needed for /dev/fm (radio) and for /data/misc/media (tee)
    group audio camera drmrpc media mediadrm net_bt net_bt_admin net_bw_acct wakelock
    capabilities BLOCK_SUSPEND
    # match rtprio cur / max with sensor service as we handle AR/VR HID sensor data.
    rlimit rtprio 10 10
    ioprio rt 4
    task_profiles ProcessCapacityHigh HighPerformance
    onrestart restart vendor.audio-hal
+11 −0
Original line number Diff line number Diff line
@@ -17,7 +17,9 @@
#define LOG_TAG "SchedulingPolicyService"
//#define LOG_NDEBUG 0

#include <audio_utils/threads.h>
#include <binder/IServiceManager.h>
#include <cutils/android_filesystem_config.h>
#include <cutils/properties.h>
#include <utils/Mutex.h>
#include "ISchedulingPolicyService.h"
@@ -31,6 +33,15 @@ static Mutex sMutex;

int requestPriority(pid_t pid, pid_t tid, int32_t prio, bool isForApp, bool asynchronous)
{
    // audioserver thread priority boosted internally to reduce binder latency and boot time.
    if (!isForApp && pid == getpid() && getuid() == AID_AUDIOSERVER && prio >= 1 && prio <= 3) {
        const status_t status = audio_utils::set_thread_priority(
                tid, audio_utils::rtprio_to_unified_priority(prio));
        if (status == NO_ERROR) return NO_ERROR;
        ALOGD("%s: set priority %d, status:%d needs to fallback to SchedulingPolicyService",
                __func__, prio, status);
    }

    // FIXME merge duplicated code related to service lookup, caching, and error recovery
    int ret;
    for (;;) {