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

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

Merge "AudioTrack: fix default low power mode selection" into qt-qpr1-dev

am: 38dcecea

Change-Id: Iff06ef6996eb8f410432272ea44c6aa118fd2aa0
parents 5646200b 38dcecea
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -1184,8 +1184,15 @@ public class AudioTrack extends PlayerBase
            int bufferSizeInBytes, int mode) {
            int bufferSizeInBytes, int mode) {
        // If no attributes, OK
        // If no attributes, OK
        // otherwise check attributes for USAGE_MEDIA and CONTENT_UNKNOWN, MUSIC, or MOVIE.
        // otherwise check attributes for USAGE_MEDIA and CONTENT_UNKNOWN, MUSIC, or MOVIE.
        // Only consider flags that are not compatible with FLAG_DEEP_BUFFER. We include
        // FLAG_DEEP_BUFFER because if set the request is explicit and
        // shouldEnablePowerSaving() should return false.
        final int flags = attributes.getAllFlags()
                & (AudioAttributes.FLAG_DEEP_BUFFER | AudioAttributes.FLAG_LOW_LATENCY
                    | AudioAttributes.FLAG_HW_AV_SYNC | AudioAttributes.FLAG_BEACON);

        if (attributes != null &&
        if (attributes != null &&
                (attributes.getAllFlags() != 0  // cannot have any special flags
                (flags != 0  // cannot have any special flags
                || attributes.getUsage() != AudioAttributes.USAGE_MEDIA
                || attributes.getUsage() != AudioAttributes.USAGE_MEDIA
                || (attributes.getContentType() != AudioAttributes.CONTENT_TYPE_UNKNOWN
                || (attributes.getContentType() != AudioAttributes.CONTENT_TYPE_UNKNOWN
                    && attributes.getContentType() != AudioAttributes.CONTENT_TYPE_MUSIC
                    && attributes.getContentType() != AudioAttributes.CONTENT_TYPE_MUSIC