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

Commit 4990e4f0 authored by Sharvil Nanavati's avatar Sharvil Nanavati
Browse files

Launch processes running under the 'bluetooth' uid with CAP_WAKE_ALARM.

This is required since bluedroid needs to set wake alarms and timers.
Going through JNI back into Java code and then across Binder to
AlarmManager is both inefficient and doesn't provide the resolution
required for functions like A2DP.

Change-Id: I619be0b18a9e7ac2567b7c68ba84fcd15eecf715
parent e4272bb3
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
#include <cutils/fs.h>
#include <cutils/multiuser.h>
#include <cutils/sched_policy.h>
#include <private/android_filesystem_config.h>
#include <utils/String8.h>
#include <selinux/android.h>
#include <processgroup/processgroup.h>
@@ -536,8 +537,15 @@ static jint com_android_internal_os_Zygote_nativeForkAndSpecialize(
        jint debug_flags, jobjectArray rlimits,
        jint mount_external, jstring se_info, jstring se_name,
        jintArray fdsToClose) {
    // Grant CAP_WAKE_ALARM to the Bluetooth process.
    jlong capabilities = 0;
    if (uid == AID_BLUETOOTH) {
        capabilities |= (1LL << CAP_WAKE_ALARM);
    }

    return ForkAndSpecializeCommon(env, uid, gid, gids, debug_flags,
            rlimits, 0, 0, mount_external, se_info, se_name, false, fdsToClose);
            rlimits, capabilities, capabilities, mount_external, se_info,
            se_name, false, fdsToClose);
}

static jint com_android_internal_os_Zygote_nativeForkSystemServer(