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

Commit 0cd20302 authored by Raj Goparaju's avatar Raj Goparaju Committed by Android (Google) Code Review
Browse files

Merge "Support configurable fade properties" into main

parents 9c10535b 7771e3b9
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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 {
+34 −3
Original line number Diff line number Diff line
@@ -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;
@@ -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,
@@ -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();
    }

    /**
@@ -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() {
    }

@@ -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
+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;
+1684 −0

File added.

Preview size limit exceeded, changes collapsed.

+8 −0
Original line number Diff line number Diff line
package: "com.android.media.flags"

flag {
    namespace: "media_solutions"
    name: "enable_fade_manager_configuration"
    description: "Enable Fade Manager Configuration support to determine fade properties"
    bug: "307354764"
}
 No newline at end of file
Loading