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

Commit 295c8f87 authored by Shunkai Yao's avatar Shunkai Yao
Browse files

Update Spatialization and HeadTracking AIDL usage

Bug: 273373363
Test: m
Test: lunch panther-trunk_staging-userdebug; m
Test: Test Bluetooth Audio functionality on Panther
Change-Id: I0927bd95dc8885e5c43073303433d2a461d9cfd2
Merged-In: I0927bd95dc8885e5c43073303433d2a461d9cfd2
parent 9b59b065
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -52,8 +52,8 @@ aidl_interface {
        "aidl/android/media/VolumeShaperOperationFlag.aidl",
        "aidl/android/media/VolumeShaperState.aidl",
    ],
    imports: [
        "android.media.audio.common.types-V2",
    defaults: [
        "latest_android_media_audio_common_types_import_interface",
    ],
    backend: {
        cpp: {
@@ -113,8 +113,8 @@ aidl_interface {
    srcs: [
        "aidl/android/media/audio/IHalAdapterVendorExtension.aidl",
    ],
    imports: [
        "android.hardware.audio.core-V1",
    defaults: [
        "latest_android_hardware_audio_core_import_interface",
    ],
    backend: {
        // The C++ backend is disabled transitively due to use of FMQ by the audio core HAL.
+3 −1
Original line number Diff line number Diff line
@@ -254,6 +254,9 @@ aidl_interface {
    name: "aaudio-aidl",
    unstable: true,
    local_include_dir: "binding/aidl",
    defaults: [
        "latest_android_media_audio_common_types_import_interface",
    ],
    srcs: [
        "binding/aidl/aaudio/Endpoint.aidl",
        "binding/aidl/aaudio/RingBuffer.aidl",
@@ -264,7 +267,6 @@ aidl_interface {
        "binding/aidl/aaudio/IAAudioService.aidl",
    ],
    imports: [
        "android.media.audio.common.types-V2",
        "audioclient-types-aidl",
        "shared-file-region-aidl",
        "framework-permission-aidl",
+18 −8
Original line number Diff line number Diff line
@@ -255,8 +255,10 @@ aidl_interface {
        "aidl/android/media/IEffect.aidl",
        "aidl/android/media/IEffectClient.aidl",
    ],
    defaults: [
        "latest_android_media_audio_common_types_import_interface",
    ],
    imports: [
        "android.media.audio.common.types-V2",
        "shared-file-region-aidl",
    ],
    backend: {
@@ -309,8 +311,10 @@ aidl_interface {
        "aidl/android/media/TrackSecondaryOutputInfo.aidl",
        "aidl/android/media/SurroundSoundConfig.aidl",
    ],
    defaults: [
        "latest_android_media_audio_common_types_import_interface",
    ],
    imports: [
        "android.media.audio.common.types-V2",
        "framework-permission-aidl",
    ],
    backend: {
@@ -351,12 +355,11 @@ aidl_interface {
        "aidl/android/media/AudioVolumeGroup.aidl",
        "aidl/android/media/DeviceRole.aidl",
        "aidl/android/media/SoundTriggerSession.aidl",
        "aidl/android/media/SpatializationLevel.aidl",
        "aidl/android/media/SpatializationMode.aidl",
        "aidl/android/media/SpatializerHeadTrackingMode.aidl",
    ],
    defaults: [
        "latest_android_media_audio_common_types_import_interface",
    ],
    imports: [
        "android.media.audio.common.types-V2",
        "audioclient-types-aidl",
    ],
    backend: {
@@ -402,8 +405,10 @@ aidl_interface {
        "aidl/android/media/ISoundDoseCallback.aidl",
        "aidl/android/media/SoundDoseRecord.aidl",
    ],
    defaults: [
        "latest_android_media_audio_common_types_import_interface",
    ],
    imports: [
        "android.media.audio.common.types-V2",
        "audioclient-types-aidl",
        "av-types-aidl",
        "effect-aidl",
@@ -439,8 +444,10 @@ aidl_interface {
        "aidl/android/media/IAudioPolicyService.aidl",
        "aidl/android/media/IAudioPolicyServiceClient.aidl",
    ],
    defaults: [
        "latest_android_media_audio_common_types_import_interface",
    ],
    imports: [
        "android.media.audio.common.types-V2",
        "audioclient-types-aidl",
        "audiopolicy-types-aidl",
        "capture_state_listener-aidl",
@@ -474,6 +481,9 @@ aidl_interface {
        "aidl/android/media/ISpatializer.aidl",
        "aidl/android/media/ISpatializerHeadTrackingCallback.aidl",
    ],
    defaults: [
        "latest_android_media_audio_common_types_import_interface",
    ],
    imports: [
        "audiopolicy-types-aidl",
    ],
+2 −3
Original line number Diff line number Diff line
@@ -16,8 +16,7 @@

package android.media;

import android.media.SpatializationLevel;
import android.media.SpatializerHeadTrackingMode;
import android.media.audio.common.Spatialization;

/**
 * The INativeSpatializerCallback interface is a callback associated to the
@@ -30,7 +29,7 @@ oneway interface INativeSpatializerCallback {
    /** Called when the spatialization level applied by the spatializer changes
     * (e.g. when the spatializer is enabled or disabled)
     */
    void onLevelChanged(SpatializationLevel level);
    void onLevelChanged(Spatialization.Level level);

    /** Called when the output stream the Spatializer is attached to changes.
     * Indicates the IO Handle of the new output.
+31 −21
Original line number Diff line number Diff line
@@ -16,11 +16,9 @@

package android.media;

import android.media.audio.common.HeadTracking;
import android.media.audio.common.Spatialization;
import android.media.ISpatializerHeadTrackingCallback;
import android.media.SpatializationLevel;
import android.media.SpatializationMode;
import android.media.SpatializerHeadTrackingMode;


/**
 * The ISpatializer interface is used to control the native audio service implementation
@@ -34,21 +32,25 @@ interface ISpatializer {
    /** Releases a ISpatializer interface previously acquired. */
    void release();

    /** Reports the list of supported spatialization levels (see SpatializationLevel.aidl).
    /**
     * Reports the list of supported spatialization levels.
     * The list should never be empty if an ISpatializer interface was successfully
     * retrieved with IAudioPolicyService.getSpatializer().
     */
    SpatializationLevel[] getSupportedLevels();
    Spatialization.Level[] getSupportedLevels();

    /** Selects the desired spatialization level (see SpatializationLevel.aidl). Selecting a level
     * different from SpatializationLevel.NONE with create the specialized multichannel output
    /**
     * Selects the desired spatialization level. Selecting a level
     * different from Spatializer.Level.NONE with create the specialized multichannel output
     * mixer, create and enable the spatializer effect and let the audio policy attach eligible
     * AudioTrack to this output stream.
     */
    void setLevel(SpatializationLevel level);
    void setLevel(Spatialization.Level level);

    /** Gets the selected spatialization level (see SpatializationLevel.aidl) */
    SpatializationLevel getLevel();
    /**
     * Gets the selected spatialization level.
     */
    Spatialization.Level getLevel();

    /** Reports if the spatializer engine supports head tracking or not.
     * This is a pre condition independent of the fact that a head tracking sensor is
@@ -56,26 +58,33 @@ interface ISpatializer {
     */
    boolean isHeadTrackingSupported();

    /** Reports the list of supported head tracking modes (see SpatializerHeadTrackingMode.aidl).
    /**
     * Reports the list of supported head tracking modes.
     * The list always contains SpatializerHeadTrackingMode.DISABLED and can include other modes
     * if the spatializer effect implementation supports head tracking.
     * The result does not depend on currently connected sensors but reflects the capabilities
     * when sensors are available.
     */
    SpatializerHeadTrackingMode[] getSupportedHeadTrackingModes();
    HeadTracking.Mode[] getSupportedHeadTrackingModes();

    /** Selects the desired head tracking mode (see SpatializerHeadTrackingMode.aidl) */
    void setDesiredHeadTrackingMode(SpatializerHeadTrackingMode mode);
    /**
     * Selects the desired head tracking mode.
     */
    void setDesiredHeadTrackingMode(HeadTracking.Mode mode);

    /** Gets the actual head tracking mode. Can be different from the desired mode if conditions to
    /**
     * Gets the actual head tracking mode. Can be different from the desired mode if conditions to
     * enable the desired mode are not met (e.g if the head tracking device was removed)
     */
    SpatializerHeadTrackingMode getActualHeadTrackingMode();
    HeadTracking.Mode getActualHeadTrackingMode();

    /** Reset the head tracking algorithm to consider current head pose as neutral */
    /**
     * Reset the head tracking algorithm to consider current head pose as neutral
     */
    void recenterHeadTracker();

    /** Set the screen to stage transform to use by the head tracking algorithm
    /**
     * Set the screen to stage transform to use by the head tracking algorithm
     * The screen to stage transform is conveyed as a vector of 6 elements,
     * where the first three are a translation vector and
     * the last three are a rotation vector.
@@ -123,11 +132,12 @@ interface ISpatializer {
     */
    void setFoldState(boolean folded);

    /** Reports the list of supported spatialization modess (see SpatializationMode.aidl).
    /**
     * Reports the list of supported spatialization modess.
     * The list should never be empty if an ISpatializer interface was successfully
     * retrieved with IAudioPolicyService.getSpatializer().
     */
    SpatializationMode[] getSupportedModes();
    Spatialization.Mode[] getSupportedModes();

    /**
     * Registers a callback to monitor head tracking functions.
Loading