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

Commit 5b38eb30 authored by Phil Burk's avatar Phil Burk
Browse files

audioserver: enable AAudioService for MR1

Another CL in OC-DEV may have turned it off.
This was added to resolve merge conflicts and to
only enable AAudioService when supported by the vendor.

Bug: 65280854
Bug: 65262790
Test: Enter  adb shell setprop aaudio.mmap_policy 1
Test: Enter  adb shell killall audioserver
Test: Enter  adb shell dumpsys media.aaudio
Test: It should print "Can't find service: media.aaudio".
Test: Enter  adb shell setprop aaudio.mmap_policy 2
Test: Enter  adb shell killall audioserver
Test: Enter  adb shell dumpsys media.aaudio
Test: It should print a short dump because the service is running.

Change-Id: Ic68d136c99c16134aa704495311ab25285fd76a9
parent 01fc3aee
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -32,9 +32,11 @@
#include <hwbinder/ProcessState.h>

// from LOCAL_C_INCLUDES
#include "aaudio/AAudioTesting.h"
#include "AudioFlinger.h"
#include "AudioPolicyService.h"
#include "AAudioService.h"
#include "utility/AAudioUtilities.h"
#include "MediaLogService.h"
#include "SoundTriggerHwService.h"

@@ -131,7 +133,16 @@ int main(int argc __unused, char **argv)
        ALOGI("ServiceManager: %p", sm.get());
        AudioFlinger::instantiate();
        AudioPolicyService::instantiate();

        // AAudioService should only be used in OC-MR1 and later.
        // And only enable the AAudioService if the system MMAP policy explicitly allows it.
        // This prevents a client from misusing AAudioService when it is not supported.
        aaudio_policy_t mmapPolicy = property_get_int32(AAUDIO_PROP_MMAP_POLICY,
                                                        AAUDIO_POLICY_NEVER);
        if (mmapPolicy == AAUDIO_POLICY_AUTO || mmapPolicy == AAUDIO_POLICY_ALWAYS) {
            AAudioService::instantiate();
        }

        SoundTriggerHwService::instantiate();
        ProcessState::self()->startThreadPool();