App 2.6.0: floating button to open the app

The MG4's launcher does not list third-party apps, so the app could
only be opened by reinstalling it. Now a small round MG-red button
floats over the car's screens: tap opens the app, drag moves it (the
position is kept and clamped to the screen), and it hides while the
app itself is open. A switch in the Upload tab turns it off.

The always-on service owns the overlay, so the button is there from
boot. It needs the overlay permission (SYSTEM_ALERT_WINDOW), which the
car build has through the system UID; without it, or if the window
manager refuses, the button stays away and nothing crashes, and the
Upload tab offers the system permission screen.

Tested on an Android 9 AOSP emulator at the head unit's 1920x1080 /
160 dpi with the car APK (installs as UID 1000): button appears over
the home screen, tap opens the app, hidden while open, drag moves it
without opening the app, position survives a force-stop, the switch
works through the UI. FloatingButtonGeometry has 3 unit tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QLJfZQZeAKAwSqViTmLzki
This commit is contained in:
2026-10-17 22:55:15 +02:00
co-authored by Claude Opus 5.5
parent a53ea589b2
commit 11d53e7bc7
12 changed files with 362 additions and 3 deletions
+6
View File
@@ -107,6 +107,12 @@
<string name="conn_err_timeout">Connection timed out</string>
<string name="conn_err_http">Server error (HTTP %1$d)</string>
<string name="label_floating_button">Show floating button</string>
<string name="hint_floating_button">A small round button over the car\'s screens that opens this app. Drag it to move it; it hides while the app is open.</string>
<string name="overlay_permission_missing">This build may not draw over other apps, so the button cannot appear.</string>
<string name="btn_overlay_permission">Allow display over other apps</string>
<string name="overlay_settings_missing">The system screen for this permission is not available here</string>
<string name="floating_button_description">Open Nils\' MG4</string>
<string name="label_abrp_upload_enabled">Send live telemetry to the server</string>
<string name="hint_abrp_upload_enabled">The server stores it and forwards it to ABRP. Turn this off when another app feeds ABRP; consumption and charging tracking keep running.</string>