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

Commit de33485a authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

AudioAttributes: deprecate unused notification usages

Deprecate unused notification usages that are handled the same
way as USAGE_NOTIFICATION. This also brings to parity available
usages for notifications between Java SDK and AAudio.

Bug: 197890470
Test: atest AudioAttributesTest
Change-Id: I031d173d6967895a142547ac5431a17f7d9f7865
parent 79a67bac
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -20232,9 +20232,9 @@ package android.media {
    field public static final int USAGE_GAME = 14; // 0xe
    field public static final int USAGE_MEDIA = 1; // 0x1
    field public static final int USAGE_NOTIFICATION = 5; // 0x5
    field public static final int USAGE_NOTIFICATION_COMMUNICATION_DELAYED = 9; // 0x9
    field public static final int USAGE_NOTIFICATION_COMMUNICATION_INSTANT = 8; // 0x8
    field public static final int USAGE_NOTIFICATION_COMMUNICATION_REQUEST = 7; // 0x7
    field @Deprecated public static final int USAGE_NOTIFICATION_COMMUNICATION_DELAYED = 9; // 0x9
    field @Deprecated public static final int USAGE_NOTIFICATION_COMMUNICATION_INSTANT = 8; // 0x8
    field @Deprecated public static final int USAGE_NOTIFICATION_COMMUNICATION_REQUEST = 7; // 0x7
    field public static final int USAGE_NOTIFICATION_EVENT = 10; // 0xa
    field public static final int USAGE_NOTIFICATION_RINGTONE = 6; // 0x6
    field public static final int USAGE_UNKNOWN = 0; // 0x0
+20 −4
Original line number Diff line number Diff line
@@ -139,19 +139,28 @@ public final class AudioAttributes implements Parcelable {
     */
    public final static int USAGE_NOTIFICATION_RINGTONE = 6;
    /**
     * @deprecated Use {@link #USAGE_NOTIFICATION} which is handled
     *             the same way as this usage by the audio framework
     * Usage value to use when the usage is a request to enter/end a
     * communication, such as a VoIP communication or video-conference.
     */
    @Deprecated
    public final static int USAGE_NOTIFICATION_COMMUNICATION_REQUEST = 7;
    /**
     * @deprecated Use {@link #USAGE_NOTIFICATION} which is handled
     *             the same way as this usage by the audio framework
     * Usage value to use when the usage is notification for an "instant"
     * communication such as a chat, or SMS.
     */
    @Deprecated
    public final static int USAGE_NOTIFICATION_COMMUNICATION_INSTANT = 8;
    /**
     * @deprecated Use {@link #USAGE_NOTIFICATION} which is handled
     *             the same way as this usage by the audio framework
     * Usage value to use when the usage is notification for a
     * non-immediate type of communication such as e-mail.
     */
    @Deprecated
    public final static int USAGE_NOTIFICATION_COMMUNICATION_DELAYED = 9;
    /**
     * Usage value to use when the usage is to attract the user's attention,
@@ -726,6 +735,17 @@ public final class AudioAttributes implements Parcelable {
                }
            }

            // handle deprecation of notification usages by remapping to USAGE_NOTIFICATION
            switch (aa.mUsage) {
                case USAGE_NOTIFICATION_COMMUNICATION_REQUEST:
                case USAGE_NOTIFICATION_COMMUNICATION_INSTANT:
                case USAGE_NOTIFICATION_COMMUNICATION_DELAYED:
                    aa.mUsage = USAGE_NOTIFICATION;
                    break;
                default:
                    break;
            }

            aa.mSource = mSource;
            aa.mFlags = mFlags;
            if (mMuteHapticChannels) {
@@ -757,7 +777,6 @@ public final class AudioAttributes implements Parcelable {
                    && (mFlags & FLAG_HW_HOTWORD) == FLAG_HW_HOTWORD) {
                aa.mFlags &= ~FLAG_HW_HOTWORD;
            }

            return aa;
        }

@@ -770,9 +789,6 @@ public final class AudioAttributes implements Parcelable {
         *     {@link AttributeSdkUsage#USAGE_VOICE_COMMUNICATION_SIGNALLING},
         *     {@link AttributeSdkUsage#USAGE_ALARM}, {@link AudioAttributes#USAGE_NOTIFICATION},
         *     {@link AttributeSdkUsage#USAGE_NOTIFICATION_RINGTONE},
         *     {@link AttributeSdkUsage#USAGE_NOTIFICATION_COMMUNICATION_REQUEST},
         *     {@link AttributeSdkUsage#USAGE_NOTIFICATION_COMMUNICATION_INSTANT},
         *     {@link AttributeSdkUsage#USAGE_NOTIFICATION_COMMUNICATION_DELAYED},
         *     {@link AttributeSdkUsage#USAGE_NOTIFICATION_EVENT},
         *     {@link AttributeSdkUsage#USAGE_ASSISTANT},
         *     {@link AttributeSdkUsage#USAGE_ASSISTANCE_ACCESSIBILITY},