Arthur Ishiguro | a257b78 | 2021-08-04 10:40:29 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 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.hardware.contexthub; |
| 18 | |
| 19 | import android.hardware.contexthub.AsyncEventType; |
| 20 | import android.hardware.contexthub.ContextHubMessage; |
| 21 | import android.hardware.contexthub.NanoappInfo; |
| 22 | |
| 23 | @VintfStability |
| 24 | interface IContextHubCallback { |
| 25 | /** |
| 26 | * This callback is passed by the Contexthub service to the HAL |
| 27 | * implementation to allow the HAL to send information about the |
| 28 | * currently loaded and active nanoapps on the hub. |
| 29 | * |
| 30 | * @param appInfo vector of HubAppinfo structure for each nanoApp |
| 31 | * on the hub that can be enabled, disabled and |
| 32 | * unloaded by the service. Any nanoApps that cannot |
| 33 | * be controlled by the service must not be reported. |
| 34 | * All nanoApps that can be controlled by the service |
| 35 | * must be reported. |
| 36 | */ |
| 37 | void handleNanoappInfo(in NanoappInfo[] appInfo); |
| 38 | |
| 39 | /** |
| 40 | * This callback is passed by the Contexthub service to the HAL |
| 41 | * implementation to allow the HAL to send asynchronous messages back |
| 42 | * to the service and registered clients of the ContextHub service. |
| 43 | * |
| 44 | * @param msg message that should be delivered to host app |
| 45 | * clients |
| 46 | * @param msgContentPerms list of Android permissions that cover the |
| 47 | * contents of the message being sent from the app. |
| 48 | * This is different from the permissions stored |
| 49 | * inside of ContextHubMsg in that these must be a |
| 50 | * subset of those permissions and are meant to |
| 51 | * assist in properly attributing the message |
| 52 | * contents when delivering to a ContextHub service |
| 53 | * client. |
| 54 | */ |
| 55 | void handleContextHubMessage(in ContextHubMessage msg, in String[] msgContentPerms); |
| 56 | |
| 57 | /** |
| 58 | * This callback is passed by the Contexthub service to the HAL |
| 59 | * implementation to allow the HAL to send an asynchronous event |
| 60 | * to the ContextHub service. |
| 61 | * |
| 62 | * @param evt event being sent from the contexthub |
| 63 | * |
| 64 | */ |
| 65 | void handleContextHubAsyncEvent(in AsyncEventType evt); |
| 66 | |
| 67 | /** |
| 68 | * This callback is passed by the Contexthub service to the HAL |
| 69 | * implementation to allow the HAL to send the response for a |
| 70 | * transaction. |
| 71 | * |
| 72 | * @param transactionId The ID of the transaction associated with this callback |
| 73 | * @param success true if the transaction succeeded, false otherwise |
| 74 | * |
| 75 | */ |
| 76 | void handleTransactionResult(in int transactionId, in boolean success); |
| 77 | } |