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

Commit 123a2dea authored by Eric Laurent's avatar Eric Laurent Committed by Android Git Automerger
Browse files

am bec72a5c: am 5ae9280b: Merge "audio: fix talkback why alarm is playing"...

am bec72a5c: am 5ae9280b: Merge "audio: fix talkback why alarm is playing" into lmp-mr1-dev automerge: 461b02d3

* commit 'bec72a5c':
  audio: fix talkback why alarm is playing
parents 59e67a3c bec72a5c
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -2135,14 +2135,21 @@ void AudioTrack::setStreamTypeFromAttributes(audio_attributes_t& aa) {

    // usage to stream type mapping
    switch (aa.usage) {
    case AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY:
    case AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY: {
        // TODO once AudioPolicyManager fully supports audio_attributes_t,
        //   remove stream change based on phone state
        if (AudioSystem::getPhoneState() == AUDIO_MODE_RINGTONE) {
        //   remove stream change based on stream activity
        bool active;
        status_t status = AudioSystem::isStreamActive(AUDIO_STREAM_RING, &active, 0);
        if (status == NO_ERROR && active == true) {
            mStreamType = AUDIO_STREAM_RING;
            break;
        }
        /// FALL THROUGH
        status = AudioSystem::isStreamActive(AUDIO_STREAM_ALARM, &active, 0);
        if (status == NO_ERROR && active == true) {
            mStreamType = AUDIO_STREAM_ALARM;
            break;
        }
    }    /// FALL THROUGH
    case AUDIO_USAGE_MEDIA:
    case AUDIO_USAGE_GAME:
    case AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE: