1 /* 2 * Copyright (C) 2019 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 /* 18 * This file is auto-generated in Android Studio for BinderExploitTest. DO NOT MODIFY. 19 */ 20 package android.security.cts; 21 22 public interface IBinderExchange extends android.os.IInterface { 23 /** Local-side IPC implementation stub class. */ 24 public static abstract class Stub extends android.os.Binder 25 implements android.security.cts.IBinderExchange { 26 private static final java.lang.String DESCRIPTOR = "android.security.cts.IBinderExchange"; 27 28 /** Construct the stub at attach it to the interface. */ Stub()29 public Stub() { 30 this.attachInterface(this, DESCRIPTOR); 31 } 32 33 /** 34 * Cast an IBinder object into an android.security.cts.IBinderExchange 35 * interface, generating a proxy if needed. 36 */ asInterface(android.os.IBinder obj)37 public static android.security.cts.IBinderExchange asInterface(android.os.IBinder obj) { 38 if ((obj == null)) { 39 return null; 40 } 41 android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR); 42 if (((iin != null) && (iin instanceof android.security.cts.IBinderExchange))) { 43 return ((android.security.cts.IBinderExchange) iin); 44 } 45 return new android.security.cts.IBinderExchange.Stub.Proxy(obj); 46 } 47 48 @Override asBinder()49 public android.os.IBinder asBinder() { 50 return this; 51 } 52 53 @Override onTransact( int code, android.os.Parcel data, android.os.Parcel reply, int flags)54 public boolean onTransact( 55 int code, android.os.Parcel data, android.os.Parcel reply, int flags) 56 throws android.os.RemoteException { 57 java.lang.String descriptor = DESCRIPTOR; 58 switch (code) { 59 case INTERFACE_TRANSACTION: { 60 reply.writeString(descriptor); 61 return true; 62 } 63 case TRANSACTION_putBinder: { 64 data.enforceInterface(descriptor); 65 android.os.IBinder _arg0; 66 _arg0 = data.readStrongBinder(); 67 this.putBinder(_arg0); 68 reply.writeNoException(); 69 return true; 70 } 71 case TRANSACTION_getBinder: { 72 data.enforceInterface(descriptor); 73 android.os.IBinder _result = this.getBinder(); 74 reply.writeNoException(); 75 reply.writeStrongBinder(_result); 76 return true; 77 } 78 default: { 79 return super.onTransact(code, data, reply, flags); 80 } 81 } 82 } 83 84 private static class Proxy implements android.security.cts.IBinderExchange { 85 private android.os.IBinder mRemote; 86 Proxy(android.os.IBinder remote)87 Proxy(android.os.IBinder remote) { 88 mRemote = remote; 89 } 90 91 @Override asBinder()92 public android.os.IBinder asBinder() { 93 return mRemote; 94 } 95 getInterfaceDescriptor()96 public java.lang.String getInterfaceDescriptor() { 97 return DESCRIPTOR; 98 } 99 100 @Override putBinder(android.os.IBinder bnd)101 public void putBinder(android.os.IBinder bnd) throws android.os.RemoteException { 102 android.os.Parcel _data = android.os.Parcel.obtain(); 103 android.os.Parcel _reply = android.os.Parcel.obtain(); 104 try { 105 _data.writeInterfaceToken(DESCRIPTOR); 106 _data.writeStrongBinder(bnd); 107 mRemote.transact(Stub.TRANSACTION_putBinder, _data, _reply, 0); 108 _reply.readException(); 109 } finally { 110 _reply.recycle(); 111 _data.recycle(); 112 } 113 } 114 115 @Override getBinder()116 public android.os.IBinder getBinder() throws android.os.RemoteException { 117 android.os.Parcel _data = android.os.Parcel.obtain(); 118 android.os.Parcel _reply = android.os.Parcel.obtain(); 119 android.os.IBinder _result; 120 try { 121 _data.writeInterfaceToken(DESCRIPTOR); 122 mRemote.transact(Stub.TRANSACTION_getBinder, _data, _reply, 0); 123 _reply.readException(); 124 _result = _reply.readStrongBinder(); 125 } finally { 126 _reply.recycle(); 127 _data.recycle(); 128 } 129 return _result; 130 } 131 } 132 133 static final int TRANSACTION_putBinder = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0); 134 static final int TRANSACTION_getBinder = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1); 135 } 136 putBinder(android.os.IBinder bnd)137 public void putBinder(android.os.IBinder bnd) throws android.os.RemoteException; 138 getBinder()139 public android.os.IBinder getBinder() throws android.os.RemoteException; 140 } 141