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.media.soundtrigger_middleware;
18 
19 import android.media.soundtrigger_middleware.IAcknowledgeEvent;
20 
21 /**
22  * Interface for injecting global events to the fake STHAL.
23  * {@hide}
24  */
25 oneway interface IInjectGlobalEvent {
26 
27     /**
28      * Trigger a fake STHAL restart.
29      * This invalidates the {@link IInjectGlobalEvent}.
30      */
triggerRestart()31     void triggerRestart();
32 
33     /**
34      * Set global resource contention within the fake STHAL. Loads/startRecognition
35      * will fail with {@code RESOURCE_CONTENTION} until unset.
36      * @param isContended - true to enable resource contention. false to disable resource contention
37      *                      and resume normal functionality.
38      * @param callback - Call {@link IAcknowledgeEvent#eventReceived()} on this interface once
39      * the contention status is successfully set.
40      */
setResourceContention(boolean isContended, IAcknowledgeEvent callback)41     void setResourceContention(boolean isContended, IAcknowledgeEvent callback);
42 
43     /**
44      * Trigger an
45      * {@link android.hardware.soundtrigger3.ISoundTriggerHwGlobalCallback#onResourcesAvailable}
46      * callback from the fake STHAL. This callback is used to signal to the framework that
47      * previous operations which failed may now succeed.
48      */
triggerOnResourcesAvailable()49     void triggerOnResourcesAvailable();
50 }
51