1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.internal.app;
18
19import android.content.Intent;
20import android.os.Bundle;
21
22import com.android.internal.app.IVoiceInteractor;
23import android.hardware.soundtrigger.IRecognitionStatusCallback;
24import android.hardware.soundtrigger.SoundTrigger;
25import android.service.voice.IVoiceInteractionService;
26import android.service.voice.IVoiceInteractionSession;
27
28interface IVoiceInteractionManagerService {
29    void startSession(IVoiceInteractionService service, in Bundle sessionArgs);
30    boolean deliverNewSession(IBinder token, IVoiceInteractionSession session,
31            IVoiceInteractor interactor);
32    int startVoiceActivity(IBinder token, in Intent intent, String resolvedType);
33    void finish(IBinder token);
34
35    /**
36     * Gets the registered Sound model for keyphrase detection for the current user.
37     * May be null if no matching sound model exists.
38     *
39     * @param keyphraseId The unique identifier for the keyphrase.
40     * @param bcp47Locale The BCP47 language tag  for the keyphrase's locale.
41     */
42    SoundTrigger.KeyphraseSoundModel getKeyphraseSoundModel(int keyphraseId, in String bcp47Locale);
43    /**
44     * Add/Update the given keyphrase sound model.
45     */
46    int updateKeyphraseSoundModel(in SoundTrigger.KeyphraseSoundModel model);
47    /**
48     * Deletes the given keyphrase sound model for the current user.
49     *
50     * @param keyphraseId The unique identifier for the keyphrase.
51     * @param bcp47Locale The BCP47 language tag  for the keyphrase's locale.
52     */
53    int deleteKeyphraseSoundModel(int keyphraseId, in String bcp47Locale);
54
55    /**
56     * Gets the properties of the DSP hardware on this device, null if not present.
57     */
58    SoundTrigger.ModuleProperties getDspModuleProperties(in IVoiceInteractionService service);
59    /**
60     * Indicates if there's a keyphrase sound model available for the given keyphrase ID.
61     * This performs the check for the current user.
62     *
63     * @param service The current VoiceInteractionService.
64     * @param keyphraseId The unique identifier for the keyphrase.
65     * @param bcp47Locale The BCP47 language tag  for the keyphrase's locale.
66     */
67    boolean isEnrolledForKeyphrase(IVoiceInteractionService service, int keyphraseId,
68            String bcp47Locale);
69    /**
70     * Starts a recognition for the given keyphrase.
71     */
72    int startRecognition(in IVoiceInteractionService service, int keyphraseId,
73            in String bcp47Locale, in IRecognitionStatusCallback callback,
74            in SoundTrigger.RecognitionConfig recognitionConfig);
75    /**
76     * Stops a recognition for the given keyphrase.
77     */
78    int stopRecognition(in IVoiceInteractionService service, int keyphraseId,
79            in IRecognitionStatusCallback callback);
80}
81