blob: 46fa6ef3b783b6f263ec8c89b951f61b8e1f2d20 [file] [log] [blame]
Andreas Huberdab5fc62016-08-15 09:25:02 -07001/*
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
17package android.os;
18
Steven Morelande8e63aa2018-01-10 15:45:36 -080019import android.annotation.SystemApi;
Steven Morelandcbba4c72019-01-11 10:19:51 -080020import android.annotation.TestApi;
Steven Morelande8e63aa2018-01-10 15:45:36 -080021
Andreas Huberdab5fc62016-08-15 09:25:02 -070022/** @hide */
Steven Morelande8e63aa2018-01-10 15:45:36 -080023@SystemApi
Steven Morelandcbba4c72019-01-11 10:19:51 -080024@TestApi
Andreas Huberdab5fc62016-08-15 09:25:02 -070025public interface IHwBinder {
Steven Morelandadcb8962018-01-25 10:24:07 -080026 /**
27 * Process a hwbinder transaction.
28 *
Steven Moreland739811a2018-01-30 10:11:40 -080029 * @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 Morelandadcb8962018-01-25 10:24:07 -080033 */
Andreas Huberdab5fc62016-08-15 09:25:02 -070034 public void transact(
Steven Moreland27538df2016-12-20 15:55:48 -080035 int code, HwParcel request, HwParcel reply, int flags)
36 throws RemoteException;
Andreas Huberdab5fc62016-08-15 09:25:02 -070037
Steven Morelandadcb8962018-01-25 10:24:07 -080038 /**
39 * Return as IHwInterface instance only if this implements descriptor.
Steven Moreland739811a2018-01-30 10:11:40 -080040 *
Steven Morelandadcb8962018-01-25 10:24:07 -080041 * @param descriptor for example foo.bar@1.0::IBaz
Steven Morelandadcb8962018-01-25 10:24:07 -080042 */
Andreas Huberdab5fc62016-08-15 09:25:02 -070043 public IHwInterface queryLocalInterface(String descriptor);
Martijn Coenen727f7bf2016-12-27 14:33:09 +010044
45 /**
46 * Interface for receiving a callback when the process hosting a service
47 * has gone away.
48 */
49 public interface DeathRecipient {
Steven Morelande8e63aa2018-01-10 15:45:36 -080050 /**
51 * Callback for a registered process dying.
Steven Moreland739811a2018-01-30 10:11:40 -080052 *
53 * @param cookie cookie this death recipient was registered with.
Steven Morelande8e63aa2018-01-10 15:45:36 -080054 */
Martijn Coenen727f7bf2016-12-27 14:33:09 +010055 public void serviceDied(long cookie);
56 }
57
Steven Morelande8e63aa2018-01-10 15:45:36 -080058 /**
59 * Notifies the death recipient with the cookie when the process containing
60 * this binder dies.
Steven Moreland739811a2018-01-30 10:11:40 -080061 *
62 * @param recipient callback object to be called on object death.
63 * @param cookie value to be given to callback on object death.
Steven Morelande8e63aa2018-01-10 15:45:36 -080064 */
Martijn Coenen727f7bf2016-12-27 14:33:09 +010065 public boolean linkToDeath(DeathRecipient recipient, long cookie);
Steven Morelande8e63aa2018-01-10 15:45:36 -080066 /**
67 * Unregisters the death recipient from this binder.
Steven Moreland739811a2018-01-30 10:11:40 -080068 *
69 * @param recipient callback to no longer recieve death notifications on this binder.
Steven Morelande8e63aa2018-01-10 15:45:36 -080070 */
Martijn Coenen727f7bf2016-12-27 14:33:09 +010071 public boolean unlinkToDeath(DeathRecipient recipient);
Andreas Huberdab5fc62016-08-15 09:25:02 -070072}