mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 22:05:59 +00:00
fix: droiddeckctl refuses a DROIDDECK_PACKAGE that is not a package name (#896)
The value goes to the device shell inside `am start -n` and `content call --uri`. Anything but a dotted Android package name is refused before adb runs.
This commit is contained in:
1 parent
99381a8f3e
commit
0b8d55d434
2 files changed
+13
No files matched your search
@@ -26,6 +26,7 @@ from adb_device import DeviceResolutionError, resolve_serial
|
||||
# tools/release/variants.txt: the same app also ships as other packages (e.g. com.antutu.benchmark.full).
|
||||
PACKAGE = os.environ.get("DROIDDECK_PACKAGE", "com.droiddeck.launcher")
|
||||
AUTHORITY = f"content://{PACKAGE}.agent"
|
||||
PACKAGE_NAME = re.compile(r"[A-Za-z][A-Za-z0-9_]*(\.[A-Za-z][A-Za-z0-9_]*)+")
|
||||
STEAM_CLIENT_APP = 769
|
||||
REQUEST_CAP = 256 * 1024
|
||||
|
||||
@@ -886,6 +887,8 @@ def main(argv: list[str] | None = None) -> int:
|
||||
args = build_parser().parse_args(argv)
|
||||
serial = None
|
||||
try:
|
||||
if not PACKAGE_NAME.fullmatch(PACKAGE): # it reaches the device shell through `am start` and `content call`
|
||||
raise ControlError(f"DROIDDECK_PACKAGE is not an Android package name: {PACKAGE!r}", "INVALID_REQUEST")
|
||||
adb = adb_path(args.adb)
|
||||
serial = resolve_serial(adb, args.serial, log=True)
|
||||
result = execute(args, adb, serial)
|
||||
|
||||
Reference in new issue
Block a user