Answer install dialogs without ever tapping a closed one

Three things went wrong in this script and are fixed here, each with the run that showed it. It remembered a button position and tapped it without re-checking the dialog was still there, so a tap landed on the Telegram icon on the home screen behind a dialog that had already closed; it refused to answer a second dialog because it compared window tokens, and every dialog gets a new one, so the third install in a run was skipped; and its idle poll was so slow that a pair of installs could not both be caught. Now: the position is only used while an installer window is focused, re-checked immediately before the tap; a newer dialog with the same installer activity is answered rather than skipped; and after every dialog the script watches at 0.4 s for the follow-up install. Verified with two consecutive uninstall/install cycles, the second answered from the measured position five seconds after the first, and by installing the release APK with only the watcher running. The benchmark's own reinstall is still refused - two dialogs answered during one run, both with the installer focused, and pm install still returned Install canceled by user, because MIUI closes the dialog when the session is over.
This commit is contained in:
2026-10-17 14:23:55 +02:00
parent b91198fe6b
commit 904b74773d
2 changed files with 155 additions and 55 deletions
+4 -1
View File
@@ -101,7 +101,10 @@ reads the button and taps it), and it does **not** work for the one that matters
- It is `FLAG_SECURE`: a `screencap` taken while `mCurrentFocus` was the installer shows the home screen
behind it, which is why screenshots of "the dialog" show nothing.
- A tap on it, when a run did stay up long enough for the script to read and tap `Installieren`, still
ended with `INSTALL_FAILED_USER_RESTRICTED: Install canceled by user`.
ended with `INSTALL_FAILED_USER_RESTRICTED: Install canceled by user`. The same happened later with the
script answering *two* dialogs in one run from a measured button position, each logged with the
installer window still focused: the install was refused anyway. MIUI is closing its own dialog when the
install session ends, so the tap arrives after the outcome has been decided.
- `pm install` started from an *app* uid does not even reach the gate: MIUI's `XSpaceManagerServiceImpl`
throws `SecurityException: You either need MANAGE_USERS or CREATE_USERS permission to: query users`.
So the rule's install runs through the shell, MIUI intercepts it as an "Install via USB" request, and