Repository navigation
Two fixes, both taken from guo-zhc/MiAuto — an independent fork
of this project's 0.1.1 that had already solved them and wrote down the reasoning. Credit where due.
The negotiated canvas was wrong on any panel that is not 1920x720
MainActivity reported the panel as long side first, always, and IccoaManager fell back to a
hardcoded 1920x720. The canvas is fixed at init() time and no API changes it afterwards, so a
portrait head unit or a tablet negotiated a landscape canvas:
- the picture is stretched to fit, and
- UIBC touches are mapped into the actual Surface bounds, so every tap lands somewhere else.
What changed:
| before | 0.1.3 | |
|---|---|---|
| canvas source | long side first from currentWindowMetrics, 1920x720 fallback in the manager |
DeviceDisplay at runtime (window bounds on API 30+, getRealMetrics() below, Resources last), never invented |
| ordering | always long-side-first | follows the screen-orientation setting (ScreenSizePolicy) |
| cannot measure | reported a guess | waits 400 ms and retries, up to six times |
| canvas changed later | stale config re-advertised forever | SDK torn down (deInit()) and re-initialised before reconnecting |
An invalid size is now rejected by IccoaManager.setScreenSize() rather than stored: a zero or
negative canvas becomes a 1x1 negotiation, and nothing later corrects it.
Re-advertising no longer hammers a radio that is still tearing down
After an abnormal disconnect the phone's Wi-Fi P2P group is still being recycled, but the car
re-advertised on a fixed 1.2 s and collected 10003 / 10006 / 10008 back to back — each attempt
pushing the shared radio further out of shape. Consecutive wireless bring-up failures now back off:
1st failure → 1.2 s
2nd → 2.4 s
3rd → 4.8 s
4th and up → 8.0 s (cap)
The streak resets on connect, on WFD ready, and on any non-wireless error code — parameter errors and
cast-start failures have nothing to do with radio recycling and keep the old fixed interval
(ReconnectBackoff).
Verified
- 723 unit tests pass (82 suites), 15 of them new:
ScreenSizePolicyTestpins the ordering for
every orientation value plus both sides of the re-negotiation decision;ReconnectBackoffTest
pins every delay step, the cap, the reset and the error-code classification. check_localization.py: 958 translatable resources × 4 languages, coverage and format arguments OK.- Release APK: 15,224,123 B,
versionCode 4, signed with the same certificate as 0.1.0–0.1.2
(SHA-256 2dbd314e…3373), so it upgrades in place.
Not verified
No real head unit was available: the test device's wireless ADB was closed while this was built.
Nothing here has been exercised on hardware.
The change with the least evidence behind it is the deInit() + re-init path. It is the only way to
apply a new canvas, and it is what the upstream fork does, but if reconnects start failing after a
rotation, that is the first place to look — the log line to search for is
协商画布需重谈.
Upgrade
Install over 0.1.0–0.1.2 without uninstalling (same signing key). The pairing code may change once
after the first launch, because the link is re-initialised with the measured canvas.