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

Commit 99805655 authored by Lorena Torres-Huerta's avatar Lorena Torres-Huerta Committed by Automerger Merge Worker
Browse files

Add AudioAttributes and AudioFlag for use in HAL interface for engine...

Add AudioAttributes and AudioFlag for use in HAL interface for engine configuration. am: cd5387e2 am: 2dea99e0

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19874108



Change-Id: Ie2a7ea9c03a944c71bd48b376fecc8a6d258ecd4
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 2d89ff81 2dea99e0
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -255,7 +255,10 @@ filegroup {

java_defaults {
    name: "framework-minus-apex-defaults",
    defaults: ["framework-aidl-export-defaults"],
    defaults: [
        "framework-aidl-export-defaults",
        "latest_android_hardware_soundtrigger3_java_static",
    ],
    srcs: [
        ":framework-non-updatable-sources",
        "core/java/**/*.logtags",
@@ -312,8 +315,6 @@ java_defaults {
    sdk_version: "core_platform",
    static_libs: [
        "android.hardware.common.fmq-V1-java",
        // TODO(b/184162091)
        "android.hardware.soundtrigger3-V1-java",
        "bouncycastle-repackaged-unbundled",
        "framework-internal-utils",
        // If MimeMap ever becomes its own APEX, then this dependency would need to be removed
+4 −1
Original line number Diff line number Diff line
@@ -80,6 +80,10 @@ cc_library_shared {
        "include",
    ],

    defaults: [
        "latest_android_media_audio_common_types_cpp_target_shared",
    ],

    target: {
        android: {
            srcs: [
@@ -243,7 +247,6 @@ cc_library_shared {
            ],

            shared_libs: [
                "android.media.audio.common.types-V1-cpp",
                "audioclient-types-aidl-cpp",
                "audioflinger-aidl-cpp",
                "audiopolicy-types-aidl-cpp",
+71 −2
Original line number Diff line number Diff line
@@ -35,8 +35,8 @@ aidl_interface {
        "aidl/android/media/soundtrigger_middleware/SoundTriggerModuleDescriptor.aidl",
    ],
    imports: [
        "android.media.audio.common.types-V1",
        "android.media.soundtrigger.types-V1",
        "android.media.audio.common.types",
        "android.media.soundtrigger.types",
        "media_permission-aidl",
    ],
}
@@ -52,6 +52,7 @@ aidl_interface {
    ],
    local_include_dir: "aidl",
    srcs: [
        "aidl/android/media/audio/common/AudioAttributes.aidl",
        "aidl/android/media/audio/common/AudioChannelLayout.aidl",
        "aidl/android/media/audio/common/AudioConfig.aidl",
        "aidl/android/media/audio/common/AudioConfigBase.aidl",
@@ -63,6 +64,7 @@ aidl_interface {
        "aidl/android/media/audio/common/AudioEncapsulationMetadataType.aidl",
        "aidl/android/media/audio/common/AudioEncapsulationMode.aidl",
        "aidl/android/media/audio/common/AudioEncapsulationType.aidl",
        "aidl/android/media/audio/common/AudioFlag.aidl",
        "aidl/android/media/audio/common/AudioFormatDescription.aidl",
        "aidl/android/media/audio/common/AudioFormatType.aidl",
        "aidl/android/media/audio/common/AudioGain.aidl",
@@ -122,8 +124,75 @@ aidl_interface {
            version: "1",
            imports: [],
        },
        // IMPORTANT: Update latest_android_media_audio_common_types every time
        // you add the latest frozen version to versions_with_info
    ],

}

// Note: This should always be one version ahead of the last frozen version
latest_android_media_audio_common_types = "android.media.audio.common.types-V2"

// Modules that depend on android.media.audio.common.types directly can include
// the following cc_defaults to avoid explicitly managing dependency versions
// across many scattered files.
cc_defaults {
    name: "latest_android_media_audio_common_types_cpp_shared",
    shared_libs: [
        latest_android_media_audio_common_types + "-cpp",
    ],
}

cc_defaults {
    name: "latest_android_media_audio_common_types_cpp_export_shared",
    defaults: [
        "latest_android_media_audio_common_types_cpp_shared",
    ],
    export_shared_lib_headers: [
        latest_android_media_audio_common_types + "-cpp",
    ],
}

cc_defaults {
    name: "latest_android_media_audio_common_types_cpp_static",
    static_libs: [
        latest_android_media_audio_common_types + "-cpp",
    ],
}

cc_defaults {
    name: "latest_android_media_audio_common_types_cpp_export_static",
    defaults: [
        "latest_android_media_audio_common_types_cpp_static",
    ],
    export_static_lib_headers: [
        latest_android_media_audio_common_types + "-cpp",
    ],
}

cc_defaults {
    name: "latest_android_media_audio_common_types_ndk_shared",
    shared_libs: [
        latest_android_media_audio_common_types + "-ndk",
    ],
}

cc_defaults {
    name: "latest_android_media_audio_common_types_ndk_static",
    static_libs: [
        latest_android_media_audio_common_types + "-ndk",
    ],
}

cc_defaults {
    name: "latest_android_media_audio_common_types_cpp_target_shared",
    target: {
        android: {
            shared_libs: [
                latest_android_media_audio_common_types + "-cpp",
            ],
        },
    },
}

aidl_interface {
+59 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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.audio.common;

import android.media.audio.common.AudioContentType;
import android.media.audio.common.AudioFlag;
import android.media.audio.common.AudioSource;
import android.media.audio.common.AudioUsage;

/**
 * AudioAttributes give information about an audio stream that is more
 * descriptive than stream type alone.
 */
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable AudioAttributes {
    /**
     * Classifies the content of the audio signal using categories such as
     * speech or music
     */
    AudioContentType contentType = AudioContentType.UNKNOWN;
    /**
     * Classifies the intended use of the audio signal using categories such as
     * alarm or ringtone
     */
    AudioUsage usage = AudioUsage.UNKNOWN;
    /**
     * Classifies the audio source using categories such as voice uplink or
     * remote submix
     */
    AudioSource source = AudioSource.DEFAULT;
    /**
     * Bitmask describing how playback is to be affected.
     */
    int flags = AudioFlag.NONE;
    /**
     * Tag is an additional use case qualifier complementing AudioUsage and
     * AudioContentType. Tags are set by vendor-specific applications and must
     * be prefixed by "VX_". Vendors must namespace their tag names using the
     * name of their company to avoid conflicts. The namespace must use at least
     * three characters, and must go directly after the "VX_" prefix.
     * For example: "VX_MYCOMPANY_VR".
     */
    @utf8InCpp String[] tags;
}
 No newline at end of file
+116 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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.audio.common;

/**
 * Defines the audio flags that are used in AudioAttributes
 */
@Backing(type="int")
@VintfStability
enum AudioFlag {
    NONE = 0x0,
    /**
     * Flag defining a behavior where the audibility of the sound will be
     * ensured by the system. To ensure sound audibility, the system only uses
     * built-in speakers or wired headphones and specifically excludes wireless
     * audio devices. Note this flag should only be used for sounds subject to
     * regulatory behaviors in some countries, such as for camera shutter sound,
     * and not for routing behaviors.
     */
    AUDIBILITY_ENFORCED = 0x1 << 0,
    /**
     * Skipping 0x1 << 1. This was previously used for SECURE flag, but because
     * the security feature was never implemented using this flag, and the flag
     * was never made public, this value may be used for another flag.
     */
    /**
     * Flag to enable when the stream is associated with SCO usage.
     * Internal use only for dealing with legacy STREAM_BLUETOOTH_SCO
     */
    SCO = 0x1 << 2,
    /**
     * Flag defining a behavior where the system ensures that the playback of
     * the sound will be compatible with its use as a broadcast for surrounding
     * people and/or devices. Ensures audibility with no or minimal
     * post-processing applied.
     */
    BEACON = 0x1 << 3,
    /**
     * Flag requesting the use of an output stream supporting hardware A/V
     * synchronization.
     */
    HW_AV_SYNC = 0x1 << 4,
    /**
     * Flag requesting capture from the source used for hardware hotword
     * detection. To be used with capture preset MediaRecorder.AudioSource
     * HOTWORD or MediaRecorder.AudioSource.VOICE_RECOGNITION.
     */
    HW_HOTWORD = 0x1 << 5,
    /**
     * Flag requesting audible playback even under limited interruptions.
     */
    BYPASS_INTERRUPTION_POLICY = 0x1 << 6,
    /**
     * Flag requesting audible playback even when the underlying stream is muted
     */
    BYPASS_MUTE = 0x1 << 7,
    /**
     * Flag requesting a low latency path when creating an AudioTrack.
     * When using this flag, the sample rate must match the native sample rate
     * of the device. Effects processing is also unavailable.
     */
    LOW_LATENCY = 0x1 << 8,
    /**
     * Flag requesting a deep buffer path when creating an AudioTrack.
     *
     * A deep buffer path, if available, may consume less power and is
     * suitable for media playback where latency is not a concern.
     */
    DEEP_BUFFER = 0x1 << 9,
    /**
     * Flag specifying that the audio shall not be captured by third-party apps
     * with a MediaProjection.
     */
    NO_MEDIA_PROJECTION = 0x1 << 10,
    /**
     * Flag indicating force muting haptic channels.
     */
    MUTE_HAPTIC = 0x1 << 11,
    /**
     * Flag specifying that the audio shall not be captured by any apps, not
     * even system apps.
     */
    NO_SYSTEM_CAPTURE = 0x1 << 12,
    /**
     * Flag requesting private audio capture.
     */
    CAPTURE_PRIVATE = 0x1 << 13,
    /**
     * Flag indicating the audio content has been processed to provide a virtual
     * multichannel audio experience.
     */
    CONTENT_SPATIALIZED = 0x1 << 14,
    /**
     * Flag indicating the audio content is never to be spatialized.
     */
    NEVER_SPATIALIZE = 0x1 << 15,
    /**
     * Flag indicating the audio is part of a call redirection.
     * Valid for playback and capture.
     */
    CALL_REDIRECTION = 0x1 << 16,
}
 No newline at end of file
Loading