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

Commit 3ef105a7 authored by Michael Dooley's avatar Michael Dooley Committed by Android (Google) Code Review
Browse files

Merge "Adding getModelState API to sound trigger"

parents 175e5eec 73e63e66
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -247,7 +247,7 @@ exit:
}

SoundTriggerHalImpl::SoundTriggerHalImpl()
    : mModuleName("primary"), mHwDevice(NULL), mNextModelId(1) {}
    : mModuleName("primary"), mNextModelId(1), mHwDevice(NULL) {}

void SoundTriggerHalImpl::onFirstRef() {
    const hw_module_t* mod;
+4 −1
Original line number Diff line number Diff line
@@ -167,8 +167,11 @@ class SoundTriggerHalImpl : public RefBase {
    static void recognitionCallback(struct sound_trigger_recognition_event* halEvent, void* cookie);

    const char* mModuleName;
    struct sound_trigger_hw_device* mHwDevice;

    volatile atomic_uint_fast32_t mNextModelId;

   protected:
    struct sound_trigger_hw_device* mHwDevice;
    DefaultKeyedVector<int32_t, sp<SoundModelClient> > mClients;
    Mutex mLock;
};
+20 −0
Original line number Diff line number Diff line
// This file is autogenerated by hidl-gen -Landroidbp.

hidl_interface {
    name: "android.hardware.soundtrigger@2.2",
    root: "android.hardware",
    vndk: {
        enabled: true,
    },
    srcs: [
        "ISoundTriggerHw.hal",
    ],
    interfaces: [
        "android.hardware.audio.common@2.0",
        "android.hardware.soundtrigger@2.0",
        "android.hardware.soundtrigger@2.1",
        "android.hidl.base@1.0",
    ],
    gen_java: false,
}
+40 −0
Original line number Diff line number Diff line
/*
 * Copyright 2018 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.hardware.soundtrigger@2.2;

import @2.1::ISoundTriggerHw;
import @2.0::SoundModelHandle;
import @2.0::ISoundTriggerHwCallback.RecognitionEvent;

/**
 * SoundTrigger HAL interface. Used for hardware recognition of hotwords.
 */
interface ISoundTriggerHw extends @2.1::ISoundTriggerHw {

    /**
     * Get the state of a given model.
     * The model state is returned as a RecognitionEvent.
     * @param modelHandle The handle of the sound model to use for recognition
     * @return retval Operation completion status: 0 in case of success,
     *                -ENOSYS in case of invalid model handle,
     *                -ENOMEM in case of memory allocation failure,
     *                -ENODEV in case of initialization error.
     * @return state  RecognitionEvent in case of success
     */
    getModelState(SoundModelHandle modelHandle)
            generates (int32_t retval, RecognitionEvent state);
};
+50 −0
Original line number Diff line number Diff line
#
# Copyright (C) 2018 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.


LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.soundtrigger@2.2-impl
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \
    SoundTriggerHw.cpp

LOCAL_CFLAGS := -Wall -Werror

LOCAL_SHARED_LIBRARIES := \
        libhardware \
        libhidlbase \
        libhidlmemory \
        libhidltransport \
        liblog \
        libutils \
        android.hardware.soundtrigger@2.2 \
        android.hardware.soundtrigger@2.1 \
        android.hardware.soundtrigger@2.0 \
        android.hardware.soundtrigger@2.0-core \
        android.hidl.allocator@1.0 \
        android.hidl.memory@1.0

LOCAL_C_INCLUDE_DIRS := $(LOCAL_PATH)

ifeq ($(strip $(AUDIOSERVER_MULTILIB)),)
LOCAL_MULTILIB := 32
else
LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
endif

include $(BUILD_SHARED_LIBRARY)
Loading