Loading AconfigFlags.bp +4 −1 Original line number Diff line number Diff line Loading @@ -428,7 +428,10 @@ java_aconfig_library { aconfig_declarations { name: "com.android.media.flags.bettertogether-aconfig", package: "com.android.media.flags", srcs: ["media/java/android/media/flags/media_better_together.aconfig"], srcs: [ "media/java/android/media/flags/media_better_together.aconfig", "media/java/android/media/flags/fade_manager_configuration.aconfig", ], } java_aconfig_library { Loading media/java/android/media/AudioAttributes.java +34 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.util.IntArray; import android.util.Log; import android.util.SparseIntArray; import android.util.proto.ProtoOutputStream; Loading Loading @@ -330,7 +331,7 @@ public final class AudioAttributes implements Parcelable { * @hide * Array of all usage types exposed in the SDK that applications can use. */ public final static int[] SDK_USAGES = { public static final IntArray SDK_USAGES = IntArray.wrap(new int[] { USAGE_UNKNOWN, USAGE_MEDIA, USAGE_VOICE_COMMUNICATION, Loading @@ -347,14 +348,14 @@ public final class AudioAttributes implements Parcelable { USAGE_ASSISTANCE_SONIFICATION, USAGE_GAME, USAGE_ASSISTANT, }; }); /** * @hide */ @TestApi public static int[] getSdkUsages() { return SDK_USAGES; return SDK_USAGES.toArray(); } /** Loading Loading @@ -567,6 +568,15 @@ public final class AudioAttributes implements Parcelable { private String mFormattedTags; private Bundle mBundle; // lazy-initialized, may be null /** Array of all content types exposed in the SDK that applications can use */ private static final IntArray CONTENT_TYPES = IntArray.wrap(new int[]{ CONTENT_TYPE_UNKNOWN, CONTENT_TYPE_SPEECH, CONTENT_TYPE_MUSIC, CONTENT_TYPE_MOVIE, CONTENT_TYPE_SONIFICATION, }); private AudioAttributes() { } Loading Loading @@ -1668,6 +1678,27 @@ public final class AudioAttributes implements Parcelable { || usage == USAGE_ANNOUNCEMENT); } /** * Query if the usage is a valid sdk usage * * @param usage one of {@link AttributeSdkUsage} * @return {@code true} if the usage is valid for sdk or {@code false} otherwise * @hide */ public static boolean isSdkUsage(@AttributeSdkUsage int usage) { return SDK_USAGES.contains(usage); } /** * Query if the content type is a valid sdk content type * @param contentType one of {@link AttributeContentType} * @return {@code true} if the content type is valid for sdk or {@code false} otherwise * @hide */ public static boolean isSdkContentType(@AttributeContentType int contentType) { return CONTENT_TYPES.contains(contentType); } /** * Returns the stream type matching this {@code AudioAttributes} instance for volume control. * Use this method to derive the stream type needed to configure the volume Loading media/java/android/media/FadeManagerConfiguration.aidl 0 → 100644 +23 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.media; /** * Class to encapsulate fade configurations. * @hide */ parcelable FadeManagerConfiguration; Loading
AconfigFlags.bp +4 −1 Original line number Diff line number Diff line Loading @@ -428,7 +428,10 @@ java_aconfig_library { aconfig_declarations { name: "com.android.media.flags.bettertogether-aconfig", package: "com.android.media.flags", srcs: ["media/java/android/media/flags/media_better_together.aconfig"], srcs: [ "media/java/android/media/flags/media_better_together.aconfig", "media/java/android/media/flags/fade_manager_configuration.aconfig", ], } java_aconfig_library { Loading
media/java/android/media/AudioAttributes.java +34 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.util.IntArray; import android.util.Log; import android.util.SparseIntArray; import android.util.proto.ProtoOutputStream; Loading Loading @@ -330,7 +331,7 @@ public final class AudioAttributes implements Parcelable { * @hide * Array of all usage types exposed in the SDK that applications can use. */ public final static int[] SDK_USAGES = { public static final IntArray SDK_USAGES = IntArray.wrap(new int[] { USAGE_UNKNOWN, USAGE_MEDIA, USAGE_VOICE_COMMUNICATION, Loading @@ -347,14 +348,14 @@ public final class AudioAttributes implements Parcelable { USAGE_ASSISTANCE_SONIFICATION, USAGE_GAME, USAGE_ASSISTANT, }; }); /** * @hide */ @TestApi public static int[] getSdkUsages() { return SDK_USAGES; return SDK_USAGES.toArray(); } /** Loading Loading @@ -567,6 +568,15 @@ public final class AudioAttributes implements Parcelable { private String mFormattedTags; private Bundle mBundle; // lazy-initialized, may be null /** Array of all content types exposed in the SDK that applications can use */ private static final IntArray CONTENT_TYPES = IntArray.wrap(new int[]{ CONTENT_TYPE_UNKNOWN, CONTENT_TYPE_SPEECH, CONTENT_TYPE_MUSIC, CONTENT_TYPE_MOVIE, CONTENT_TYPE_SONIFICATION, }); private AudioAttributes() { } Loading Loading @@ -1668,6 +1678,27 @@ public final class AudioAttributes implements Parcelable { || usage == USAGE_ANNOUNCEMENT); } /** * Query if the usage is a valid sdk usage * * @param usage one of {@link AttributeSdkUsage} * @return {@code true} if the usage is valid for sdk or {@code false} otherwise * @hide */ public static boolean isSdkUsage(@AttributeSdkUsage int usage) { return SDK_USAGES.contains(usage); } /** * Query if the content type is a valid sdk content type * @param contentType one of {@link AttributeContentType} * @return {@code true} if the content type is valid for sdk or {@code false} otherwise * @hide */ public static boolean isSdkContentType(@AttributeContentType int contentType) { return CONTENT_TYPES.contains(contentType); } /** * Returns the stream type matching this {@code AudioAttributes} instance for volume control. * Use this method to derive the stream type needed to configure the volume Loading
media/java/android/media/FadeManagerConfiguration.aidl 0 → 100644 +23 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.media; /** * Class to encapsulate fade configurations. * @hide */ parcelable FadeManagerConfiguration;