MethodChannelPrivKit class

An implementation of PrivKitPlatform that uses method channels.

Inheritance

Constructors

MethodChannelPrivKit()

Properties

hashCode → int
The hash code for this object.
no setterinherited
methodChannel → MethodChannel
The method channel used to interact with the native platform.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serverState → Stream<PrivServerInfo?>
Process-wide connection state of the Privileged Server.
no setteroverride
serverStateChannel → EventChannel
Event channel carrying Privilege.serverState.
final
startupLog → Stream<PrivStartupLogLine>
Diagnostic lines emitted while a start operation is running.
no setteroverride
startupLogChannel → EventChannel
Event channel carrying startup diagnostics.
final

Methods

adbCheckPairing({String? adbDeviceName, int? port, int? portDiscoveryTimeoutMillis}) → Future<PrivAdbPairingCheckResult>
One-shot check of whether this app's ADB key is already authorized.
override
adbCheckPairingSession(int sessionId) → Future<PrivAdbPairingCheckResult>
Runs one check on a session opened by adbOpenPairingCheckSession.
override
adbCheckTcpAuthorization({String? adbDeviceName, int? tcpPort}) → Future<PrivAdbAuthorizationCheckResult>
One-shot authorization check against the static TCP port.
override
adbCheckTcpAuthorizationSession(int sessionId) → Future<PrivAdbAuthorizationCheckResult>
Runs one check on a session opened by adbOpenTcpAuthorizationCheckSession.
override
adbDiscoverConnectPort({String? adbDeviceName, int? timeoutMillis}) → Future<int>
Discovers the Wireless Debugging connect port.
override
adbDiscoverPairingPort({String? adbDeviceName, int? timeoutMillis}) → Future<int>
Discovers the Wireless Debugging pairing port.
override
adbGetActiveTcpPort({String? adbDeviceName}) → Future<int?>
The static ADB port adbd is currently listening on, if any.
override
adbGetConfiguredTcpPort({String? adbDeviceName}) → Future<int?>
The static ADB port previously configured by this app, if any.
override
adbGetIdentityInfo({String? adbDeviceName}) → Future<PrivAdbIdentityInfo>
ADB identity of this app, including its public key fingerprint.
override
adbGetWirelessDebuggingControlStatus({String? adbDeviceName}) → Future<PrivAdbWirelessDebuggingControlStatus>
Whether Priv Kit can manage Wireless Debugging on this device.
override
adbOpenPairingCheckSession({String? adbDeviceName, int? port, int? portDiscoveryTimeoutMillis}) → Future<int>
Opens a persistent pairing check session and returns its handle.
override
adbOpenTcpAuthorizationCheckSession({String? adbDeviceName, int? tcpPort}) → Future<int>
Opens a persistent TCP authorization check session, returns its handle.
override
adbPair({required String pairingCode, String? adbDeviceName, int? port, int? portDiscoveryTimeoutMillis}) → Future<PrivAdbPairingResult>
Pairs this app's ADB key with a six digit Wireless Debugging code.
override
adbPrepareTcpForStart({String? adbDeviceName, int? tcpPort}) → Future<PrivAdbAuthorizationCheckResult>
Checks and, when possible, restores the static TCP port before a start.
override
adbRequestTcpAuthorization({String? adbDeviceName, int? tcpPort, int? timeoutMillis}) → Future<PrivAdbAuthorizationRequestResult>
Requests authorization on the static TCP port and waits for the user.
override
adbRestartTcp({String? adbDeviceName, int? tcpPort, PrivAdbConnectionOptions? options}) → Future<PrivAdbTcpResult>
Restarts the static ADB port.
override
adbStopTcp({String? adbDeviceName, int? tcpPort, PrivAdbConnectionOptions? options}) → Future<PrivAdbTcpResult>
Stops the static ADB port.
override
adbSwitchToTcp({String? adbDeviceName, int? tcpPort, PrivAdbConnectionOptions? options}) → Future<PrivAdbTcpResult>
Switches adbd to TCP/IP mode on tcpPort (adb tcpip).
override
cancelCommand(String commandId) → Future<void>
Cancels a running command and releases its resources.
override
cancelOperation(String operationId) → Future<void>
Cancels a start operation previously launched with operationId.
override
checkPermission({required String permission, required String packageName, int? userId}) → Future<int>
Checks permission against packageName.
override
checkServerPermission(String permission) → Future<int>
Checks one permission against the connected server.
override
closeSession(int sessionId) → Future<void>
Closes a session opened by adbOpenPairingCheckSession or adbOpenTcpAuthorizationCheckSession.
override
commandEvents(String commandId) → Stream<PrivCommandEvent>
Events of the command previously started with startCommand.
override
configureRuntime({int? followDeathDelayMillis, bool? activeReconnectOnOwnerDeath}) → Future<void>
Replaces the owner-death reconnect policy.
override
connectReadyServer() → Future<PrivServerInfo?>
Connects a server that has already announced itself, if any.
override
externalStartupRunInCurrentProcess({required String commandLine, PrivExternalStartupOptions? options}) → Future<String>
Runs commandLine through /system/bin/sh in this app's own process.
override
externalStartupRunThroughBridge({required String commandLine, required String bridgeId, PrivExternalStartupBridgeOptions? options}) → Future<String>
Runs commandLine through an app-registered external startup bridge.
override
fileCanExecute(String path) → Future<bool>
Whether path can be executed.
override
fileCanRead(String path) → Future<bool>
Whether path can be read.
override
fileCanWrite(String path) → Future<bool>
Whether path can be written.
override
fileClose(int handle) → Future<void>
Closes a stream handle opened by fileOpenRead or fileOpenWrite.
override
fileCreateNewFile(String path) → Future<bool>
Creates path as a new empty file.
override
fileDelete(String path) → Future<bool>
Deletes path. A directory must be empty.
override
fileDeleteRecursively(String path) → Future<bool>
Deletes path and, when it is a directory, all of its descendants.
override
fileExists(String path) → Future<bool>
Whether path exists.
override
fileIsDirectory(String path) → Future<bool>
Whether path is a directory.
override
fileIsFile(String path) → Future<bool>
Whether path is a regular file.
override
Whether path is a symbolic link.
override
fileLastModified(String path) → Future<int>
Last modification time of path, in milliseconds since the epoch.
override
fileLength(String path) → Future<int>
Size of path in bytes.
override
fileMetadata(String path, {bool followSymbolicLinks = false}) → Future<PrivFileMetadata>
Reads one metadata snapshot of path.
override
fileMkdir(String path) → Future<bool>
Creates path as a directory, requiring its parent to exist.
override
fileMkdirs(String path) → Future<bool>
Creates path as a directory, creating missing parents.
override
fileOpenRead(String path) → Future<int>
Opens path for reading and returns the stream handle.
override
fileOpenWrite(String path, {bool append = false, bool syncOnClose = false}) → Future<int>
Opens path for writing and returns the stream handle.
override
fileRead(int handle, {int maxBytes = privilegeFileDefaultReadChunkBytes}) → Future<Uint8List>
Reads up to maxBytes from handle. An empty list means end of file.
override
fileRenameTo(String from, String to) → Future<bool>
Renames from to to.
override
fileReplaceAtomically(String from, String to) → Future<void>
Atomically renames from over to.
override
fileWalkEntries(String operationId) → Stream<PrivFileEntry>
Entries of the walk previously started with fileWalkStart.
override
fileWalkStart(String operationId, String path, {int? maxDepth, List<String>? skipDirectoryGlobs, int? flushBatchSize}) → Future<void>
Starts a directory walk and keeps it under operationId.
override
fileWrite(int handle, Uint8List bytes) → Future<void>
Writes bytes to handle.
override
getDeniedServerPermissions() → Future<List<String>>
Permissions declared for the server's packages but denied to its process.
override
getNativeStarterCommand() → Future<String>
The device-side shell command that starts the native starter.
override
getRuntimeConfig() → Future<PrivRuntimeConfig>
The current owner-death reconnect policy.
override
getServerInfo() → Future<PrivServerInfo>
The connected server. Throws when no server is connected.
override
getServerState() → Future<PrivServerInfo?>
The currently connected server, or null.
override
grantRuntimePermission({required String packageName, required String permission, int? userId}) → Future<void>
Grants permission to packageName.
override
isPermissionRestricted() → Future<bool>
Whether the connected server cannot grant runtime permissions.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pingServer() → Future<bool>
Pings the server Binder, clearing the connection when it is dead.
override
prepareOwnerRestart({required int passiveReconnectTimeoutMillis}) → Future<void>
Tells the connected server that this owner process is about to restart.
override
revokeRuntimePermission({required String packageName, required String permission, int? userId}) → Future<void>
Revokes permission from packageName.
override
runCommand(PrivCommand command, {int? timeoutMillis, int? maxBytesPerStream}) → Future<PrivCommandResult>
Starts command and drains both streams to completion.
override
shutdownServer() → Future<void>
Shuts the connected server down and clears the local connection.
override
startAdb({PrivAdbConnectionOptions? options, int? timeoutMillis, String? adbDeviceName, String? operationId}) → Future<PrivServerInfo>
Starts the Privileged Server through ADB.
override
startCommand(String commandId, PrivCommand command, {int? timeoutMillis}) → Future<void>
Starts command for streaming consumption and keeps it under commandId.
override
startRoot({int? timeoutMillis, String? operationId}) → Future<PrivServerInfo>
Starts the Privileged Server through su.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

commandChannelPrefix → const String
Prefix of the per-command event channels.
fileWalkChannelPrefix → const String
Prefix of the per-walk event channels, for the same reason.