Update Spatialization and HeadTracking AIDL usage
Bug: 273373363
Test: m
Change-Id: I0927bd95dc8885e5c43073303433d2a461d9cfd2
diff --git a/media/libaaudio/src/Android.bp b/media/libaaudio/src/Android.bp
index 30f451a..7882951 100644
--- a/media/libaaudio/src/Android.bp
+++ b/media/libaaudio/src/Android.bp
@@ -254,6 +254,9 @@
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 @@
"binding/aidl/aaudio/IAAudioService.aidl",
],
imports: [
- "android.media.audio.common.types-V2",
"audioclient-types-aidl",
"shared-file-region-aidl",
"framework-permission-aidl",
diff --git a/media/libaudioclient/Android.bp b/media/libaudioclient/Android.bp
index d35708c..658bf63 100644
--- a/media/libaudioclient/Android.bp
+++ b/media/libaudioclient/Android.bp
@@ -255,8 +255,10 @@
"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/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: {
@@ -352,12 +356,11 @@
"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: {
@@ -403,8 +406,10 @@
"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",
@@ -440,8 +445,10 @@
"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",
@@ -475,6 +482,9 @@
"aidl/android/media/ISpatializer.aidl",
"aidl/android/media/ISpatializerHeadTrackingCallback.aidl",
],
+ defaults: [
+ "latest_android_media_audio_common_types_import_interface",
+ ],
imports: [
"audiopolicy-types-aidl",
],
diff --git a/media/libaudioclient/aidl/android/media/INativeSpatializerCallback.aidl b/media/libaudioclient/aidl/android/media/INativeSpatializerCallback.aidl
index 88b8108..8b30b29 100644
--- a/media/libaudioclient/aidl/android/media/INativeSpatializerCallback.aidl
+++ b/media/libaudioclient/aidl/android/media/INativeSpatializerCallback.aidl
@@ -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 @@
/** 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.
diff --git a/media/libaudioclient/aidl/android/media/ISpatializer.aidl b/media/libaudioclient/aidl/android/media/ISpatializer.aidl
index 250c450..37dd776 100644
--- a/media/libaudioclient/aidl/android/media/ISpatializer.aidl
+++ b/media/libaudioclient/aidl/android/media/ISpatializer.aidl
@@ -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 @@
/** 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 @@
*/
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 @@
*/
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.
diff --git a/media/libaudioclient/aidl/android/media/ISpatializerHeadTrackingCallback.aidl b/media/libaudioclient/aidl/android/media/ISpatializerHeadTrackingCallback.aidl
index 23d5e13..615b971 100644
--- a/media/libaudioclient/aidl/android/media/ISpatializerHeadTrackingCallback.aidl
+++ b/media/libaudioclient/aidl/android/media/ISpatializerHeadTrackingCallback.aidl
@@ -16,8 +16,7 @@
package android.media;
-import android.media.SpatializationLevel;
-import android.media.SpatializerHeadTrackingMode;
+import android.media.audio.common.HeadTracking;
/**
* The ISpatializerHeadTrackingCallback interface is a callback associated to the
@@ -28,7 +27,7 @@
oneway interface ISpatializerHeadTrackingCallback {
/** Called when the head tracking mode has changed
*/
- void onHeadTrackingModeChanged(SpatializerHeadTrackingMode mode);
+ void onHeadTrackingModeChanged(HeadTracking.Mode mode);
/** Called when the head to stage pose hase been updated
* The head to stage pose is conveyed as a vector of 6 elements,
diff --git a/media/libaudioclient/aidl/android/media/SpatializationLevel.aidl b/media/libaudioclient/aidl/android/media/SpatializationLevel.aidl
deleted file mode 100644
index 961c5a1..0000000
--- a/media/libaudioclient/aidl/android/media/SpatializationLevel.aidl
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2021 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;
-
-/**
- * The spatialization level supported by the spatializer stage effect implementation.
- * Used by methods of the ISpatializer interface.
- * {@hide}
- */
-@Backing(type="byte")
-enum SpatializationLevel {
- /** Spatialization is disabled. */
- NONE = 0,
- /** The spatializer accepts audio with positional multichannel masks (e.g 5.1). */
- SPATIALIZER_MULTICHANNEL = 1,
- /** The spatializer accepts audio made of a channel bed of positional multichannels (e.g 5.1)
- * and audio objects positioned independently via meta data.
- */
- SPATIALIZER_MCHAN_BED_PLUS_OBJECTS = 2,
-}
diff --git a/media/libaudioclient/aidl/android/media/SpatializationMode.aidl b/media/libaudioclient/aidl/android/media/SpatializationMode.aidl
deleted file mode 100644
index eaaff37..0000000
--- a/media/libaudioclient/aidl/android/media/SpatializationMode.aidl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2021 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;
-
-/**
- * The spatialization mode supported by the spatializer stage effect implementation.
- * Used by methods of the ISpatializer interface.
- * {@hide}
- */
-@Backing(type="byte")
-enum SpatializationMode {
- /** The spatializer supports binaural mode (over headphones type devices). */
- SPATIALIZER_BINAURAL = 0,
- /** The spatializer supports transaural mode (over speaker type devices). */
- SPATIALIZER_TRANSAURAL = 1,
-}
diff --git a/media/libaudioclient/aidl/android/media/SpatializerHeadTrackingMode.aidl b/media/libaudioclient/aidl/android/media/SpatializerHeadTrackingMode.aidl
deleted file mode 100644
index 58e0f61..0000000
--- a/media/libaudioclient/aidl/android/media/SpatializerHeadTrackingMode.aidl
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2021 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;
-
-
-/**
- * The head tracking mode supported by the spatializer effect implementation.
- * Used by methods of the ISpatializer interface.
- * {@hide}
- */
-@Backing(type="byte")
-enum SpatializerHeadTrackingMode {
- /** Head tracking is active in a mode not listed below (forward compatibility) */
- OTHER = 0,
- /** Head tracking is disabled */
- DISABLED = 1,
- /** Head tracking is performed relative to the real work environment */
- RELATIVE_WORLD = 2,
- /** Head tracking is performed relative to the device's screen */
- RELATIVE_SCREEN = 3,
-}