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