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

Commit 5ae9280b authored by Eric Laurent's avatar Eric Laurent Committed by android-build-merger
Browse files

Merge "audio: fix talkback why alarm is playing" into lmp-mr1-dev

automerge: 461b02d3

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


    // usage to stream type mapping
    // usage to stream type mapping
    switch (aa.usage) {
    switch (aa.usage) {
    case AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY:
    case AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY: {
        // TODO once AudioPolicyManager fully supports audio_attributes_t,
        // TODO once AudioPolicyManager fully supports audio_attributes_t,
        //   remove stream change based on phone state
        //   remove stream change based on stream activity
        if (AudioSystem::getPhoneState() == AUDIO_MODE_RINGTONE) {
        bool active;
        status_t status = AudioSystem::isStreamActive(AUDIO_STREAM_RING, &active, 0);
        if (status == NO_ERROR && active == true) {
            mStreamType = AUDIO_STREAM_RING;
            mStreamType = AUDIO_STREAM_RING;
            break;
            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_MEDIA:
    case AUDIO_USAGE_GAME:
    case AUDIO_USAGE_GAME:
    case AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE:
    case AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE: