1 /*
2  * Copyright (C) 2023 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 
17 package android.service.voice;
18 
19 import android.annotation.IntDef;
20 import android.annotation.SystemApi;
21 
22 import java.lang.annotation.Retention;
23 import java.lang.annotation.RetentionPolicy;
24 
25 /**
26  * This is used by the assistant application to know which action the application should take on a
27  * failure callback. The detector can be a HotwordDector or a visual query detector.
28  *
29  * @hide
30  */
31 @SystemApi
32 public final class FailureSuggestedAction {
33 
34     /**
35      * A suggested action due to an unknown error occurs.
36      */
37     public static final int UNKNOWN = 0;
38 
39     /**
40      * Indicates that an error occurs, but no action is needed for the client. The error will be
41      * recovered from within the framework.
42      */
43     public static final int NONE = 1;
44 
45     /**
46      * Indicates that an error occurs, but no action is needed for the client due to the error can
47      * not be recovered. It means that the detection will not work even though the assistant
48      * application creates the detector again.
49      */
50     public static final int DISABLE_DETECTION = 2;
51 
52     /**
53      * Indicates that the detection service is invalid, the client needs to destroy its detector
54      * first and recreate its detector later.
55      */
56     public static final int RECREATE_DETECTOR = 3;
57 
58     /**
59      * Indicates that the detection has stopped. The client needs to start recognition again.
60      *
61      * Example: The system server receives a Dsp trigger event.
62      */
63     public static final int RESTART_RECOGNITION = 4;
64 
65     /**
66      * @hide
67      */
68     @IntDef({UNKNOWN, NONE, DISABLE_DETECTION, RECREATE_DETECTOR, RESTART_RECOGNITION})
69     @Retention(RetentionPolicy.SOURCE)
70     public @interface FailureSuggestedActionDef {}
71 
FailureSuggestedAction()72     private FailureSuggestedAction() {}
73 }
74