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

Commit 38027cd8 authored by Nicholas Ambur's avatar Nicholas Ambur
Browse files

add supportedModelArch to SoundTrigger properties

Bug: 142414689
Test: atest SoundTriggerMiddlewareImplTest
&& GTS assist test suite

Change-Id: I201a8ab919b0a27fa1ed2fd7804c78edccefc647
parent aff43dbc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3556,6 +3556,7 @@ package android.hardware.soundtrigger {
    field public final int powerConsumptionMw;
    field public final int recognitionModes;
    field public final boolean returnsTriggerInEvent;
    field @NonNull public final String supportedModelArch;
    field public final boolean supportsCaptureTransition;
    field public final boolean supportsConcurrentCapture;
    field @NonNull public final java.util.UUID uuid;
+2 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.hardware.soundtrigger;

import android.annotation.Nullable;
import android.hardware.soundtrigger.ModelParams;
import android.media.AudioFormat;
import android.media.audio.common.AudioConfig;
@@ -32,8 +33,6 @@ import android.media.soundtrigger_middleware.SoundModel;
import android.media.soundtrigger_middleware.SoundTriggerModuleDescriptor;
import android.media.soundtrigger_middleware.SoundTriggerModuleProperties;

import android.annotation.Nullable;

import java.util.Arrays;
import java.util.UUID;

@@ -48,6 +47,7 @@ class ConversionUtil {
                properties.description,
                properties.uuid,
                properties.version,
                properties.supportedModelArch,
                properties.maxSoundModels,
                properties.maxKeyPhrases,
                properties.maxUsers,
+19 −6
Original line number Diff line number Diff line
@@ -101,6 +101,14 @@ public class SoundTrigger {
        /** Voice detection engine version */
        public final int version;

        /**
         * String naming the architecture used for running the supported models.
         * (eg. a platform running models on a DSP could implement this string to convey the DSP
         * architecture used)
         */
        @NonNull
        public final String supportedModelArch;

        /** Maximum number of active sound models */
        public final int maxSoundModels;

@@ -130,15 +138,17 @@ public class SoundTrigger {
        public final boolean returnsTriggerInEvent;

        ModuleProperties(int id, @NonNull String implementor, @NonNull String description,
                @NonNull String uuid, int version, int maxSoundModels, int maxKeyphrases,
                int maxUsers, int recognitionModes, boolean supportsCaptureTransition,
                int maxBufferMs, boolean supportsConcurrentCapture,
                int powerConsumptionMw, boolean returnsTriggerInEvent) {
                @NonNull String uuid, int version, @NonNull String supportedModelArch,
                int maxSoundModels, int maxKeyphrases, int maxUsers, int recognitionModes,
                boolean supportsCaptureTransition, int maxBufferMs,
                boolean supportsConcurrentCapture, int powerConsumptionMw,
                boolean returnsTriggerInEvent) {
            this.id = id;
            this.implementor = requireNonNull(implementor);
            this.description = requireNonNull(description);
            this.uuid = UUID.fromString(requireNonNull(uuid));
            this.version = version;
            this.supportedModelArch = requireNonNull(supportedModelArch);
            this.maxSoundModels = maxSoundModels;
            this.maxKeyphrases = maxKeyphrases;
            this.maxUsers = maxUsers;
@@ -167,6 +177,7 @@ public class SoundTrigger {
            String description = in.readString();
            String uuid = in.readString();
            int version = in.readInt();
            String supportedModelArch = in.readString();
            int maxSoundModels = in.readInt();
            int maxKeyphrases = in.readInt();
            int maxUsers = in.readInt();
@@ -177,7 +188,7 @@ public class SoundTrigger {
            int powerConsumptionMw = in.readInt();
            boolean returnsTriggerInEvent = in.readByte() == 1;
            return new ModuleProperties(id, implementor, description, uuid, version,
                    maxSoundModels, maxKeyphrases, maxUsers, recognitionModes,
                    supportedModelArch, maxSoundModels, maxKeyphrases, maxUsers, recognitionModes,
                    supportsCaptureTransition, maxBufferMs, supportsConcurrentCapture,
                    powerConsumptionMw, returnsTriggerInEvent);
        }
@@ -189,6 +200,7 @@ public class SoundTrigger {
            dest.writeString(description);
            dest.writeString(uuid.toString());
            dest.writeInt(version);
            dest.writeString(supportedModelArch);
            dest.writeInt(maxSoundModels);
            dest.writeInt(maxKeyphrases);
            dest.writeInt(maxUsers);
@@ -208,7 +220,8 @@ public class SoundTrigger {
        @Override
        public String toString() {
            return "ModuleProperties [id=" + id + ", implementor=" + implementor + ", description="
                    + description + ", uuid=" + uuid + ", version=" + version + ", maxSoundModels="
                    + description + ", uuid=" + uuid + ", version=" + version
                    + " , supportedModelArch=" + supportedModelArch + ", maxSoundModels="
                    + maxSoundModels + ", maxKeyphrases=" + maxKeyphrases + ", maxUsers="
                    + maxUsers + ", recognitionModes=" + recognitionModes
                    + ", supportsCaptureTransition=" + supportsCaptureTransition + ", maxBufferMs="
+8 −0
Original line number Diff line number Diff line
@@ -30,6 +30,14 @@ parcelable SoundTriggerModuleProperties {
     * Unique implementation ID. The UUID must change with each version of
       the engine implementation */
    String     uuid;
    /**
     * String naming the architecture used for running the supported models.
     * (eg. a platform running models on a DSP could implement this string to convey the DSP
     * architecture used)
     * This property is supported for soundtrigger HAL v2.3 and above.
     * If running a previous version, the string will be empty.
     */
    String supportedModelArch;
    /** Maximum number of concurrent sound models loaded */
    int maxSoundModels;
    /** Maximum number of key phrases */
+8 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.annotation.Nullable;
import android.hardware.audio.common.V2_0.Uuid;
import android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback;
import android.hardware.soundtrigger.V2_3.ISoundTriggerHw;
import android.hardware.soundtrigger.V2_3.Properties;
import android.media.audio.common.AudioConfig;
import android.media.audio.common.AudioOffloadInfo;
import android.media.soundtrigger_middleware.ConfidenceLevel;
@@ -69,6 +70,13 @@ class ConversionUtil {
        return aidlProperties;
    }

    static @NonNull SoundTriggerModuleProperties hidl2aidlProperties(
            @NonNull Properties hidlProperties) {
        SoundTriggerModuleProperties aidlProperties = hidl2aidlProperties(hidlProperties.base);
        aidlProperties.supportedModelArch = hidlProperties.supportedModelArch;
        return aidlProperties;
    }

    static @NonNull
    String hidl2aidlUuid(@NonNull Uuid hidlUuid) {
        if (hidlUuid.node == null || hidlUuid.node.length != 6) {
Loading