| 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 |
|
| 17 |
package com.android.internal.app; |
| 18 |
|
| 19 |
import android.media.permission.Identity; |
| 20 |
import com.android.internal.app.ISoundTriggerSession; |
| 21 |
|
| 22 |
/** |
| 23 |
* Service interface for a generic sound recognition model. |
| 24 |
* |
| 25 |
* This interface serves as an entry point to establish a session, associated with a client |
| 26 |
* identity, which exposes the actual functionality. |
| 27 |
* |
| 28 |
* @hide |
| 29 |
*/ |
| 30 |
interface ISoundTriggerService { |
| 31 |
/** |
| 32 |
* Creates a new session. |
| 33 |
* |
| 34 |
* This version is intended to be used when the caller itself is the originator of the |
| 35 |
* operations, for authorization purposes. |
| 36 |
* |
| 37 |
* The pid/uid fields are ignored and will be replaced by those provided by binder. |
| 38 |
* |
| 39 |
* It is good practice to clear the binder calling identity prior to calling this, in case the |
| 40 |
* caller is ever in the same process as the callee. |
| 41 |
* |
| 42 |
* The binder object being passed is used by the server to keep track of client death, in order |
| 43 |
* to clean-up whenever that happens. |
| 44 |
*/ |
| 45 |
ISoundTriggerSession attachAsOriginator(in Identity originatorIdentity, |
| 46 |
IBinder client); |
| 47 |
|
| 48 |
/** |
| 49 |
* Creates a new session. |
| 50 |
* |
| 51 |
* This version is intended to be used when the caller is acting on behalf of a separate entity |
| 52 |
* (the originator) and the sessions operations are to be accounted against that originator for |
| 53 |
* authorization purposes. |
| 54 |
* |
| 55 |
* The caller must hold the SOUNDTRIGGER_DELEGATE_IDENTITY permission in order to be trusted to |
| 56 |
* provide a reliable originator identity. It should follow the best practices for reliably and |
| 57 |
* securely verifying the identity of the originator. |
| 58 |
* |
| 59 |
* It is good practice to clear the binder calling identity prior to calling this, in case the |
| 60 |
* caller is ever in the same process as the callee. |
| 61 |
* |
| 62 |
* The binder object being passed is used by the server to keep track of client death, in order |
| 63 |
* to clean-up whenever that happens. |
| 64 |
*/ |
| 65 |
ISoundTriggerSession attachAsMiddleman(in Identity middlemanIdentity, |
| 66 |
in Identity originatorIdentity, |
| 67 |
IBinder client); |
| 68 |
} |