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

Commit 3960123b authored by Alex Dadukin's avatar Alex Dadukin
Browse files

Fix AudioProductStrategy#getLegacyStreamTypeForStrategyWithAudioAttributes documentation

getLegacyStreamTypeForStrategyWithAudioAttributes never returns
AudioSystem#STREAM_DEFAULT

Bug: b/286024816
Test: N/A
Change-Id: I8c5ee67c61c40b497cf456859e9fc2257c758503
parent 79293874
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -134,9 +134,11 @@ public final class AudioProductStrategy implements Parcelable {

    /**
     * @hide
     * @param audioAttributes to identify AudioProductStrategy with
     * @return legacy stream type associated with matched AudioProductStrategy
     *              Defaults to STREAM_MUSIC if no match is found, or if matches is STREAM_DEFAULT
     * @param audioAttributes to identify {@link AudioProductStrategy} with
     * @return legacy stream type associated with matched {@link AudioProductStrategy}. If no
     *              strategy found or found {@link AudioProductStrategy} does not have associated
     *              legacy stream (i.e. associated with {@link AudioSystem#STREAM_DEFAULT}) defaults
     *              to {@link AudioSystem#STREAM_MUSIC}
     */
    public static int getLegacyStreamTypeForStrategyWithAudioAttributes(
            @NonNull AudioAttributes audioAttributes) {
@@ -147,9 +149,9 @@ public final class AudioProductStrategy implements Parcelable {
                int streamType = productStrategy.getLegacyStreamTypeForAudioAttributes(
                        audioAttributes);
                if (streamType == AudioSystem.STREAM_DEFAULT) {
                    Log.w(TAG, "Attributes " + audioAttributes.toString() + " ported by strategy "
                            + productStrategy.getId() + " has no stream type associated, "
                            + "DO NOT USE STREAM TO CONTROL THE VOLUME");
                    Log.w(TAG, "Attributes " + audioAttributes + " supported by strategy "
                            + productStrategy.getId() + " have no associated stream type, "
                            + "therefore falling back to STREAM_MUSIC");
                    return AudioSystem.STREAM_MUSIC;
                }
                if (streamType < AudioSystem.getNumStreamTypes()) {