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

Commit acf7ba39 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

audio: Convert getDevicesForStream to return a DeviceTypeSet

As a pre-requisite for switching from 'int' to
'AudioDeviceDescription' in the framework AIDL interfaces,
get rid of the usage of 'int' as a mask of 'audio_devices_t'
values. This is needed because 'AudioDeviceDescription'
can't be coerced into an int directly, and interpreting
a mask of multiple 'audio_devices_t' values is ambiguous
due to presence of multi-bit device types.

Note that at the Java layer the returned DeviceTypeSet
is still collapsed into a single integer value. This needs
to be addressed separately.

Bug: 188932434
Test: check audio on device
Change-Id: I487d8144f10fce4d5353d50e46cc44e67ab6ff3b
parent 2600aaf2
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@

#include <android/media/AudioVibratorInfo.h>
#include <audiomanager/AudioManager.h>
#include <media/AudioContainers.h>
#include <media/AudioPolicy.h>
#include <media/AudioSystem.h>
#include <media/MicrophoneInfo.h>
@@ -812,7 +813,8 @@ android_media_AudioSystem_getMasterBalance(JNIEnv *env, jobject thiz)
static jint
android_media_AudioSystem_getDevicesForStream(JNIEnv *env, jobject thiz, jint stream)
{
    return (jint) AudioSystem::getDevicesForStream(static_cast <audio_stream_type_t>(stream));
    return (jint)deviceTypesToBitMask(
            AudioSystem::getDevicesForStream(static_cast<audio_stream_type_t>(stream)));
}

static jint