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