You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
USB screen keeps stale state after the switch from Bluetooth #188
BluetoothConnectionActivity.restartInUsbMode() starts UsbConnectionActivity and then calls finish(). Android creates the new activity first and destroys the old one after. So:
UsbConnectionActivity and its tab fragments take MachineStatusListener.getInstance(), FileSenderListener.getInstance() and ConsoleLoggerListener.getInstance() in onCreate.
Then BluetoothConnectionActivity.onDestroy() (through GrblActivity.onDestroy()) calls resetClass() on all three, which replaces the shared objects.
The USB screen and its fragments keep the old objects, while the serial handlers and the streaming service use the new ones.
Result: in that session the status card does not update, and a selected file is set on the old object that the streaming service does not read. A restart of the app fixes it.
It happens when the app falls back from Bluetooth to USB: no Bluetooth adapter, or the Bluetooth permission is denied.
Expected: the USB screen uses the same shared objects as the rest of the app after the switch.
Found while fixing the streaming start crash (ForegroundServiceDidNotStartInTimeException).
Fixed in PR #192 (branch fix/187-188-lifecycle-state). Reproduced on the emulator with the old code and checked the fix there and on a Pixel 6a with GRBL 1.1f over USB. Closes when the PR is merged.
Activity
zeevy commentedon Oct 10, 2026
Fixed in PR #192 (branch
fix/187-188-lifecycle-state). Reproduced on the emulator with the old code and checked the fix there and on a Pixel 6a with GRBL 1.1f over USB. Closes when the PR is merged.