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

Commit 69bcb75a authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 7670707 from f7adf32d to sc-v2-release

Change-Id: I2f01659b60b7e6db90d8e0a671487a5a2dbdb8c7
parents 2858f7e5 f7adf32d
Loading
Loading
Loading
Loading
+32 −3
Original line number Diff line number Diff line
@@ -25,11 +25,13 @@ cc_library_headers {
    static_libs: [
        "audioflinger-aidl-cpp",
        "audiopolicy-aidl-cpp",
        "spatializer-aidl-cpp",
        "av-types-aidl-cpp",
    ],
    export_static_lib_headers: [
        "audioflinger-aidl-cpp",
        "audiopolicy-aidl-cpp",
        "spatializer-aidl-cpp",
        "av-types-aidl-cpp",
    ],
    target: {
@@ -112,6 +114,7 @@ cc_library {
        "audioclient-types-aidl-cpp",
        "audioflinger-aidl-cpp",
        "audiopolicy-aidl-cpp",
        "spatializer-aidl-cpp",
        "audiopolicy-types-aidl-cpp",
        "av-types-aidl-cpp",
        "capture_state_listener-aidl-cpp",
@@ -137,6 +140,7 @@ cc_library {
    export_shared_lib_headers: [
        "audioflinger-aidl-cpp",
        "audiopolicy-aidl-cpp",
        "spatializer-aidl-cpp",
        "framework-permission-aidl-cpp",
        "libbinder",
    ],
@@ -388,9 +392,9 @@ aidl_interface {
        "aidl/android/media/AudioProductStrategy.aidl",
        "aidl/android/media/AudioVolumeGroup.aidl",
        "aidl/android/media/DeviceRole.aidl",
        "aidl/android/media/HeadTrackingMode.aidl",
        "aidl/android/media/SoundTriggerSession.aidl",
        "aidl/android/media/SpatializationLevel.aidl",
        "aidl/android/media/SpatializerHeadTrackingMode.aidl",
    ],
    imports: [
        "audio_common-aidl",
@@ -466,8 +470,6 @@ aidl_interface {
        "aidl/android/media/RecordClientInfo.aidl",
        "aidl/android/media/IAudioPolicyService.aidl",
        "aidl/android/media/IAudioPolicyServiceClient.aidl",
        "aidl/android/media/INativeSpatializerCallback.aidl",
        "aidl/android/media/ISpatializer.aidl",
    ],
    imports: [
        "audio_common-aidl",
@@ -475,6 +477,33 @@ aidl_interface {
        "audiopolicy-types-aidl",
        "capture_state_listener-aidl",
        "framework-permission-aidl",
        "spatializer-aidl",
    ],

    double_loadable: true,
    backend: {
        cpp: {
            min_sdk_version: "29",
            apex_available: [
                "//apex_available:platform",
                "com.android.media",
            ],
        },
    },
}

aidl_interface {
    name: "spatializer-aidl",
    unstable: true,
    local_include_dir: "aidl",
    host_supported: true,
    vendor_available: true,
    srcs: [
        "aidl/android/media/INativeSpatializerCallback.aidl",
        "aidl/android/media/ISpatializer.aidl",
    ],
    imports: [
        "audiopolicy-types-aidl",
    ],

    double_loadable: true,
+10 −9
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@

package android.media;

import android.media.HeadTrackingMode;
import android.media.SpatializationLevel;
import android.media.SpatializerHeadTrackingMode;

/**
 * The ISpatializer interface is used to control the native audio service implementation
@@ -47,22 +47,23 @@ interface ISpatializer {
    /** Gets the selected spatialization level (see SpatializationLevel.aidl) */
    SpatializationLevel getLevel();

    /** Reports the list of supported head tracking modes (see HeadTrackingMode.aidl). The list can
     * be empty if the spatializer implementation does not support head tracking or if no
     * head tracking device is connected.
    /** Reports the list of supported head tracking modes (see SpatializerHeadTrackingMode.aidl).
     * The list can be empty if the spatializer implementation does not support head tracking or if
     * no head tracking device is connected.
     */
    HeadTrackingMode[] getSupportedHeadTrackingModes();
    SpatializerHeadTrackingMode[] getSupportedHeadTrackingModes();

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

    /** 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)
     */
    HeadTrackingMode getActualHeadTrackingMode();
    SpatializerHeadTrackingMode getActualHeadTrackingMode();

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

    /** Set the screen to stage transform to use by the head tracking algorithm */
    void setGlobalTransform(in float[] screenToStage);
}
+2 −2
Original line number Diff line number Diff line
@@ -18,12 +18,12 @@ package android.media;


/**
 * The head tracking mode supported by the spatializer stage effect implementation.
 * The head tracking mode supported by the spatializer effect implementation.
 * Used by methods of the ISpatializer interface.
 * {@hide}
 */
@Backing(type="byte")
enum HeadTrackingMode {
enum SpatializerHeadTrackingMode {
    /** Head tracking is active in a mode not listed below (forward compatibility) */
    OTHER = 0,
    /** Head tracking is disabled */
+29 −0
Original line number Diff line number Diff line
@@ -22,6 +22,35 @@ cc_library {
    ],
}

cc_library {
    name: "libheadtracking-binding",
    srcs: [
      "SensorPoseProvider.cpp",
    ],
    shared_libs: [
        "libheadtracking",
        "libandroid",
        "liblog",
        "libsensor",
    ],
    export_shared_lib_headers: [
        "libheadtracking",
    ],
}

cc_binary {
    name: "SensorPoseProvider-example",
    srcs: [
        "SensorPoseProvider-example.cpp",
    ],
    shared_libs: [
        "libandroid",
        "libheadtracking",
        "libheadtracking-binding",
        "libsensor",
    ],
}

cc_test_host {
    name: "libheadtracking-test",
    srcs: [
+14 −0
Original line number Diff line number Diff line
@@ -48,6 +48,11 @@ TEST(HeadTrackingProcessor, BasicComposition) {

    std::unique_ptr<HeadTrackingProcessor> processor =
            createHeadTrackingProcessor(Options{}, HeadTrackingMode::SCREEN_RELATIVE);

    // Establish a baseline for the drift compensators.
    processor->setWorldToHeadPose(0, Pose3f(), Twist3f());
    processor->setWorldToScreenPose(0, Pose3f());

    processor->setWorldToHeadPose(0, worldToHead, Twist3f());
    processor->setWorldToScreenPose(0, worldToScreen);
    processor->setScreenToStagePose(screenToStage);
@@ -76,6 +81,11 @@ TEST(HeadTrackingProcessor, Prediction) {

    std::unique_ptr<HeadTrackingProcessor> processor = createHeadTrackingProcessor(
            Options{.predictionDuration = 2.f}, HeadTrackingMode::WORLD_RELATIVE);

    // Establish a baseline for the drift compensators.
    processor->setWorldToHeadPose(0, Pose3f(), Twist3f());
    processor->setWorldToScreenPose(0, Pose3f());

    processor->setWorldToHeadPose(0, worldToHead, headTwist);
    processor->setWorldToScreenPose(0, worldToScreen);
    processor->calculate(0);
@@ -100,6 +110,10 @@ TEST(HeadTrackingProcessor, SmoothModeSwitch) {
    std::unique_ptr<HeadTrackingProcessor> processor = createHeadTrackingProcessor(
            Options{.maxTranslationalVelocity = 1}, HeadTrackingMode::STATIC);

    // Establish a baseline for the drift compensators.
    processor->setWorldToHeadPose(0, Pose3f(), Twist3f());
    processor->setWorldToScreenPose(0, Pose3f());

    processor->calculate(0);

    processor->setDesiredMode(HeadTrackingMode::WORLD_RELATIVE);
Loading