CI runs `dart format --output=none --set-exit-if-changed .` across the whole
repo, vendored packages included, so the upstream file's own formatting fails
the analyze check. Same wall #694 hit on the vendored Android plugin, resolved
the same way there (b33e8485, chore(#696)).
Formatting only: no logic change, and the C++ that carries the actual fix is
untouched. Re-vendoring upstream later means re-running dart format on this
file, which the two-commit structure (pristine import, then patch) keeps
obvious.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Upstream flutter_blue_plus_winrt never populates gatt_sessions_ or
mtu_tokens_, so OnMtuChanged never fires and the Dart MTU cache stays at
the 23-byte default for the whole session (#683 diagnosis). Add
CreateGattSessionAsync, fired after the connect result is reported:
GattSession::FromDeviceIdAsync, store under gatt_cache_mutex_ (never held
across a co_await), subscribe MaxPduSizeChanged, emit the initial value,
and undo via ClearDeviceResources if the device drops mid-creation.
MaintainConnection is never set (#688). The destructor now revokes MTU
tokens and closes sessions, same use-after-free class upstream fixed for
connection tokens in 7b4504a2. Existing ClearDeviceResources and the
requestMtu read path work unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
App-side half of the #592 fix; the plugin-side GattSession patch is a separate
commit on packages/flutter_blue_plus_winrt.
- dependency_overrides points flutter_blue_plus_winrt at the vendored copy
(version 0.0.20+offband.1; interface constraint relaxed to >=8.2.2 since the
Dart layer uses nothing 9.x-only - the 9.x/2.3.x upgrade was deliberately
skipped, owner decision on #685).
- Connector: requestMtu is now attempted on Android only. flutter_blue_plus
throws "android-only" on every other platform before any platform code runs
(#683), so the old call could never succeed off-Android and its failure log
was noise.
- Connector: subscribe to device.mtu and notifyListeners on each value. The
composers read effectiveMaxFrameSize on rebuild, so this is what lets the
message byte budget recover from the 20-byte floor the moment the platform
reports the real MTU, instead of waiting for an unrelated rebuild.
Subscription is cancelled on reconnect and disconnect.
- test/connector/mtu_composer_budget_test.dart: characterizes the collapsed
budgets at the unknown-MTU floor (DM 4 bytes, channel 1 or 0) - the numbers
both field reports reduced to - and the healthy-link budgets. Rescued from
the throwaway diagnosis branch (#683).
- Regenerated plugin registrants picked up plugins missing from the committed
copies (file_selector, screen_retriever, window_manager); stale on dev,
refreshed by pub get after the override.
analyze clean, 958 tests pass.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Pristine, unmodified import of chan150/flutter_blue_plus_winrt at
7b4504a2bf8409e7f01118c870ead435c1b1d681 (MIT, Copyright 2025 Himchan Park;
LICENSE retained). All 14 files hash-verified against the fetched upstream
tarball.
Vendored rather than depended on because no published version reports the BLE
MTU on Windows: gatt_sessions_ is declared but never populated, so the MTU
stays at the 23-byte default and the composer is capped at 0-4 bytes (#592,
diagnosed in #683). Our fix lands as a separate commit on top of this one so
it can be reviewed and re-applied against a future upstream.
Based on master rather than 0.0.19 to pick up two unreleased upstream fixes:
86ef4763 (data race, unbounded caches, teardown use-after-free) and 7b4504a2
(revoke per-device ConnectionStatusChanged handlers on teardown).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI's format gate reflows upstream's line style; formatting-only deviation
from pristine, no content change (same class as the documented EOL
whitespace normalization).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Gemini review (gemini-2.5-pro, docs/llm-consultations) flagged that the
5 s backstop acquired mMethodCallMutex blockingly on the main looper, an
ANR class. It now tryAcquires and re-posts itself after 250 ms when a
callback holds the mutex. The other two findings were verified and
rejected with reasons recorded in the PR body: the disconnectAllDevices
race is pre-existing upstream (and naive mutex acquisition there would
deadlock the flutterRestart path, which already holds the semaphore),
and the untranslated new strings follow this repo's standing l10n
process.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Three changes to FlutterBluePlusPlugin.java, per the #689 diagnosis:
1. onConnectionStateChange(CONNECTED): close the handle a map overwrite
replaces. A replaced handle is unreachable forever and holds the link
and a GATT client slot until process death, which is exactly what the
owner's force-stop evidence showed.
2. disconnect: 5 s backstop. If Android never delivers DISCONNECTED for
the handle we asked to disconnect, force gatt.close(), untrack it, and
synthesize the disconnect event (mirrors the existing
cancel-while-connecting path, reason code 23789259). Also caps the
Dart layer's 35 s wait at ~5 s.
3. disconnect with no tracked handle now logs at WARN so the
orphan fingerprint is visible in exported logs.
Vendored version marked 8.2.2+offband.1.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Pristine import of pub.dev flutter_blue_plus_android-8.2.2 into
packages/, wired via dependency_overrides, mirroring the WinRT vendor
pattern from #686. FBP License v1.4 and BSD NOTICE retained.
Verified against the pub cache file-by-file: 9 of 12 files
byte-identical; AndroidManifest.xml, LICENSE and
FlutterBluePlusPlugin.java differ ONLY in end-of-line whitespace
(1, 4 and 11 lines respectively; the byte-perfect license text also
ships as LICENSE.md, which is byte-identical). No content changes;
verified with git diff --ignore-space-at-eol. Release APK builds
clean against the vendored copy before any patch.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>