Feature: Support host uninstall on Android and expose uninstall_host
The server's "uninstall host" action is the single-byte TOKEN_UNINSTALL on the main connection. Windows clients have handled it for a long time; the Android client ignored it, so the menu entry silently did nothing there. Handle it in the Android client the only way Android allows: ask the system to uninstall the package. The client first replies with COMMAND_BYE and drops the connection, then opens the package installer's confirmation dialog through the accessibility service, or posts a notification that resumes the dialog from MainActivity when accessibility is off. The user still has to confirm on the device; if they cancel, the client has already left the server and must be reopened by hand. The manifest gains REQUEST_DELETE_PACKAGES, without which the installer activity refuses the request outright. New APKs advertise CLIENT_CAP_UNINSTALL so the server can reject old clients instead of sending a command nobody handles. The new MCP tool uninstall_host is gated on McpManage and McpReadonly=0, rejects Linux and macOS hosts, and offers the same wait=true verification as power_action, reporting went_offline once the host disappears from the online list. Verified on the emulator end to end: the tool returned went_offline after 200 ms, the system dialog appeared, confirming it removed the package. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
fd1b085279
commit
29d7ee1a18
12 files changed
+362
-8
No files matched your search
@@ -38,6 +38,14 @@ class MainActivity : AppCompatActivity() {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
// 卸载主机:无障碍不可用时只发了通知,用户点开后由这里把系统卸载框补出来
|
||||
val pendingUninstall = Uninstaller.consumePending()
|
||||
if (pendingUninstall != null) {
|
||||
Log.i(CaptureService.TAG, "MainActivity: resuming pending uninstall confirm")
|
||||
runCatching { startActivity(pendingUninstall) }
|
||||
finish()
|
||||
return
|
||||
}
|
||||
// MA-01 fix: 系统重建 Activity 时 savedInstanceState != null,
|
||||
// 此时 CaptureService 可能已在运行,不重复弹权限对话框
|
||||
if (savedInstanceState != null) { finish(); return }
|
||||
|
||||
Reference in new issue
Block a user