mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 04:55:44 +00:00
fix(ctl): reach the broadcast bridge of release variants under another package (#3718)
This commit is contained in:
1 parent
b0f459607d
commit
c72316f5a7
2 files changed
+5
-2
No files matched your search
+2
-1
@@ -108,7 +108,8 @@ def receiver_call(adb: str, serial: str, method: str, arg: str | None, request:
|
||||
raise ControlError(f"{PACKAGE} is not running and this shell has no `content` command to start it; open DroidDeck once", "APP_NOT_RUNNING")
|
||||
call_id = uuid.uuid4().hex[:16]
|
||||
remote = f"/sdcard/Android/data/{PACKAGE}/files/agent-calls/{call_id}.json"
|
||||
command = ["shell", "am", "broadcast", "-a", f"{PACKAGE}.AGENT_CALL", "-p", PACKAGE,
|
||||
# By component: release variants rename the package but not the receiver's intent action.
|
||||
command = ["shell", "am", "broadcast", "-n", f"{PACKAGE}/com.droiddeck.launcher.agent.AgentCallReceiver",
|
||||
"--es", "method", method, "--es", "id", call_id]
|
||||
if arg is not None:
|
||||
command += ["--es", "arg", shlex.quote(arg)]
|
||||
|
||||
@@ -522,7 +522,9 @@ class DroiddeckctlTest(FakeAdbTest):
|
||||
answer = ctl.provider_call("adb", "fake-1", "state", arg="a b", request={"x": 1})
|
||||
self.assertEqual({"ok": True, "command": "state"}, answer)
|
||||
broadcast = next(c for c in calls if c[:2] == ("shell", "am"))
|
||||
self.assertEqual(("shell", "am", "broadcast", "-a", ctl.PACKAGE + ".AGENT_CALL", "-p", ctl.PACKAGE), broadcast[:7])
|
||||
receiver = ctl.PACKAGE + "/com.droiddeck.launcher.agent.AgentCallReceiver"
|
||||
self.assertEqual(("shell", "am", "broadcast", "-n", receiver), broadcast[:5])
|
||||
self.assertNotIn("-a", broadcast)
|
||||
self.assertIn("'a b'", broadcast)
|
||||
self.assertEqual(ctl.encode_request({"x": 1}), broadcast[broadcast.index("request") + 1])
|
||||
call_id = broadcast[broadcast.index("id") + 1]
|
||||
|
||||
Reference in new issue
Block a user