package android.support.v4.media.session; import android.os.Binder; import android.os.IBinder; import android.os.IInterface; import android.os.Parcel; import android.os.RemoteException; import android.view.KeyEvent; /* loaded from: classes.dex */ public interface IMediaSession extends IInterface { void a(IMediaControllerCallback iMediaControllerCallback) throws RemoteException; boolean a(KeyEvent keyEvent) throws RemoteException; public static abstract class Stub extends Binder implements IMediaSession { public static IMediaSession a(IBinder iBinder) { if (iBinder == null) { return null; } IInterface queryLocalInterface = iBinder.queryLocalInterface("android.support.v4.media.session.IMediaSession"); return (queryLocalInterface == null || !(queryLocalInterface instanceof IMediaSession)) ? new Proxy(iBinder) : (IMediaSession) queryLocalInterface; } private static class Proxy implements IMediaSession { private IBinder a; Proxy(IBinder iBinder) { this.a = iBinder; } @Override // android.support.v4.media.session.IMediaSession public boolean a(KeyEvent keyEvent) throws RemoteException { Parcel obtain = Parcel.obtain(); Parcel obtain2 = Parcel.obtain(); try { obtain.writeInterfaceToken("android.support.v4.media.session.IMediaSession"); if (keyEvent != null) { obtain.writeInt(1); keyEvent.writeToParcel(obtain, 0); } else { obtain.writeInt(0); } this.a.transact(2, obtain, obtain2, 0); obtain2.readException(); return obtain2.readInt() != 0; } finally { obtain2.recycle(); obtain.recycle(); } } @Override // android.os.IInterface public IBinder asBinder() { return this.a; } @Override // android.support.v4.media.session.IMediaSession public void a(IMediaControllerCallback iMediaControllerCallback) throws RemoteException { Parcel obtain = Parcel.obtain(); Parcel obtain2 = Parcel.obtain(); try { obtain.writeInterfaceToken("android.support.v4.media.session.IMediaSession"); obtain.writeStrongBinder(iMediaControllerCallback != null ? iMediaControllerCallback.asBinder() : null); this.a.transact(3, obtain, obtain2, 0); obtain2.readException(); } finally { obtain2.recycle(); obtain.recycle(); } } } } }