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 
19 import android.annotation.SystemApi;
20 
21 /** @hide */
22 @SystemApi
23 public interface IHwBinder {
24     /**
25      * Process a hwbinder transaction.
26      *
27      * @param code interface specific code for interface.
28      * @param request parceled transaction
29      * @param reply object to parcel reply into
30      * @param flags transaction flags to be chosen by wire protocol
31      *
32      * @hide
33      */
34     @SystemApi
transact( int code, HwParcel request, HwParcel reply, int flags)35     public void transact(
36             int code, HwParcel request, HwParcel reply, int flags)
37         throws RemoteException;
38 
39     /**
40      * Return as IHwInterface instance only if this implements descriptor.
41      *
42      * @param descriptor for example foo.bar@1.0::IBaz
43      * @hide
44      */
45     @SystemApi
queryLocalInterface(String descriptor)46     public IHwInterface queryLocalInterface(String descriptor);
47 
48     /**
49      * Interface for receiving a callback when the process hosting a service
50      * has gone away.
51      */
52     @SystemApi
53     public interface DeathRecipient {
54         /**
55          * Callback for a registered process dying.
56          *
57          * @param cookie cookie this death recipient was registered with.
58          */
59         @SystemApi
serviceDied(long cookie)60         public void serviceDied(long cookie);
61     }
62 
63     /**
64      * Notifies the death recipient with the cookie when the process containing
65      * this binder dies.
66      *
67      * @param recipient callback object to be called on object death.
68      * @param cookie value to be given to callback on object death.
69      */
70     @SystemApi
linkToDeath(DeathRecipient recipient, long cookie)71     public boolean linkToDeath(DeathRecipient recipient, long cookie);
72     /**
73      * Unregisters the death recipient from this binder.
74      *
75      * @param recipient callback to no longer recieve death notifications on this binder.
76      */
77     @SystemApi
unlinkToDeath(DeathRecipient recipient)78     public boolean unlinkToDeath(DeathRecipient recipient);
79 }
80