[IMP] todo qemu: shrink the emulator screen so a remote display keeps up

"It launches but it is too slow." The Pixel profile gives 1080x2400 — 2.6
megapixels pushed frame by frame through SSH, in software rendering. The AVD
now declares 540x1140 at 240 dpi: 0.62 megapixel, 4.2 times less. Measured on
the VM after the change: wm size reports 540x1140, and a full-screen capture
drops from 220 KB to 49 KB. Android handles the density and the app does not
notice; whoever wants the real size overrides it with -skin 1080x2400.

The printed command also gained -XC over -X, X11 compression being free on a
remote display, and -no-boot-anim. Checked: ca.erplibre.home relaunched at the
new size, MainActivity resumed.

--- FR ---

« Ça se lance mais c'est trop lent. » Le profil Pixel donne 1080x2400, soit
2,6 mégapixels poussés image par image dans SSH, en rendu logiciel. L'AVD
déclare maintenant 540x1140 à 240 ppp : 0,62 mégapixel, 4,2 fois moins. Mesuré
sur la VM après le changement : « wm size » rend 540x1140, et une capture plein
écran tombe de 220 Ko à 49 Ko. Android gère la densité et l'application ne s'en
aperçoit pas ; qui veut la taille réelle l'écrase par « -skin 1080x2400 ».

La commande affichée gagne aussi « -XC » au lieu de « -X », la compression X11
étant gratuite sur un écran distant, et « -no-boot-anim ». Vérifié :
ca.erplibre.home relancé à la nouvelle taille, MainActivity au premier plan.

Assisted-by: Claude Opus 5
This commit is contained in:
Mathieu Benoit 2026-08-18 03:31:53 -04:00
parent 07b4c81207
commit ef57e1a097
2 changed files with 31 additions and 3 deletions

View file

@ -5939,7 +5939,14 @@ class TODO:
'-d "$dev" --force && '
# Rendu logiciel, écrit dans la config : par ssh -X il n'y a pas de
# GLX direct, et « auto » donnerait un écran noir.
'printf "hw.gpu.enabled=yes\\nhw.gpu.mode=swiftshader_indirect\\n" '
# L'écran, RÉDUIT, et c'est ce réglage qui décide du confort. Le
# profil Pixel donne 1080x2400, soit 2,6 Mpixels à pousser
# image par image à travers SSH, en rendu logiciel : « ça se
# lance mais c'est trop lent ». En 540x1140 il en reste
# 0,62 Mpixel — 4,2 fois moins. Android gère la densité et
# l'application ne s'en aperçoit pas ; qui veut la taille
# réelle l'écrase au lancement par « -skin 1080x2400 ».
'printf "hw.gpu.enabled=yes\\nhw.gpu.mode=swiftshader_indirect\\nhw.lcd.width=540\\nhw.lcd.height=1140\\nhw.lcd.density=240\\n" '
">> $HOME/.android/avd/erplibre.avd/config.ini' && "
f'echo " ✅ {t("AVD ready:")} '
"$(cat $HOME/.erplibre-avd-device) / "
@ -5954,7 +5961,11 @@ class TODO:
# à ces commandes, et « emulator » y répond « command not
# found ». Vécu, sur la ligne que ce message affichait lui-même.
f'echo " {t("open it from your workstation:")} '
'ssh -X erplibre@$ip \\"$HOME/android/emulator/emulator -avd erplibre -no-audio\\""; '
# « -XC » et non « -X » : la compression X11 change tout sur un
# écran distant. « -no-boot-anim » retire une animation qui
# ne sert qu'à faire attendre.
'ssh -XC erplibre@$ip \\"$HOME/android/emulator/emulator '
'-avd erplibre -no-audio -no-boot-anim\\""; '
f'echo " {t("then install the APK:")} '
# « -t » : l'ABI injectée fait marquer l'APK « testOnly » par AGP,
# et adb le refuse sans ce drapeau — « INSTALL_FAILED_TEST_ONLY ».

View file

@ -386,6 +386,23 @@ class TestAndroidEmulator(unittest.TestCase):
"avd", self.todo._qemu_tools_for(("avd",), "amd64", "", "ubuntu")
)
def test_the_screen_is_small_enough_to_travel(self):
"""Le profil Pixel donne 1080x2400 : 2,6 Mpixels par image à pousser
dans SSH, et « ça se lance mais c'est trop lent ». Mesuré après
réduction : 540x1140 confirmé par « wm size », et la capture pleine
page tombe de 220 Ko à 49 Ko."""
for key in (
"hw.lcd.width=540",
"hw.lcd.height=1140",
"hw.lcd.density=240",
):
self.assertIn(key, self.cmd, key)
def test_the_printed_command_compresses_the_display(self):
"""« -XC » plutôt que « -X » sur un écran distant."""
self.assertIn("ssh -XC erplibre@$ip", self.cmd)
self.assertNotIn("ssh -X erplibre@$ip", self.cmd.replace("-XC", ""))
def test_software_rendering_is_written_into_the_avd(self):
"""Par « ssh -X » il n'y a pas de GLX direct : en « auto »,
l'émulateur s'ouvre sur un écran noir. Le réglage va dans config.ini
@ -417,7 +434,7 @@ class TestAndroidEmulator(unittest.TestCase):
def test_it_prints_the_command_to_open_it(self):
"""Un émulateur dont on ignore comment l'ouvrir ne sert à personne."""
self.assertIn("ssh -X erplibre@$ip", self.cmd)
self.assertIn("ssh -XC erplibre@$ip", self.cmd)
self.assertIn("adb install -r", self.cmd)
def test_the_printed_commands_use_absolute_paths(self):