Documentation
¶
Index ¶
- func ReadRequest(r io.Reader) (descriptor string, code uint32, flags uint32, data []byte, err error)
- func ReadResponse(r io.Reader) (statusCode uint32, data []byte, err error)
- func WriteRequest(w io.Writer, descriptor string, code uint32, flags uint32, data []byte) error
- func WriteResponse(w io.Writer, statusCode uint32, data []byte) error
- type Daemon
- type DaemonOption
- type DaemonOptions
- type RemoteTransport
- type Session
- type SessionOption
- type SessionOptions
- type TransactError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadRequest ¶
func ReadRequest( r io.Reader, ) (descriptor string, code uint32, flags uint32, data []byte, err error)
ReadRequest deserializes a transaction request from r.
func ReadResponse ¶
ReadResponse deserializes a transaction response from r.
func WriteRequest ¶
WriteRequest serializes a transaction request onto w.
Types ¶
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon is a device-side TCP server that forwards binder transactions from a host-side proxy to the Android binder driver.
func NewDaemon ¶
func NewDaemon( ctx context.Context, opts ...DaemonOption, ) (_ *Daemon, _err error)
NewDaemon opens the binder driver and creates a ServiceManager.
type DaemonOption ¶
type DaemonOption interface {
// contains filtered or unexported methods
}
DaemonOption configures a Daemon.
func DaemonOptionListenAddr ¶
func DaemonOptionListenAddr(addr string) DaemonOption
DaemonOptionListenAddr sets the TCP address the daemon listens on.
func DaemonOptionMapSize ¶
func DaemonOptionMapSize(size uint32) DaemonOption
DaemonOptionMapSize sets the mmap size for the binder driver.
type RemoteTransport ¶
type RemoteTransport struct {
// contains filtered or unexported fields
}
RemoteTransport sends binder transactions over TCP to a device-side Daemon. It implements a Transact method compatible with generated proxy code.
func NewRemoteTransport ¶
func NewRemoteTransport( addr string, ) (_ *RemoteTransport, _err error)
NewRemoteTransport connects to the daemon at the given TCP address.
func (*RemoteTransport) Close ¶
func (rt *RemoteTransport) Close() error
Close closes the TCP connection to the daemon.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session orchestrates the full remote-binder-proxy flow: cross-compile and push the daemon, start it, set up port forwarding, and create a RemoteTransport.
func NewSession ¶
func NewSession( ctx context.Context, deviceSerial string, opts ...SessionOption, ) (_ *Session, _err error)
NewSession creates a Session: pushes the daemon to the device, starts it, sets up port forwarding, and connects.
func (*Session) Close ¶
Close kills the daemon, removes the binary, tears down port forwarding, and closes the transport.
func (*Session) Transport ¶
func (s *Session) Transport() *RemoteTransport
Transport returns the RemoteTransport connected to the device daemon.
type SessionOption ¶
type SessionOption interface {
// contains filtered or unexported methods
}
SessionOption configures a Session.
func SessionOptionDaemonBin ¶
func SessionOptionDaemonBin(path string) SessionOption
SessionOptionDaemonBin sets the path to a pre-built daemon binary, skipping cross-compilation.
func SessionOptionLocalPort ¶
func SessionOptionLocalPort(port int) SessionOption
SessionOptionLocalPort sets the local TCP port for ADB forwarding.
func SessionOptionRemotePort ¶
func SessionOptionRemotePort(port int) SessionOption
SessionOptionRemotePort sets the remote TCP port the daemon listens on.
type SessionOptions ¶
type SessionOptions []SessionOption
SessionOptions is a slice of SessionOption.
type TransactError ¶
type TransactError struct {
Descriptor string
Code binder.TransactionCode
StatusCode uint32
}
TransactError indicates that the daemon returned a non-zero status code.
func (*TransactError) Error ¶
func (e *TransactError) Error() string