Andreas Huber | dab5fc6 | 2016-08-15 09:25:02 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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.os; |
| 18 | |
Steven Moreland | e8e63aa | 2018-01-10 15:45:36 -0800 | [diff] [blame] | 19 | import android.annotation.SystemApi; |
Steven Moreland | 14b9eb6 | 2019-01-11 10:19:51 -0800 | [diff] [blame] | 20 | import android.annotation.TestApi; |
Steven Moreland | e8e63aa | 2018-01-10 15:45:36 -0800 | [diff] [blame] | 21 | |
Andreas Huber | dab5fc6 | 2016-08-15 09:25:02 -0700 | [diff] [blame] | 22 | /** @hide */ |
Steven Moreland | e8e63aa | 2018-01-10 15:45:36 -0800 | [diff] [blame] | 23 | @SystemApi |
Steven Moreland | 14b9eb6 | 2019-01-11 10:19:51 -0800 | [diff] [blame] | 24 | @TestApi |
Andreas Huber | dab5fc6 | 2016-08-15 09:25:02 -0700 | [diff] [blame] | 25 | public interface IHwBinder { |
Steven Moreland | adcb896 | 2018-01-25 10:24:07 -0800 | [diff] [blame] | 26 | /** |
| 27 | * Process a hwbinder transaction. |
| 28 | * |
Steven Moreland | 739811a | 2018-01-30 10:11:40 -0800 | [diff] [blame] | 29 | * @param code interface specific code for interface. |
| 30 | * @param request parceled transaction |
| 31 | * @param reply object to parcel reply into |
| 32 | * @param flags transaction flags to be chosen by wire protocol |
Steven Moreland | adcb896 | 2018-01-25 10:24:07 -0800 | [diff] [blame] | 33 | */ |
Andreas Huber | dab5fc6 | 2016-08-15 09:25:02 -0700 | [diff] [blame] | 34 | public void transact( |
Steven Moreland | 27538df | 2016-12-20 15:55:48 -0800 | [diff] [blame] | 35 | int code, HwParcel request, HwParcel reply, int flags) |
| 36 | throws RemoteException; |
Andreas Huber | dab5fc6 | 2016-08-15 09:25:02 -0700 | [diff] [blame] | 37 | |
Steven Moreland | adcb896 | 2018-01-25 10:24:07 -0800 | [diff] [blame] | 38 | /** |
| 39 | * Return as IHwInterface instance only if this implements descriptor. |
Steven Moreland | 739811a | 2018-01-30 10:11:40 -0800 | [diff] [blame] | 40 | * |
Steven Moreland | adcb896 | 2018-01-25 10:24:07 -0800 | [diff] [blame] | 41 | * @param descriptor for example foo.bar@1.0::IBaz |
Steven Moreland | adcb896 | 2018-01-25 10:24:07 -0800 | [diff] [blame] | 42 | */ |
Andreas Huber | dab5fc6 | 2016-08-15 09:25:02 -0700 | [diff] [blame] | 43 | public IHwInterface queryLocalInterface(String descriptor); |
Martijn Coenen | 727f7bf | 2016-12-27 14:33:09 +0100 | [diff] [blame] | 44 | |
| 45 | /** |
| 46 | * Interface for receiving a callback when the process hosting a service |
| 47 | * has gone away. |
| 48 | */ |
| 49 | public interface DeathRecipient { |
Steven Moreland | e8e63aa | 2018-01-10 15:45:36 -0800 | [diff] [blame] | 50 | /** |
| 51 | * Callback for a registered process dying. |
Steven Moreland | 739811a | 2018-01-30 10:11:40 -0800 | [diff] [blame] | 52 | * |
| 53 | * @param cookie cookie this death recipient was registered with. |
Steven Moreland | e8e63aa | 2018-01-10 15:45:36 -0800 | [diff] [blame] | 54 | */ |
Martijn Coenen | 727f7bf | 2016-12-27 14:33:09 +0100 | [diff] [blame] | 55 | public void serviceDied(long cookie); |
| 56 | } |
| 57 | |
Steven Moreland | e8e63aa | 2018-01-10 15:45:36 -0800 | [diff] [blame] | 58 | /** |
| 59 | * Notifies the death recipient with the cookie when the process containing |
| 60 | * this binder dies. |
Steven Moreland | 739811a | 2018-01-30 10:11:40 -0800 | [diff] [blame] | 61 | * |
| 62 | * @param recipient callback object to be called on object death. |
| 63 | * @param cookie value to be given to callback on object death. |
Steven Moreland | e8e63aa | 2018-01-10 15:45:36 -0800 | [diff] [blame] | 64 | */ |
Martijn Coenen | 727f7bf | 2016-12-27 14:33:09 +0100 | [diff] [blame] | 65 | public boolean linkToDeath(DeathRecipient recipient, long cookie); |
Steven Moreland | e8e63aa | 2018-01-10 15:45:36 -0800 | [diff] [blame] | 66 | /** |
| 67 | * Unregisters the death recipient from this binder. |
Steven Moreland | 739811a | 2018-01-30 10:11:40 -0800 | [diff] [blame] | 68 | * |
| 69 | * @param recipient callback to no longer recieve death notifications on this binder. |
Steven Moreland | e8e63aa | 2018-01-10 15:45:36 -0800 | [diff] [blame] | 70 | */ |
Martijn Coenen | 727f7bf | 2016-12-27 14:33:09 +0100 | [diff] [blame] | 71 | public boolean unlinkToDeath(DeathRecipient recipient); |
Andreas Huber | dab5fc6 | 2016-08-15 09:25:02 -0700 | [diff] [blame] | 72 | } |