feat(settings): add Android mobile-data on|off
MI
7h ago+752+752+012345678901234567890123456789-44-44-01234567890123456789
Summary
Adds settings mobile-data on|off for Android, so a run on a streaming app can move from Wi-Fi to cellular and back and check the "streaming on mobile data" warnings.
agent-device settings wifi off
agent-device settings mobile-data on # mobileData: enabled
Node: client.settings.update({ setting: 'mobile-data', state: 'off' })
- Picks the stored row before changing anything:
mobile_data<subId>with more than one active modem (persist.radio.multisim.config), otherwisemobile_data. Then runssvc data enable|disableand polls that row for up to 2 s. - No match fails with
mobile-data-not-appliedormobile-data-unreadable, and says whether the switch was dispatched. - Every non-Android target refuses up front with
UNSUPPORTED_OPERATION(setting-unsupported-on-leaf).--appis refused withsetting_app_not_consumed. - 19 files, +752/−44, including help, docs and CHANGELOG.
Test plan
Use an Android emulator or phone with a SIM. S is its adb serial.
pnpm build && pnpm build:android && pnpm clean:daemonpnpm ad settings mobile-data off --platform android --serial $S --jsonreturnsmobileData: disabled, andadb -s $S shell settings get global mobile_dataprints 0.onreturnsenabledand 1.- Run
settings wifi off, thenmobile-data on.adb -s $S shell ping -c 2 8.8.8.8gets replies. Aftermobile-data offit loses every packet. mobile-data off --app com.example.appfails withINVALID_ARGSandsetting_app_not_consumed. The row stays 1.- Restore with
settings wifi onandmobile-data on.
Validation
pnpm check:affected --run passed at 6b94f115. Steps 2 to 4 ran at 124d05f5 (same tree) on an Android 37 emulator with a SIM and an empty multisim config. All passed, and the emulator was restored.
Not covered: the multi-modem row choice. It follows AOSP GlobalSettingsHelper and needs a dual-SIM phone.