fix(android): apply settings airplane through the connectivity service - #2234
Conversation
settings airplane wrote airplane_mode_on and then broadcast android.intent.action.AIRPLANE_MODE, which Android refuses for non-system callers. The write landed, the broadcast failed, and the device reported airplane mode with the radios still up. The connectivity service now owns the change: it is read to prove the build supports airplane mode before anything is written, driven with cmd connectivity airplane-mode enable|disable, and read again so the response reports the mode connectivity holds rather than the one requested. Builds without that command are refused unmutated with UNSUPPORTED_OPERATION. Closes #2223
|
Size Report
npm unpacked components
Startup median (7 runs, lower is better):
Top changed chunks:
Top changed packed files
|
|
Reviewed exact head
Otherwise the fix is sound: the public Android owner follows connectivity read → write → read, reports observed state, removes the dirty settings/broadcast path, has credible revert-red focused tests and built-CLI emulator round-trip evidence, and updates help/docs/changelog. Size is healthy ( |
Splitting the airplane owner out of settings.ts adds one module to the mechanics facet, which is implementation-eager by design. The row moves to the measured number in the PR that grows it.
…mode An unrecognized nonzero probe — a permission denial, a connectivity-service error — was answered with "requires Android 11; use a newer device". Only the prose adb prints when a build ships no shell implementation for the command now selects UNSUPPORTED_OPERATION; every other failed read stays COMMAND_FAILED with its classified hint, and the write is unreachable from both. The predicate that reads that prose already existed for the clipboard service and is now named for the question it answers, so airplane mode reuses it instead of adding a second message sniff.
|
Both blockers are addressed at 1. Unsupported detection narrowed to capability absence. The predicate that reads that prose already existed as Regression coverage, all red against
2. Eager-closure budget owned, not dodged. Re-validated the round trip on the same emulator (
|
|
Re-reviewed exact head The prior failure-classification blocker is fixed: unsupported detection is limited to explicit missing-shell/unknown-command output, while the SecurityException closest-negative remains Non-blocking PR-body cleanup: it still says seven scenarios and six files; the current head has eight scenarios and 11 changed files. Please update those counts and record the green exact-head CI. |
Summary
settings airplane on|offdid not take an Android device offline, and it failed after changingdevice state. The Android owner wrote
airplane_mode_onand then broadcastandroid.intent.action.AIRPLANE_MODE, which Android refuses for non-system callers, so the commandsurfaced
COMMAND_FAILEDwhile the device reported airplane mode with the radios still up —anything reading
airplane_mode_onsaw a state that traffic contradicted.Airplane mode is now applied by the component that owns it.
cmd connectivity airplane-modebothdrives the connectivity stack and reports the state, so the owner:
cannot answer is refused with
UNSUPPORTED_OPERATIONbefore anything is written, so the write isunreachable rather than guarded;
that was requested;
settings putand no broadcast on any path.Per triage the old write/broadcast pair is not kept as a compatibility fallback: it is known to fail
dirty. Maestro
setAirplaneMode/toggleAirplaneModeparity stays out of scope for a separate issue.Closes #2223
Validation
Live Android emulator (
sdk_gphone64_arm64, release 16 / API 36), through the built CLI at5ebb770b3a:settings airplane onansweredairplaneMode: enabled. Four seconds later the device reportedcmd connectivity airplane-mode=enabled,airplane_mode_on=1, andping 8.8.8.8=connect: Network is unreachable.settings airplane offansweredairplaneMode: disabled, and connectivity came back: statedisabled,airplane_mode_on=0, ping 2/2 received.am broadcast -a android.intent.action.AIRPLANE_MODEfails withSecurityException: Permission Denial … uid=2000.Seven scenarios in
packages/platform-android/src/__tests__/settings-airplane.test.tsdrive thepublic
setAndroidSettingentry: the enable and disable round trips assert the exact adb call list,which is what a revert to
settings put+ broadcast fails; a service that accepts the write withoutchanging state must not be reported as success; unsupported and unreadable builds are refused with
the read as the only call issued; an adb transport failure stays
COMMAND_FAILEDwith its reconnecthint instead of being mistyped as unsupported; and a read that fails only after the change is a
command failure, not an unsupported build. All seven were observed red against the pre-fix owner.
pnpm check:affected --runis green except fortest/integration/provider-scenarios/limrun-ios-snapshot-owner.test.ts,which times out identically on
mainat7ee1a5ded7with this branch checked out or not — apre-existing failure on that iOS provider scenario, untouched by this change.
Notes
settingscommand help, the command reference, and the changelog.
UNSUPPORTED_OPERATIONleaf is fixture-covered only — no pre-Android-11 devicewas available. Nothing can be written on that path, since the write follows the read that refuses.
instantly). The command reference now says so, so callers poll the app under test instead of
asserting offline behaviour on the next line.