Files
mg-utility/docs/STARTUP_VEHICLE_SETTINGS.md
MG Utility Bot 56ee717144 Sync full build: speed reactive audio, settings hub, vehicle settings, key remapping, debug console, theme editor, launcher pins, map cache, trip charts, charging/energy/trip dashboards, media notification listener, music player, and docs
New feature: speed reactive audio (Settings > Misc). Pick an MP3 and a dedicated volume; the always-on trip tracker shifts the clip's pitch and playback rate from min to max speed while you drive. Loop-with-speed is the default; a toggle enables layered overlap so speed changes never cut the clip off.

Build script already compiles every module included in this commit.
2026-08-28 18:32:40 +00:00

77 KiB
Raw Permalink Blame History

SAIC vehicle-service settings — implementation specification

Status: implementation backlog, based on the captured MG4 Luxury 2022 firmware

Requested target scope (2026-08-20): inventory all non-ambient settings found in the active SAIC service; add regenerative level 5 as an advanced selectable value; exclude ambient lighting because the target car does not have that hardware.

This document describes how to extend MG Utility so selected driving and vehicle settings are restored when the SAIC vehicle service starts. It is an implementation plan, not a claim that every transaction below is safe or compatible with every MG firmware revision. The values must be validated on the target car before a release that sends writes.

Coding-agent implementation brief

Read this section first. The later sections contain the evidence, complete transaction inventory, value mappings, and validation rationale.

Required outcome

Implement a capability-gated Vehicle settings feature with these rules:

  1. Show every discovered non-ambient setting in the catalog. A row may be writable, Apply-now only, read-only, unsupported, or unavailable; visibility is not permission to write it.
  2. Do not add ambient-lighting UI, preferences, probes, or setters for this vehicle.
  3. Add regenerative value 5 as Level 5 — Regeneration Off (experimental). Use the explicit value list {0, 1, 2, 3, 5}; never store or send the selected row index. Reject 4, 6, and 7.
  4. A fresh install must default every setting to Do not change. Never synthesize Normal/Medium or an Off value when a preference is absent or invalid.
  5. Perform one startup-apply pass per ignition/service session. Never continuously enforce values and never let two app components apply the same profile.
  6. Every setter must be a named, versioned Binder operation followed by getter read-back. Unknown firmware is read-only. Do not probe nearby transaction IDs or write raw VHAL properties.
  7. Safety-critical, command-style, and hardware-moving items stay read-only or deliberate parked Apply-now actions according to the tables below. Never startup- disable ESP, AEB, lane assistance, collision warnings, or another safety system.

Current code that must be corrected

The current implementation has duplicated startup ownership and direct preference access:

Existing location Current problem Required change
EnergyActivity.VehicleGateway Raw gateway is nested in a UI activity and setters only report that a one-way Binder call was queued. Extract/delegate to a shared typed gateway and add read-back results. Keep telemetry consumers working.
MainActivity Binds the service and runs its own eight-attempt startup write loop. It also owns a second drive/regen selector. Remove automatic startup writes. It may display state and invoke the shared manual Apply-now path only.
TripTrackingService Runs another independent eight-attempt startup write loop. Make it the sole owner of the once-per-session startup coordinator.
SettingsActivity Reads/writes legacy keys directly; recovery selection stores the UI index. Route through the repository/catalog and explicit OEM values.
MainActivity recovery dialog Has its own value/label arrays and direct legacy writes. Remove the duplicate editor or make it open the new Vehicle Settings page.

Do not simply add more transactions to the existing duplicated loops. Centralize the catalog, persistence, gateway, and apply logic first.

Files to add

Create these classes in src/cloud/molberg/mgutility/:

File Responsibility
VehicleSettingsCatalog.java Pure definitions: stable setting ID, label, category, service, getter/setter transaction, explicit allowed values, risk, write policy, verifier, and required capability/conditions. Include every non-ambient row in this document.
VehicleSettingsProfile.java Exact supported firmware/profile fingerprint and its permitted definitions. Start with a named MG4 Luxury 2022 profile; unknown profiles expose getters only and zero setters.
VehicleSettingsRepository.java Own vehicle_defaults schema v2, inherit/restore policies, legacy migration, acknowledgements, previous level for regen 5, and last observed/apply results. UI and services must not read raw keys directly.
VehicleSettingsGateway.java Resolve SAIC hub child binders and provide named typed getters/setters. Keep vehiclesetting, vehiclecondition, vehiclecontrol, and vehiclecharging separate.
VehicleSettingsApplyCoordinator.java Build immutable plans; enforce profile/ignition/Park/speed/capability gates; read, write once, settle, read back, and return a result for every row. Deduplicate by Binder generation, profile revision, and ignition session.
VehicleSettingsActivity.java Dedicated landscape UI for current value, desired startup policy, capability state, last result, Apply now, restore, and grouped settings. Do not put dozens of dialogs directly in SettingsActivity.

Small immutable helper classes such as VehicleSettingDefinition, VehicleSettingValue, and VehicleSettingResult may be separate files or nested in the catalog/coordinator. Keep them independent of an Activity so the logic is testable.

If extracting EnergyActivity.VehicleGateway in one change is too disruptive, leave a temporary compatibility facade with that old name which delegates to VehicleSettingsGateway. Existing consumers include ChargingActivity, ChargingAutomation, SpeedTestActivity, VehicleDataProvider, MainActivity, and TripTrackingService; none may lose its current telemetry or charging behavior.

Files to update

File Required edit
SettingsActivity.java Add a Vehicle settings row under Driving that opens VehicleSettingsActivity. Remove/direct existing drive/regen editing to the new repository-backed page.
MainActivity.java Remove its private startup retry loop and duplicate preference editor. Display coordinator status and open VehicleSettingsActivity; do not own automatic writes.
TripTrackingService.java Bind once and invoke VehicleSettingsApplyCoordinator as the sole startup owner. Cancel pending work on disconnect/generation change.
EnergyActivity.java Keep the dashboard read-only. Move or delegate its nested gateway without breaking current data reads.
AndroidManifest.xml Register .VehicleSettingsActivity as non-exported, landscape, matching the other internal activities.
README.md Replace the “only two startup fields” description after the implementation is functional; document supported firmware and safety limitations.

Implement in this order

Step 1 — catalog and profile, no new writes

  1. Add all definitions from sections 3 and 4 to VehicleSettingsCatalog.
  2. Give every row one initial policy: RESTORE, APPLY_NOW, READ_ONLY, or EXCLUDED. Ambient entries are EXCLUDED and must not appear in the target UI.
  3. Add the exact current-firmware transaction map only. Do not combine it with the older com.allgo.rui IDs.
  4. Add a profile matcher using the vehicle-service package version/signature and head- unit build fingerprint. If it cannot select an exact profile, return UNKNOWN_READ_ONLY.

Step 2 — repository and migration

  1. Implement schema v2 described in section 6.
  2. On a fresh install, create no restore policy. Every row resolves to inherit.
  3. On upgrade, migrate existing startup_drive_mode and startup_regenerative_level only when those keys actually exist. Preserve their values; do not materialize Normal/Medium from the current fallback constants.
  4. Store desired policy separately from observed value and last result.
  5. Bind the level-5 acknowledgement to the exact capability profile and warning version. A firmware change invalidates it and returns the policy to inherit.

Step 3 — typed Binder gateway

  1. Bind explicitly to action/package com.saicmotor.service.vehicle.VehicleService.
  2. Resolve child services through IHubService transaction 0x01: vehiclesetting, vehiclecondition, vehiclecontrol, and vehiclecharging.
  3. For a synchronous getter, write the exact interface token, transact with a reply, call readException(), and read the declared type.
  4. For a setter, validate against the selected definition before writing the Parcel. The captured setters are one-way; a true result means queued, not applied.
  5. Do not expose a generic public setInt(transaction, value) API to Activities. Expose named methods or a catalog definition selected from the matched profile.

The first write-capable drive/energy definitions are:

Setting Getter/setter Values to accept initially
Drive mode 0x81/0x82 Eco 2, Normal 3, Sport 4, Snow 6, Custom 7
Regenerative level 0xa0/0xa1 Low 0, Standard 1, High 2, Auto 3, experimental Off 5; reject 4/6/7
Powertrain feel 0x83/0x84 Comfort 1, Normal 2, Sport 3
Steering feel 0x85/0x86 Comfort 1, Normal 2, Sport 3
Brake-pedal feel 0x87/0x88 Normal 0, Comfort 1, Sport 2
One-Pedal Drive 0xa3/0xa4 Off 0, On 1, capability-gated
Energy Saving/Longer Endurance 0xa6/0xa7 Off 0, On 1
Brake to standstill 0xaa/0xab Off 0, On 1

Use the full tables in sections 3 and 4 for ADAS, convenience, diagnostics, control, and charging definitions. Do not invent enum meanings for rows whose values remain unknown.

Step 4 — one apply coordinator

  1. TripTrackingService creates the coordinator after the Binder connects.
  2. The coordinator snapshots one repository revision and applies only rows whose policy is restore and whose matched profile explicitly permits writes.
  3. Before every write, require a valid ignition state, a positively identified Park state, and finite speed at or below 0.5 km/h. Unknown is failure, not permission.
  4. Read the current value. Skip as already set when the definition-specific verifier says it matches.
  5. Send the setter once, wait the definition's settle interval, read the getter, and record verified only on a definite match.
  6. Do not retry an accepted-but-unverified setter. Retry only service-not-ready reads with bounded backoff and generation cancellation.
  7. Apply each profile revision once per ignition session. A Binder reconnect during the same session must not replay request-style or hardware-moving controls.
  8. Return per-setting results; one failure must not block independent safe settings.

MainActivity must not launch a second automatic pass. Its Apply now button and VehicleSettingsActivity use the same coordinator in manual mode.

Step 5 — regenerative level 5

  1. Add named constant REGEN_LEVEL_OFF_EXPERIMENTAL = 5.
  2. Both labels and values come from the catalog. Do not append a fifth label while continuing to save which; that would send 4.
  3. Initially expose level 5 only under Advanced recovery → Apply now.
  4. Follow the state machine in section 5.4: capture current 0–3, acknowledge, recheck Park/zero speed, write once, read back 5, and show Restore previous level.
  5. Do not enable restore=5 at startup until the exact target firmware has passed the controlled vehicle test. Even after validation, never put 5 in a preset/default.

Step 6 — UI

Build VehicleSettingsActivity from catalog rows rather than hard-coded per-feature dialogs. Group rows as follows:

  1. Drive and energy.
  2. Driving assistance (lane, TJA/ACC, collision, blind spot, rear assistance, driver monitoring).
  3. Convenience/access and mirrors.
  4. HVAC/AQS and non-ambient welcome/home lighting.
  5. Manual/trim-dependent controls.
  6. Read-only safety and diagnostics.

Each row shows current value, desired policy/value, support state, and last result. Unsupported rows remain visible but disabled with the reason. Omit ambient lighting entirely. Safety systems start read-only; do not offer an Off startup value.

Step 7 — enable writes by risk, not all at once

  1. First enable the eight drive/energy rows listed in Step 3, except level 5 remains Apply-now until vehicle validation.
  2. Add non-ambient persistent convenience writes only after getter/enum/read-back confirmation on the target trim.
  3. Add ADAS as read-only first. Enable explicit restoration one row at a time after its controlled test; never enable a safety-Off startup policy.
  4. Keep actuator, passenger-airbag, rear-fog, PDC command, trailer-status, power-mode, and unknown-semantics rows read-only/excluded as specified below.

Requested-feature checklist

Use this table to make sure the features requested for MG Utility are not lost in the larger inventory:

Requested feature What the coding agent must add First release policy
Energy Saving Mode Catalog/get/set 0xa6/0xa7, labels Off 0 and On 1, capability/read-back state, repository policy, UI row, and startup coordinator support. Writable explicit restore after target-profile validation.
Regenerative level 5 Explicit catalog value 5, Advanced UI, acknowledgement, Apply-now state machine, read-back, previous-level restore, and tests rejecting 4/6/7. Manual Apply-now first; startup restore only after controlled validation.
Lane assist Mode 0x53/0x54, sensitivity 0x55/0x56, warning sound 0x57/0x58, vibration 0x59/0x5a, and lane-change assist 0x6c/0x6d; gate with lane capability. Read-only first, then individually validated explicit restoration. Never startup-select Off.
TJA/ACC Combined mode 0x51/0x52, values unavailable 0, ACC 1, ICA/TJA 2, SHWA 3, Off 4; gate with traffic-jam capability. Keep separate 0x5d/0x5e read-only until its build-specific semantics are proven. Read-only first, then validated explicit restoration; never claim autonomous driving.
Traction control / ESP Add the separate vehiclecontrol child and read getEspSwitch 0x13; map Off 0, On 1, unavailable 2. Read-only first. If later approved, only allow Restore On using setter 0x14; never expose startup-Off.
Other non-ambient settings Add every definition in sections 3.1, 3.3, 4.1, 4.2, 4.3, and the charging table; render its policy/support state even when read-only. Enable writes by the per-row policy and validation phase. Ambient remains excluded.

Test and handoff requirements

This repository has no Gradle or existing test framework. Add a small pure-Java test harness under tests/ for catalog, validation, migration decisions, plan building, and result verification. Use an injectable Binder adapter/fake for gateway tests; do not require the proprietary SAIC service for offline tests.

Mandatory automated assertions:

  • allowed regen values are exactly {0,1,2,3,5} and 4/6/7 cause zero setter calls;
  • a fresh install produces zero startup writes;
  • unknown firmware, unknown Park/ignition/speed, and nonzero speed produce zero writes;
  • only one component owns a startup pass and reconnect does not duplicate it;
  • one-way setter success is not reported as verified until getter read-back matches;
  • level 5 requires acknowledgement, captures/restores the prior 0–3 value, and is absent from all presets;
  • ambient settings never appear in the target catalog/UI/apply plan;
  • callback/status values cannot pass a setter validator;
  • a failed setting does not block an independent setting.

Run, in order:

./tests/run_tests.sh   # after adding the harness
./build.sh
git diff --check

The emulator can validate UI, persistence, and fake-Binder behavior only. Do not mark a transaction profile supported until the controlled real-head-unit/vehicle matrix in section 10 passes. Update the README only after the implementation and validation state accurately match its claims.

Investigation result

The captured service exposes more useful settings than MG Utility currently uses, but it does not expose a credible motor-power, torque, battery-capacity, or top-speed unlock through IVehicleSettingService.

The useful additions divide into three groups:

  • Good startup-profile candidates: Energy Saving, electric-powertrain feel, steering feel, brake-pedal feel, one-pedal mode, and brake-to-standstill.
  • Supported but safety-sensitive: lane assistance, TJA/ACC, collision and traffic assistance, Auto Hold, ESP/traction, and HDC. Start read-only and enable only individually validated, explicit restoration policies. Never restore a safety system to Off.
  • Advanced/experimental: regenerative level 5, which the OEM constants call OFF but the normal driving UI does not offer alongside Low/Standard/High/Auto. MG Utility should make it selectable with an explicit warning and read-back. It must not be selected by a preset or new-install default. Start with a parked Apply now action; allow startup restoration only after controlled testing on the target car confirms its behavior and persistence.
  • Target-trim exclusion: ambient-lighting APIs exist in the shared SAIC SDK, but the target car has no ambient-lighting hardware. Keep the evidence in this document, but do not implement an ambient-lighting UI, preference, or setter.

For the driver's two performance questions, the closest factory-supported choices are Sport drive mode plus Sport electric-powertrain feel for sharper response, and Eco plus Energy Saving for lower consumption. These remain OEM calibrated profiles; they do not raise factory motor current/torque limits or add usable battery capacity.

1. Outcome and scope

The feature should expose every discovered non-ambient item in a typed capability inventory. Visibility does not imply that every item is writable. Depending on its risk and semantics, an item has one of these policies:

  • Do not change (the default for a new installation).
  • Restore this value after the vehicle service is ready.
  • Apply now while the car is positively identified as parked.
  • Read-only for status, unknown semantics, moving hardware, or safety-critical controls that have not passed a separate release review.

The first useful profile can include energy and drive-feel settings, lane-assist preferences, TJA/ACC mode, and other settings exposed by the OEM SAIC Vehicle Settings application. The app must apply each selected setting independently and report exactly what was read, changed, verified, skipped, or rejected.

Recommended product defaults:

  • A new install ships with every setting set to Do not change.
  • The recovery selector includes Level 5 — OEM “Off” (experimental). Choosing it requires a warning acknowledgement. It is never included in a preset, and values 4, 6, and 7 remain rejected because no reviewed OEM constant defines them.
  • The UI may offer an explicitly selected Efficiency preset (initially Eco and Energy Saving On), but the driver must review and confirm it. The OEM text says Energy Saving may itself select stronger regeneration, so the preset must not also force a regen level until the interaction is validated. It must leave ADAS and ESP/traction at their current vehicle values.
  • An explicitly selected Sport response preset may request Sport drive mode and Sport electric-powertrain feel. It must be labelled as factory response tuning, not an increase in rated power, and must not alter ESP or ADAS.
  • There is no shipped preset that disables a safety system, selects regenerative level 5, moves body hardware, or changes the power-mode switch.

MG Utility is not modifying the OEM APK or its private preferences. Both apps use the exported com.saicmotor.service.vehicle.VehicleService Binder. MG Utility asks the hub for the same vehiclesetting/vehiclecontrol child services used by the OEM app; a successful Binder write changes the vehicle setting, which the OEM app can subsequently read and display.

Out of scope for the implementation:

  • ECU firmware updates, coding, or writes to arbitrary CAN properties.
  • Changing motor torque/current limits, top-speed limits, usable battery capacity, displayed SOC, or the estimated-range value.
  • Ambient-lighting controls on this target car. The shared SDK methods are recorded only so a future hardware-equipped profile can identify them explicitly.
  • Unattended door, window, sunroof, tailgate, seat-movement, passenger-airbag, rear-fog, PDC-state, trailer-status, or vehicle-power commands. Their service methods remain in the inventory, but they are not startup-profile setters.
  • Periodically enforcing a profile while driving. Startup restoration should run once per vehicle-service/ignition session and then leave the driver in control.
  • Assuming that a transaction number found in one APK is universal to all MG models.

2. Current implementation baseline

The current app already binds the exported service and applies two values:

Area Current code Current behavior
Binder gateway src/cloud/molberg/mgutility/EnergyActivity.java:37-207 Resolves vehiclecharging, vehiclecondition, and vehiclesetting; raw Binder calls use the SDK descriptors.
Preferences/UI src/cloud/molberg/mgutility/SettingsActivity.java Stores vehicle_defaults/startup_drive_mode and vehicle_defaults/startup_regenerative_level.
Background startup src/cloud/molberg/mgutility/TripTrackingService.java:53-314 Reads those two values after connection, retries eight times at 750 ms intervals, and applies only differing values.
Existing transactions EnergyActivity.VehicleGateway Drive mode 0x81/0x82; regenerative level 0xa0/0xa1 (get/set).

The current setters are one-way Binder calls (FLAG_ONEWAY), so a true return from transact() only means that the transaction was queued. It is not proof that the vehicle accepted the value. The new implementation must read back each value after a short settling delay and mark the result verified only when a per-setting verifier shows that the returned state unambiguously represents the requested value.

The two startup readers currently have hard-coded defaults (Normal and Medium). When the new schema is introduced, a fresh install should use unset/do not change; existing users with the two legacy keys must be migrated without silently changing their choices.

Requested level-5 UI change (implementation task)

The current SettingsActivity.chooseRegen() offers only four entries and stores the list index directly. The implementation must replace that implicit index mapping with an explicit value map:

UI label Binder value Policy
Low 0 Normal selectable value.
Standard/Medium 1 Normal selectable value.
High 2 Normal selectable value.
Auto/Adaptive 3 Normal selectable value.
Level 5 — Regeneration Off (experimental) 5 Advanced selectable value; warning acknowledgement, Park/zero-speed gate, previous-value capture, read-back, and restore action.

Do not use the UI position as the Binder value: inserting level 5 as a fifth item must not accidentally send 4. The validator must accept exactly {0, 1, 2, 3, 5} for the known profile and reject {4, 6, 7}. Until the target-car test is complete, level 5 must be available only through an explicit Apply now path and must not be sent by the existing unattended startup loop. This document records the requested feature; the source implementation remains a later task.

3. Evidence from the SAIC APKs

The transaction and enum evidence was recovered from the captured decompilation at ../mg4-luxury-2022-info/device-info/decomp/ relative to this project:

  • com.saicmotor.service.vehicle/smali_classes2/com/saicmotor/sdk/vehiclesettings/IVehicleSettingService$Stub.smali
  • com.saicmotor.service.vehicle/smali_classes2/com/saicmotor/sdk/vehiclesettings/IVehicleControlService$Stub.smali
  • com.saicmotor.hmi.vehiclesettings/smali/com/saicmotor/hmi/vehiclesettings/commom/VehicleConstant$*.smali
  • com.saicmotor.hmi.vehiclesettings/res/values/strings.xml and com.saicmotor.hmi.vehiclesettings/res/values-en/strings.xml
  • com.saicmotor.service.vehicle/smali/com/saicmotor/service/vehicle/binder/VehicleSettingBinder.smali and VehicleControlBinder.smali (backing VHAL property IDs and validation)
  • com.saicmotor.update/smali/android/hardware/automotive/YFvehicle/V2_0/YFVehicleProperty.smali (names of the raw EV/BMS properties)
  • ../mg4-luxury-2022-info/device-info/car_service.txt and ../mg4-luxury-2022-info/device-info/decoded-props.txt (captured access/type records)
  • com.saicmotor.adapterservice/smali/com/saicmotor/adapterservice/adapter/AdasManager.smali (the speed-assist signal path)

The OEM strings explicitly name Energy Saving Mode, One-Pedal Drive Mode, Lane Keeping Assist, Emergency lane keeping, and TJA (the default resource labels ICA as TJA), as well as Front Collision Assist, Blind spot detection, Rear Cross Traffic Alert, Driver Drowsiness Detection, and Traction Control. The traction-control dialog asks whether the driver really wants to deactivate it; that is a strong indication that it must not be disabled silently by a startup profile.

What “writable” means here

There are two different layers in the dump:

  1. The exported SAIC Binder has a small, named set of setters. These are the only writes this design may use.
  2. The underlying VHAL contains many vendor properties. A property appearing in a generated constant list does not make it an app setting. In the captured car_service.txt, profile selectors such as 0x2140a17c and 0x2140a18c have read/write access (0x3), while raw EPT and BMS diagnostic signals are read-only (0x1).

The app must never send a guessed CarPropertyValue or raw VHAL write to “see what happens”. A named Binder method, a matching capability profile, and a read-back verifier are all required.

3.1 Complete non-ambient convenience inventory

The captured Vehicle Settings HMI does not contain a dedicated row for every setter in the exported service. The tables below retain all non-ambient candidates found in the active Stub. “Not shown” means static absence from the reviewed HMI code path, not proof that this MG4 trim implements the function. Unknown enum mappings remain read-only until an OEM constant and a target-car read/write/read-back test agree.

Persistent preference candidates

Candidate IVehicleSettingService get/set Initial product policy
Driving auto-lock 0x0f/0x10 Convenience profile after value mapping and parked read-back test.
Stalling/ignition-off auto-unlock 0x11/0x12 Convenience profile; label the exact unlock behavior and require explicit opt-in.
Key-unlock mode 0x13/0x14 Convenience/security profile; never infer a default.
Near-field unlock 0x15/0x16 Convenience/security profile; require trim support.
Approach unlock 0x17/0x18 Convenience/security profile; require trim support.
Leave auto-lock 0x19/0x1a Convenience/security profile; require explicit opt-in.
Outer-mirror auto-fold 0x23/0x24 Convenience profile after a parked hardware test.
Left/right mirror reverse dip 0x1f/0x20, 0x21/0x22 Separate left/right choices; require Park and trim support.
HVAC automatic blower volume 0x03/0x04 Comfort profile after setter-enum validation.
HVAC ECON linkage 0x05/0x06 Efficiency/comfort profile; it can reduce climate load but cannot add battery capacity.
Defrost linkage 0x07/0x08 Comfort profile after target-car validation.
AQS sensitivity 0x09/0x0a Comfort profile; service range is 0–3, but expose only meanings confirmed by OEM constants/runtime.
Seat heat/ventilation linkage 0x0b/0x0c Trim-dependent comfort profile; do not imply ventilation hardware is fitted.
HVAC custom switch 0x2b/0x2c Read-only until its value mapping and interaction with the HVAC HMI are known.
Welcome-light time 0x31/0x32 Cosmetic profile after value mapping.
Home/follow-me-home light time 0x33/0x34 Cosmetic profile after value mapping.
Lamp-home master switch 0x98/0x99 Cosmetic profile after read-back validation.
Lamp-welcome master switch 0x9a/0x9b Cosmetic profile after read-back validation.
Farewell-light mode 0x9e/0x9f Cosmetic profile after value mapping.
Welcome sound on/type 0x2d/0x2e, 0x2f/0x30 Cosmetic profile; gate with availability getter 0x95 and confirm whether the switch is persistent or request-style.
Car-search feedback/mode and master switch 0x9c/0x9d, 0xb0/0xb1 Convenience profile after separating feedback mode from enable state.
Start linkage 0x47/0x48 Read-only first; define what subsystem is linked before exposing a value.
Voice linkage 0x49/0x4a Read-only first; define value meanings before exposing a value.
Music linkage 0x4b/0x4c Read-only first; define value meanings before exposing a value.
Steering-wheel custom/define 0x29/0x2a Read-only first; do not conflict with MG Utility's separate Android key-remapping feature.

Manual or hardware-moving candidates

Candidate Service method/transaction Initial product policy
Inductive tailgate get/setInductiveTailgate, 0x1b/0x1c Parked Apply now only after confirming whether this is a persistent preference or an action request.
Inductive door handle get/setInductiveDoorHandle, 0x1d/0x1e Parked Apply now only; security-sensitive and trim-dependent.
Electric-tailgate position get/setElectricTailgatePos, 0x0d/0x0e (float) Inventory/read-only initially. It can move or reconfigure hardware and must never run unattended.
Seat auto-adjust/identification 0x25/0x26 Inventory/read-only initially; confirm whether it identifies a profile or moves a seat.
Driver-seat welcome movement 0x27/0x28 Parked Apply now only after a controlled seat-clearance test; never replay on reconnect.
Towing-mode switch 0xb4/0xb5 Read-only initially because it can change rear-assistance behavior.
Trailer connection/status getTrlrCnctSts 0xb7; setTrlrMdSts 0xb8 These are not a symmetric setting pair. Status inventory only; never send 0xb8 as a guessed toggle.
PDC change status 0xb9/0xba Status/command inventory only; not a user startup preference.

Named commands retained only as exclusions

Command Service transaction Reason it is not a startup setting
Passenger-airbag command/status getter 0x8b, status getter 0x8c, setter 0x8d Safety-critical and asymmetric; leave to the OEM safety flow.
Rear-fog command 0xb2/0xb3 Road-legal, situational lamp command rather than a persistent preference.
Vehicle power-mode switch 0xac/0xad Ready/shutdown flow; automation can interrupt or strand the vehicle.

Welcome sound, driver-seat welcome, inductive-handle, tailgate, and similar methods may be requests with side effects rather than persistent booleans. Do not replay them on every Binder reconnect. Do not present any item in this section as a performance hack; these are body, comfort, access, or diagnostic functions.

3.2 Ambient-lighting evidence — deliberately excluded

The shared service exposes ambient global/open/drive/welcome modes and color/brightness/breathing fields (0x37 through 0x46) plus availability getter 0x96. They are excluded from the target implementation because the user's car has no ambient-lighting hardware. No settings row, stored preference, capability probe, or setter should be added for this profile.

For archival completeness, the color/brightness/breathing setters share packed VHAL property 0x21709318. The binder initializes a short placeholder array and later accepts an eight-byte callback payload, so a future hardware-equipped profile would need to read a valid eight-byte payload and preserve its reserved fields before any write. This is evidence only, not current implementation scope.

3.3 Diagnostic/status inventory

The following IVehicleSettingService calls are useful for capability discovery and diagnostics, but are not selectable preferences:

Status Getter transaction Treatment
Aggregate vehicle-setting status 0x8e Diagnostics only.
Bus-off status 0x97 Diagnostics only; never turn a communication fault into a write.
FCW system failure 0x65 Read-only safety status.
LDW/LKA system failures 0x5c, 0x5b Read-only safety status.
RCTB failure 0x72 Read-only safety status.
Rear-driving-assist availability/status 0x94, 0x73 Capability and read-only status.
Regenerative-level disable reason/state 0xa2 Read-only gate for normal levels and level 5.
Signal-pedal inhibition/registration 0xa5 Read-only gate; do not treat status values as setter modes.
Unsteady-driving-warning failure 0x7a Read-only safety status.
SDM/TDM availability 0x8f, 0xb6 Capability only.
Welcome-sound availability 0x95 Capability gate for welcome sound/type.
Last welcome/home/ambient-open/lane values 0x90, 0x91, 0x92, 0x93 Diagnostic/history values, not alternate setters. Ambient history remains excluded.
Longer-endurance recommendation/disable 0xa8, 0xa9 Read-only metadata; do not infer a writable mode from these values.

IVehicleControlService also exposes direct actuators. They are recorded here so a future developer does not mistake an unlisted transaction for an approved feature:

Control/status Get/set transactions MG Utility policy
Door lock 0x03/0x04 No startup automation.
Driver window 0x05/0x06 No startup automation.
Passenger window 0x07/0x08 No startup automation.
Left/right rear windows 0x09/0x0a, 0x0b/0x0c No startup automation.
Electric-tailgate lock 0x0d/0x0e No startup automation.
Sunroof switch/ventilation 0x0f/0x10, 0x11/0x12 No startup automation.
ESP/traction control 0x13/0x14 Read-only first; a future write may only restore On, never startup-Off.
Hill-descent control 0x15/0x16 Read-only first.
PDC switch 0x17/0x18 No startup automation.
Vehicle-control status getter 0x19 Diagnostics only.
VSE status getter 0x1b Diagnostics only.
TCS opening mode/status getters 0x1c, 0x1d Read-only diagnostics; these are not permission to bypass the named ESP API.

Direct lock/window/roof/tailgate/PDC actions belong in a separate, deliberate remote control design if ever implemented. They are not part of this startup-settings work.

Compatibility warning

The dump contains more than one SDK generation. For example, the older com.allgo.rui/.../IVehicleSettingService$Stub.smali uses lane-assist transactions 0x50/0x51, 0x52/0x53, and lane-change 0x66/0x67, whereas the active MG4 Luxury 2022 service uses 0x53/0x54, 0x55/0x56, and 0x6c/0x6d. A numeric transaction collision can return a plausible integer while changing a different setting. Never fall back to an adjacent ID and never probe setters on an unknown firmware. Select a versioned capability profile from the service/package build fingerprint; otherwise stay read-only and send the driver to the OEM settings app.

4. Candidate settings registry

The implementation should represent each setting as data rather than adding another pair of unrelated constants to EnergyActivity. The table below is the registry for the captured newer interface. get/set are hexadecimal Binder transaction codes on IVehicleSettingService unless explicitly marked IVehicleControlService.

“Static evidence” means the method, transaction, and enum were found in the OEM APK; it does not mean the setting has been runtime-tested on this car. Every row still needs a read/write/read-back test and a capability gate.

4.1 Drive and energy settings

Setting Service and get/set OEM values (set values) Suggested phase / policy
Drive mode vehiclesetting, 0x81/0x82 Snow 6, Eco 2, Normal 3, Sport 4, Custom 7 Existing behavior; preserve legacy opt-in.
Regenerative level vehiclesetting, 0xa0/0xa1 Low 0, Standard 1, High 2, Auto 3; Level 5 / OEM OFF 5 Add 5 as a visible Advanced selection. Default remains Do not change; require acknowledgement, Park/zero-speed, supported firmware, capture of the previous 0–3 value, read-back, and one-tap restore. Initially use Apply now only; enable startup restoration after the controlled target-car test passes. Reject 4, 6, and 7.
Energy Saving / Longer Endurance vehiclesetting, 0xa6/0xa7 Off 0, On 1 Phase 1, explicit opt-in, only in a profile that has validated the getter and target trim. getEnergyPredictionConfigCode (0x2b) may be recorded as supporting evidence, but is not an assumed universal gate. 0xa8 (recommend) and 0xa9 (disable reason/status) are read-only metadata, not alternate setters.
Electric powertrain feel vehiclesetting, 0x83/0x84 Comfort 1, Normal 2, Sport 3 Phase 1, opt-in; label as accelerator/powertrain feel.
Steering feel vehiclesetting, 0x85/0x86 Comfort 1, Normal 2, Sport 3 Phase 1, opt-in.
Brake-pedal feel vehiclesetting, 0x87/0x88 Normal 0, Comfort 1, Sport 2 Phase 1, opt-in.
One-Pedal Drive / signal pedal vehiclesetting, 0xa3/0xa4 Off 0, On 1 Phase 1 only when condition getOnePedalConfigCode (0x29) reports support.
Regenerative-brake switch vehiclesetting, 0x89/0x8a Getter reports Off 0 / On 1; in the captured OEM UI the setter argument 1 is an on/off command after a warning, not a direct boolean state Read-only/inventory only until the command semantics and target-car read-back are confirmed. Do not put it in the startup registry yet.
Brake to standstill vehiclesetting, 0xaa/0xab Off 0, On 1 Phase 1/2, explicit opt-in; require parked/ignition gate.
Auto Hold vehiclesetting, 0xae/0xaf Setter On 1, Off 2; getter is a runtime state: Off 0, Intervention 1, Standby 2, Error 3 Phase 2; never compare the getter directly to the setter value.
Power mode switch vehiclesetting, 0xac/0xad Setter On 1, Off 2 Inventory only. This belongs to the OEM power-off/safety flow and must not be used as a startup default.

Backing VHAL properties for the drive/energy rows

These IDs are included so the implementation can correlate Binder calls with the captured property map. They are not an invitation to bypass the Binder.

Binder setting Backing property Captured type/access Meaning for MG Utility
Drive mode 0x2140a17c INT32, global, read/write (0x3) Named factory drive profile.
Electric powertrain level 0x2140a18c INT32, global, read/write (0x3) Factory accelerator/powertrain feel profile.
Steering level 0x2140a18d INT32, global, read/write (0x3) Steering assistance/feel profile.
Brake-pedal level 0x2140a18e INT32, global, read/write (0x3) Brake-pedal feel profile.
Regenerative-brake switch 0x2140a18f INT32, global, read/write (0x3) Safety-sensitive regeneration availability; keep out of defaults until semantics are verified.
Regenerative level 0x2140a191 INT32, global, read/write (0x3) Deceleration/regen profile; verify before every write.
Signal pedal / one-pedal 0x2140a193 INT32, global, read/write (0x3) One-pedal selector/status family; reject undocumented values.
Brake to standstill 0x2140a194 INT32, global, read/write (0x3) Convenience deceleration behavior.
Energy Saving / Longer Endurance 0x2140a195 INT32, global, read/write (0x3) Consumption-oriented factory profile.
Power mode switch 0x2140d70f INT32, global, read/write (0x3) Vehicle ready/power-state flow, not a performance control.

4.2 ADAS and driver-assistance settings

Setting Service and get/set OEM values (set values) Suggested phase / policy
Combined ACC/TJA mode vehiclesetting, 0x51/0x52 Unavailable 0, ACC 1, ICA/TJA 2, SHWA 3, Off 4 Phase 2; require getTrafficJamAssistance (IVehicleConditionService, 0x17) support, explicit opt-in, and a clear explanation that this selects an assistance mode, not an autonomous-driving guarantee.
Separate traffic-jam switch vehiclesetting, 0x5d/0x5e Semantics and values are profile-dependent; do not assume boolean values Internal candidate only. Gate with getTrafficJamAssistance (IVehicleConditionService, 0x17), use only in a matching profile, and never apply it together with the combined ACC/TJA mode without bench evidence.
Lane-keeping mode vehiclesetting, 0x53/0x54 Unavailable 0, Off 1, LDW 2, LDP 3, LKA 4, ELK 5 Phase 2; never default to Off.
Lane-assist sensitivity vehiclesetting, 0x55/0x56 Low 1, Standard 2, High 3 Phase 2; note that the OEM UI indexes these as 0, 1, 2, so do not pass the UI index to Binder.
Lane warning sound vehiclesetting, 0x57/0x58 Off 1, On 2 Phase 2; never default to Off.
Lane warning vibration vehiclesetting, 0x59/0x5a Off 1, On 2 Phase 2; never default to Off.
Lane-change assist vehiclesetting, 0x6c/0x6d Off 1, On 2 Phase 2; verify the setter values, which differ from callback/status values in the OEM constants.
Forward-collision warning alarm vehiclesetting, 0x5f/0x60 Off 1, On 2 Phase 2; no safety-off startup policy.
Forward-collision automatic brake vehiclesetting, 0x61/0x62 OEM mode values are Off 1, On 2 Phase 2; no safety-off startup policy.
Forward-collision sensitivity vehiclesetting, 0x63/0x64 Low 1, Standard 2, High 3 Phase 2; preserve the vehicle value unless explicitly selected.
Automatic emergency braking vehiclesetting, 0x66/0x67 Off 1, On 2 in the captured mode family Phase 2; require runtime confirmation that this signal is distinct from FCW auto-brake on the target trim.
Rear driving assist vehiclesetting, 0x68/0x69 Desired Off 1, On 2; other values represent disabled/error/sensor states Phase 2; only write the desired pair after validating status handling.
Blind-spot detection vehiclesetting, 0x6a/0x6b Off 1, On 2 Phase 2; no safety-off startup policy.
Rear cross-traffic system vehiclesetting, 0x6e/0x6f RCTA/RCTB off 1, RCTA on + RCTB off 2, both on 3 Phase 2; expose named combinations, not raw integers.
Rear-collision warning vehiclesetting, 0x70/0x71 Off 1, On 2 Phase 2; no safety-off startup policy.
Parking warning vehiclesetting, 0x74/0x75 Off 1, On 2 Phase 2; do not disable by default.
Driver monitoring vehiclesetting, 0x7b/0x7c Off 1, On 2 Phase 2; no safety-off startup policy.
Driver-monitor warning sound vehiclesetting, 0x7d/0x7e Off 1, On 2 Phase 2; preserve OEM safety alerts by default.
Driver-monitor vibration vehiclesetting, 0x7f/0x80 Off 1, On 2 Phase 2; preserve OEM safety alerts by default.
Unsteady-driving warning vehiclesetting, 0x76/0x77 Off 1, On 2 Phase 2; no safety-off startup policy.
Unsteady-driving sensitivity vehiclesetting, 0x78/0x79 Low 1, Standard 2, High 3 Phase 2; validate availability before showing it.
Speed-assist mode vehiclesetting, 0x4f/0x50 Off 0, Manual 2, Auto 3 Phase 3; runtime-test against the vehicle’s speed-limit behavior.
Traffic-sign/speed-limit warning vehiclesetting, 0x4d/0x4e Build-specific warning values Phase 3, read-only first.
Automatic high beam vehiclesetting, 0x35/0x36 Off 0, On 1; Reserved 2, Invalid 3 are not setter choices Phase 3; separate lighting profile, not a first startup default.

4.3 Traction control and other high-risk controls

Traction control/ESP is not an IVehicleSettingService setting. It is exposed by the hub child named vehiclecontrol with descriptor com.saicmotor.sdk.vehiclesettings.IVehicleControlService:

Setting Service and get/set OEM values Policy
ESP / traction control vehiclecontrol, 0x13/0x14 (getEspSwitch/setEspSwitch) Off 0, Normal/on 1, Not enabled/unavailable 2 Read-only in the first release. A later “restore on” action may be allowed only after explicit opt-in, parked-state checks, and read-back verification. Never offer or apply a default of 0 (off).
Hill-descent control (HDC) vehiclecontrol, 0x15/0x16 Captured constants use enabled 1 / disabled 2; validate trim behavior Read-only/phase 3. Do not group it with ESP.

The OEM warning for ESP deactivation is a product-level safety signal. A startup profile must not turn off ESP, AEB, FCW, lane keeping, blind-spot, rear-cross-traffic, parking, or driver-monitoring systems merely because a preference is missing or an older profile contains an invalid value.

4.4 Values present in the OEM constants but not normal UI choices

These are the values most likely to be mistaken for an undocumented tuning menu.

Value Evidence Decision
Regenerative level 5 VehicleConstant$DriveModelValid defines REGENERATIVE_LEVEL_MODE_OFF = 5; the service validates the setter against a maximum of 7, while the reviewed HMI sends only Low/Standard/High/Auto (0–3). Expose as Level 5 — OEM “Off” (experimental) under Advanced. Initially it is a deliberate parked Apply now value, not a normal preset. After the exact target firmware passes the controlled test matrix, the UI may also allow an explicitly acknowledged startup-restore policy. Always capture the prior 0–3 value, read back 5, and provide one-tap restore. It is not a power increase.
Regenerative level 4, 6, 7 The service’s broad numeric range accepts them, but no reviewed OEM constant gives them a user-facing meaning. Reject locally. A permissive range check is not evidence that a value is supported.
Signal-pedal values 1 and 2 The same constants class contains SIGNAL_PEDAL_DISABLE_CHARGE_LIMIT and SIGNAL_PEDAL_DISABLE_BREAK_SYSTEM; the normal setter also uses 0/1 for off/on. Treat 1/2 in the disable/status namespace as status or failure encodings, not extra modes. Only use the explicitly mapped off/on setter values after capability testing.
Longer-endurance recommend/disable (0xa8/0xa9) Separate getter/setter methods and transactions exist for metadata, but the OEM service does not expose them as alternate controls. Read-only diagnostics. Do not write them or infer an Energy Saving state from them.
Power mode On/Off (1/2) A named setter exists at 0xac/0xad and writes the power-state property 0x2140d70f. Never automate as a startup profile. It belongs to the OEM ready/shutdown flow and can strand or interrupt the vehicle.

The app should label a value as unsupported when its meaning is unknown rather than displaying a raw integer. Do not test undocumented values by sending them to a customer vehicle.

4.5 Performance, range, and speed-limit assessment

User goal Closest supported setting What it can and cannot do
Sharper acceleration response Drive mode Sport (4) plus electric-powertrain feel Sport (3) Selects the factory-calibrated response profile. It may change pedal mapping and response, but there is no evidence that it raises rated torque, inverter current, battery current, thermal limits, or top speed. Do not promise a faster 0–100 result.
Lower consumption / practical range Eco (2) plus Energy Saving/Longer Endurance On (1) May reduce consumption and change regeneration/HVAC behavior. It cannot add battery capacity or make the range estimate physically true. Let the OEM mode resolve any dependent regen setting until tested.
More displayed range immediately after charging Charging close-SOC target A higher target can leave more energy available than an 80% target, but it does not increase capacity and may increase ageing. This belongs in charging automation, not an ignition startup drive profile.
Cold-weather charge performance Driving-battery heat Battery heating can improve temperature readiness in some conditions while consuming energy. It is not a range or acceleration unlock and should not be silently enabled.
Higher vehicle top speed None found The exposed speed-limit path is navigation/ADAS data, not the propulsion limiter. No top-speed setter was found in the reviewed vehicle-settings Binder.

Engineering-mode audit

The separate com.saicmotor.hmi.engmode / com.saicmotor.service.engmode surface was also reviewed so that a performance setter would not be missed:

  • IDIDManager reads assembly, hardware, product-serial, software-part, and related identification/version data.
  • ISystemSettingsManager reads battery power, speed, gear, and power state and exposes engineering/showroom/ADB/reset/firmware-upgrade administration.
  • ISystemHardwareManager provides hardware tests and connectivity controls.
  • The log/ECU-configuration screens read/export configuration strings and diagnostic information.

No ordinary public engineering-mode method for torque, motor power, inverter current, usable battery capacity, or propulsion calibration was found. This is a privileged diagnostic/firmware surface and is not an MG Utility settings backend.

Service validation bounds are not enum definitions

The captured service resource limits provide useful rejection bounds, but do not prove that every in-range value is implemented by this vehicle:

Field Captured maximum Treatment
Regenerative level setter 7 Accept only mapped {0,1,2,3,5}; reject 4/6/7.
AQS sensitivity 3 Expose only named meanings confirmed on the target car.
Driver-seat welcome setter 1 Hardware-moving/request semantics still require validation.
Welcome-sound switch/type 3 Availability and named enum mapping remain required.
Ambient color/brightness/breathing/welcome mode 63 / 10 / 2 / 7 Evidence only; entire ambient feature is excluded for this target.

Do not brute-force every value inside a service range.

Raw signals that must remain read-only

The YF VHAL map contains names that sound like tuners, but the captured property access records mark them read-only (access:0x1):

Property Name in YFVehicleProperty Interpretation
0x2140a155 AAD_EPTTRINPTSHAFTSPD Powertrain input-shaft speed telemetry.
0x2140a156 AAD_EPTMOTCLNTFLT Motor coolant-fault diagnosis.
0x2140a157 AAD_EPTMOTOVHTDIO Motor overheat diagnosis.
0x2140a159 AAD_EPTRGTNLVL Powertrain target-level/status signal, not a user torque request.
0x2140a15a AAD_ELECVEHSYSMD Electric-vehicle system mode/status.
0x2160a15b AAD_EPTCCTRGTSPD Powertrain target-speed telemetry.
0x2160f405 / 0x2160f406 / 0x2160f407 BMS_PACK_SOC / BMS_PACK_VOL / BMS_PACK_CRNT Battery SOC, voltage, and current telemetry.
0x2140f41c / 0x2160f41d VEH_ELEC_RNG / ELEC_CSUMP_PERKM Range estimate and consumption telemetry.

There is no named Binder setter for a motor torque/current limit, battery usable energy, thermal limit, or propulsion top-speed limit in this capture. Writing or spoofing the displayed SOC/range would only make the estimate unsafe; it would not make the car travel farther.

The adapter’s setSpdLmtVal path writes 0x2160a185, with status/unit signals 0x2140a183 and 0x2140a184. These are traffic-sign/speed-assist inputs. They must not be described as, or used as, a top-speed unlock.

Charging controls are a separate feature

The charging Binder has legitimate setters, but they affect charging policy rather than propulsion capability:

Control IVehicleChargingService get/set Policy
Charge close SOC 0x0d/0x0e Expose only in charging automation with explicit bounds and a visible battery-health note.
Charging current 0x0b/0x0c Respect charger/vehicle limits; never use it as a driving-power setting.
Charging lock switch 0x0f/0x10 Charging page only; validate connector/lock semantics and read back.
Charging control switch 0x11/0x12 Deliberate parked charging action, not an ignition startup default.
Reserved charging enable/control 0x13/0x14 Charging scheduler only.
Reserved start hour/minute 0x15/0x16, 0x17/0x18 Charging scheduler only; validate time-zone and overnight behavior.
Reserved stop hour/minute 0x19/0x1a, 0x1b/0x1c Charging scheduler only; validate overnight behavior.
Discharge/V2X close SOC 0x2b/0x2c Keep separate from driving range and protect the reserve SOC.
Discharge/V2X control switch 0x2e/0x2f Deliberate parked V2X action only.
Driving battery heat 0x25/0x26 Park/charging-context action only; read back the asymmetric getter state.
Reserved-charge pile/adaptor type 0x27/0x28 Read-only until enum meanings and hardware support are confirmed.
Cluster distance unit setter/getter 0x51/0x52 Prefer the OEM/unit source of truth; do not let a charging page fight another unit setting.
BtEnabled 0x34/0x35 Inventory only; the name is ambiguous in this service and must not be presented as Bluetooth or battery heating without evidence.

None of these should be included in a default “faster” or “longer range” startup preset. A 100% charge target can increase the energy available for the next trip relative to an 80% target, but it cannot increase the pack’s physical capacity.

5. Binder integration design

5.1 Service resolution

Keep the existing explicit bind:

Intent action:  com.saicmotor.service.vehicle.VehicleService
package:       com.saicmotor.service.vehicle

After the hub Binder connects, request child services using the hub descriptor com.saicmotor.sdk.vehiclesettings.IHubService and its service lookup transaction 0x01:

vehiclesetting  -> IVehicleSettingService
vehiclecontrol  -> IVehicleControlService
vehiclecondition -> IVehicleConditionService

Use these exact interface descriptors in every Parcel:

com.saicmotor.sdk.vehiclesettings.IVehicleSettingService
com.saicmotor.sdk.vehiclesettings.IVehicleControlService
com.saicmotor.sdk.vehiclesettings.IVehicleConditionService

The setting and control gateways should be separate classes (for example VehicleSettingGateway and VehicleControlGateway) rather than expanding the energy dashboard class into a general write API. Keep charging and read-only telemetry methods independent.

5.2 Registry entry shape

Use a typed registry with no raw UI integers:

SettingDefinition {
    id, displayName, category,
    service (SETTING or CONTROL), getTransaction, setTransaction,
    allowedValues, formatter,
    isDesiredState (getter value, requested value),
    risk (CONVENIENCE, ADAS, SAFETY_CRITICAL),
    requiredConditions, capabilityProfile,
    writePolicy (READ_ONLY, RESTORE_ON, EXPLICIT_VALUE)
}

The setter adapter should validate the value against the selected capability profile before creating a Parcel. isDesiredState (or an equivalent read-back normalizer) must be supplied for asymmetric APIs such as Auto Hold. Unknown values, -1, unavailable sentinels, and callback states that are not valid setter values must be rejected locally.

5.3 Availability and condition gates

The captured IVehicleConditionService also exposes feature/configuration signals. Use them to decide whether to show a row and whether a write is eligible; they are not substitutes for reading the setting itself, and their nonzero meanings must be profile-tested.

Capability or condition Method and transaction Applies to
One-pedal configuration getOnePedalConfigCode, 0x29 One-Pedal Drive
Traffic-jam assistance availability getTrafficJamAssistance, 0x17 Combined TJA/ACC and the separate traffic-jam signal
Lane-departure/lane-keeping configuration getLdwsConfigCode, 0x1f Lane keeping, lane warning sound/vibration
Forward-collision assistance configuration getForwardCollisionAssistance, 0x18 FCW and AEB
Blind-spot configuration getBlindSpotDetection, 0x16 Blind spot and rear-cross traffic
Radar availability getRadarAvlbly, 0x36 Blind spot, rear-cross traffic, rear driving assist
Driver-monitor configuration getDmsConfigCode, 0x20 Driver monitoring and its alerts
Speed-assist configuration getSpeedAssistConfig, 0x15 Speed-assist mode and traffic-sign warning
Energy-prediction/configuration getEnergyPredictionConfigCode, 0x2b Optional supporting evidence for Energy Saving; profile-test its relationship rather than treating it as authoritative
HDC configuration getSteepDescentControl, 0x1a Hill-descent control
Front-radar control getFrontRadarControl, 0x1b Front-radar/parking-assistance availability
VCU availability getVcuAvlbly, 0x38 Drive/energy controls that depend on the VCU
Ignition state getVehicleIgnition, 0x04 All writes; require a profile-approved run/accessory state
Gear state getCarGear, 0x05 All writes; require a positively identified Park state
Vehicle speed getCarSpeed, 0x03 All writes; require finite stationary speed

5.4 Read/write/verify algorithm

For every selected setting, run this sequence on the worker thread:

  1. Confirm the Binder generation is still current and the selected capability profile matches the service/package fingerprint.
  2. Read the current value. If the read fails or returns an unavailable value, record not ready/unsupported and do not write.
  3. Check conditions. At minimum, require a valid ignition state (getVehicleIgnition, IVehicleConditionService, 0x04), a valid gear (getCarGear, 0x05), and a finite getCarSpeed (0x03) no greater than a documented stationary tolerance (for example 0.5 km/h). Require a positively identified Park state, not merely “not moving”, plus any OEM-specific condition that the bench test shows the setting needs.
  4. Use the setting definition’s comparison function. If the current value already represents the desired value, record already set and skip the setter. This comparison must understand asymmetric APIs such as Auto Hold, whose getter reports runtime states 0/1/2/3 while its setter accepts 1/2.
  5. Send the one-way setter once. Do not treat the Binder boolean as acceptance.
  6. Wait for the setting’s documented settle interval, read the getter again, and use the same setting-specific verifier. Record verified only when the getter unambiguously represents the requested setter value; otherwise record queued/unverified and leave the vehicle untouched on subsequent retries.
  7. Retry a failed read/write only while the service is not ready, using bounded backoff. Do not repeatedly force a value after a verified result or while the vehicle is moving.
  8. Continue to the next setting even if this one fails. Show a per-setting result and keep the OEM settings shortcut available.

The existing eight-attempt/750-ms loop can be retained as a first readiness window, but it should become a generic bounded retry policy with generation cancellation and an ignition/park recheck before every write. A service disconnect must invalidate all pending writes.

Level-5 Apply-now state machine

Level 5 needs a stronger flow than the ordinary recovery selector:

  1. Read and store the current supported recovery value (0, 1, 2, or 3); if the getter is unavailable, already returns 5, or returns another value, stop.
  2. Show the experimental deceleration warning and require an affirmative acknowledgement for this exact vehicle-service profile.
  3. Recheck ignition, Park, and zero speed immediately before sending setRegenerativeLevel(5).
  4. Read back the getter. Mark the operation successful only if it returns 5; a queued one-way Binder transaction is not success.
  5. Keep the captured prior value beside the result and expose Restore previous level. If read-back fails, report unverified and do not retry repeatedly.

Only after this state machine passes on the target firmware may a profile offer restore=5 at startup. Even then, the startup path must use the same prior-value, Park/zero-speed, acknowledgement/profile, and read-back rules; it must never be part of a named efficiency or sport preset.

5.5 Startup triggers, ordering, and idempotency

A Binder connection is not necessarily a new drive: the OEM service may survive a head-unit sleep/ignition cycle. Trigger planning both when a new Binder generation is connected and when getVehicleIgnition makes a profile-approved transition from Off to Accessory/Run. Debounce duplicate Android boot, screen, power, and quick-boot broadcasts. Apply a given profile revision at most once per ignition session unless the driver presses Apply now.

Build an immutable plan from one preference snapshot. Use profile-specific dependency metadata because an OEM mode change can rewrite subordinate values. A sensible test starting point is:

  1. base drive mode;
  2. Energy Saving and drive-feel values;
  3. regen/one-pedal/brake-to-standstill values;
  4. ADAS values that passed the release gate;
  5. a final read-only verification pass over every requested value.

Do not ship that order as universal until the target-car matrix confirms it. If two requested settings conflict or one resets another, record the conflict and stop; do not alternate setters in a retry loop. A preference edit increments the profile revision, but it should wait for Apply now or the next safe ignition session rather than changing the car unexpectedly in the background.

6. Preference and profile schema

Do not use a magic integer as both “unset” and a real vehicle value. Add a schema version and one record per setting, for example:

vehicle_defaults/schema_version = 2
vehicle_defaults/<setting-id>/policy = inherit | restore
vehicle_defaults/<setting-id>/value  = validated OEM integer
vehicle_defaults/<setting-id>/ack_profile = profile-and-warning-version

Recommended behavior:

  • New installation: every policy is inherit.
  • Upgrade from the current schema: if a legacy startup_drive_mode or startup_regenerative_level key exists, migrate it to restore; do not alter its value. An explicit legacy value 5 may be preserved only as inactive data until a matching firmware profile supports it and the user completes the current warning; otherwise its policy becomes inherit. Never coerce 4, 6, or 7 to 5.
  • Handle absent legacy keys explicitly. The current code still applies implicit Normal/Medium fallbacks when those keys do not exist, so key absence alone cannot distinguish an old installation from a new one. Prefer an explicit upgrade marker (or a reliably detected package upgrade) that materializes those two legacy fallbacks for existing installations while schema-v2 fresh installs remain inherit. If upgrade detection is not reliable, choose and announce a one-time behavior change rather than silently guessing.
  • Save the capability profile, last observed value, last verified value, timestamp, and failure reason separately from the desired profile. These are diagnostics, not new desired values.
  • Bind the level-5 acknowledgement to the exact capability profile and warning version. A firmware/profile change invalidates the acknowledgement and changes its startup policy back to inherit without issuing a write.
  • Keep a single repository/manager for SettingsActivity and TripTrackingService so the UI and background service cannot diverge on keys or defaults.
  • Provide Reset to vehicle value / Do not change for each row and for the whole profile. Resetting must remove the desired write, not send an inferred “off”.

Optional named profiles (for example “Eco commute” or “Personal”) should expand to the same per-setting records. They must not introduce hidden safety settings.

7. UI proposal

Add Settings → Driving → Startup vehicle profile. Each row should show:

  • setting name and a short OEM-compatible description;
  • current vehicle value (read from Binder when connected);
  • startup policy (Do not change or the selected value);
  • capability state (Supported, Unavailable, Unknown firmware, or Read-only);
  • the last apply result and timestamp.

Use separate sections:

  1. Drive and energy: drive mode, regen, Energy Saving Mode, powertrain/steering/ brake feel, one-pedal, brake-to-standstill, and Auto Hold. Put level 5 in a clearly marked Advanced recovery subsection with its own acknowledgement; do not hide it inside the ordinary Low/Medium/High selector.
  2. Driving assistance: lane keeping, lane sensitivity/alerts, ACC/TJA, and collision/traffic assistance.
  3. Convenience (non-ambient): access/auto-lock, mirror behavior, HVAC linkages, non-ambient lighting timers, welcome sound, linkage preferences, and supported seat/tailgate preferences. Mark request-style and hardware-moving items Apply now only.
  4. Safety controls: ESP/traction and HDC. This section should initially expose status and an OEM-settings shortcut, not a silent startup toggle.

Changing an ADAS or safety row should show the exact effect and an explicit acknowledgement. A separate Apply now button must be disabled while moving and must display the parked/ignition requirement. The normal startup path must not prompt the driver while driving.

The ambient-lighting section is intentionally absent for the current vehicle profile.

8. Capability and firmware detection

Build a capability profile from, in order:

  1. vehicle-service package version/signature and head-unit build fingerprint;
  2. the child Binder’s interfaceDescriptor;
  3. a checked-in mapping of known firmware profiles and transaction layouts;
  4. safe getter probes only when the profile explicitly permits them.

A getter probe is not sufficient by itself: an old transaction can return a valid integer for a different setting. Sanity-check the value range and cross-check with the OEM app, but mark an unknown profile read-only even if a probe looks plausible.

Record the profile identifier in diagnostics so a field report includes the exact firmware and transaction map. Add a new profile only after capturing the corresponding OEM Stub/constants and completing the read/write/read-back matrix.

9. Safety and failure rules

These rules are release blockers, not optional UI guidance:

  • Never default a safety system to Off. Missing preference, parse failure, Binder failure, unsupported trim, or unknown firmware means do not change.
  • ESP/traction-control writes are disabled in the first implementation. If a future release supports “restore on”, permit only value 1, require explicit opt-in, and refuse the operation unless the vehicle is stationary and the current session is valid. There must be no code path that sends ESP value 0 from a startup profile.
  • Do not write ADAS settings while speed is non-zero, during a service reconnect, or when the ignition/gear condition is unknown. Skip and retry at the next safe lifecycle event.
  • Treat regenerative level 5 as an experimental change in lift-off behavior, not as another ordinary list index. Refuse it while moving or when Park/speed/profile is unknown. Capture the previous supported 0–3 value before the write, verify the getter returns 5, expose one-tap restore, and do not retry a rejected or unverified write in a loop. Values 4, 6, and 7 are always rejected locally.
  • Never place door/window/sunroof/tailgate actuators, seat movement, passenger airbag, rear fog, PDC commands, trailer-status commands, or power-mode commands in the startup registry. Their presence in the Stub is inventory evidence, not approval.
  • Never use a callback/status enum as a setter enum without an explicit mapping. This matters for Auto Hold, rear-cross traffic, rear-drive assist, and lane-change.
  • Do not “repair” a failed write by trying nearby transaction IDs or by writing a second candidate interface. Stop, log the profile mismatch, and open the OEM app.
  • Apply settings independently and fail closed. A failed Energy Saving write must not block a verified drive-mode write, and a failed safety read must not trigger a fallback write.
  • Avoid logging VINs or other identifying data. Log setting ID, profile ID, old/new integer, result, and reason locally for troubleshooting.
  • Keep the OEM Vehicle Settings shortcut and explain that the driver can always inspect or restore values there. MG Utility is an auxiliary client, not the source of truth for safety behavior.

10. Validation plan

Automated and offline tests

  • Unit-test every enum formatter and allowed-value validator, including unavailable, callback, and setter-only values.
  • Use a fake Binder to assert descriptor tokens, transaction numbers, integer Parcel order, one-way flags, independent failure handling, and read-back verification.
  • Test schema migration for a true fresh install, an upgraded install with no legacy keys (implicit Normal/Medium), an upgrade with explicit drive/regen keys, malformed values, and an unknown schema version.
  • Test capability-profile selection against both the newer MG4 map and the older com.allgo.rui map; assert that an unknown map produces no setter calls.
  • Test that regenerative values 4, 6, and 7 are rejected locally, that 5 requires an explicit acknowledgement, and that 5 is never an implicit default or preset value.
  • Test moving, unknown-speed, disconnected-service, timeout, setter-queued-but-not- applied, and service-reconnect paths, including the assertion that none of these paths sends regenerative level 5.

Controlled vehicle/bench matrix

For each supported firmware profile, with the vehicle parked and a second observer available:

  1. Record the value in the OEM settings app.
  2. Read it through MG Utility and confirm the label/value mapping.
  3. Change it in the OEM app, reconnect the service, and confirm MG Utility observes the new value.
  4. Select one MG Utility value, apply it once, wait for read-back, and confirm the OEM app shows the same value where the OEM UI represents that value. For regenerative level 5, which has no normal OEM row, record the Binder getter/read-back result, the OEM app's representation (if any), the controlled stationary/closed-course behavior, and restoration to the captured prior 0–3 value.
  5. Power-cycle the vehicle and check whether the setting persists; record persistence as a property of the profile rather than assuming it.
  6. Confirm that changing one setting does not alter neighboring settings.

Safety-system tests must use a controlled, stationary environment and must verify that the normal startup path never sends an Off value. Do not test an intentional safety deactivation on a public road.

Level-5 testing must use a controlled stationary/closed-course procedure with a second observer, a known prior recovery level, a time-limited Apply-now action, and an immediate restore path. A successful Binder queue result without a getter match is unverified, not success.

The headless Android emulator in this repository does not include SAIC’s proprietary VehicleService, so it can cover UI, schema, fake-Binder, and lifecycle tests only. A real head unit or a Binder fixture is required for transaction validation.

11. Implementation phases and file targets

Phase 0 — gateway and compatibility foundation

  • Extract the raw Binder code from EnergyActivity.VehicleGateway into a shared, typed gateway/registry module.
  • Add capability-profile selection, schema versioning, read-back result objects, and structured diagnostics.
  • Migrate existing drive/regen settings without changing existing users’ choices.
  • Add fake-Binder tests and make unknown firmware read-only.

Phase 1 — low-risk drive/energy profile

  • Add Energy Saving Mode, powertrain feel, steering feel, brake-pedal feel, and condition-gated one-pedal mode.
  • Keep drive mode and regen behavior compatible with the current UI.
  • Add the visible Advanced level-5 selector and Apply-now/read-back/restore flow. Keep startup restoration disabled until the target firmware's controlled level-5 test passes; never include it in an efficiency or sport preset.
    • SettingsActivity: use an explicit {0,1,2,3,5} code array rather than storing the selected row index.
    • EnergyActivity.VehicleGateway: add the named 5 constant/label, accept exactly {0,1,2,3,5}, and retain the existing 0xa0/0xa1 getter/setter pair.
    • TripTrackingService: reject an unattended level-5 preference until the matched capability profile, acknowledgement, safe-state gate, and read-back flow are implemented.
  • Add parked/ignition checks and per-setting verification before enabling startup writes in a release build.

Phase 2 — ADAS visibility, then explicit restoration

  • Add read-only cards for lane assist, TJA/ACC, FCW/AEB, blind spot, rear-cross traffic, rear collision, parking warning, and driver monitoring.
  • Validate each setter on the target firmware with the OEM app as the oracle.
  • Enable explicit-value restoration only for settings whose mapping and safety gates have passed review; never add safety-off defaults.

Phase 2b — non-ambient convenience profile

  • Add capability-gated rows for access/auto-lock, mirror behavior, HVAC linkages/AQS, non-ambient lighting timers, welcome sound, start/voice/music linkage, and supported seat/tailgate preferences.
  • Keep request-style and hardware-moving controls as deliberate Apply now actions; do not replay them at service reconnect or include them in unattended startup.
  • Keep ambient lighting absent from this profile because the target vehicle is not equipped with it.

Phase 3 — high-risk controls and broader variants

  • Keep ESP/HDC read-only unless a separate safety review authorizes a narrowly scoped “restore on” operation.
  • Add older interface profiles only with captured Stub/constants and a vehicle test matrix. Do not make the newer transaction map a universal fallback.

Phase 4 — release hardening

  • Add a visible kill switch for startup writes and a one-tap reset to inherit.
  • Publish the supported vehicle/firmware profile list and known limitations.
  • Update README claims that currently say only drive mode and regen are written.
  • Run ./build.sh, fake-Binder tests, and git diff --check before packaging.

12. Open questions to resolve before implementation

  • Which exact MG model/trim and head-unit firmware versions should be supported first?
  • Does the target firmware persist each setting across a full power cycle, or does the startup profile need to run on every ignition event?
  • Are all setters accepted only in Park, or do individual settings have stricter OEM preconditions?
  • On the target car, is 0x51/0x52 (combined ACC/TJA) authoritative, or is the legacy 0x5d/0x5e traffic-jam switch also active?
  • Does the target vehicle expose Energy Saving’s boolean 0/1 behavior, and what do its recommend/disable status signals mean in practice?
  • Does the exact target firmware accept regenerative level 5, return 5 from the getter, persist it, and represent it in any way in the OEM UI? What lift-off and braking behavior results, and does another drive mode immediately replace it?
  • Which settings are legally required to remain enabled in the intended market?
  • Should “restore on” for ESP ever be exposed, or should traction remain permanently read-only in MG Utility?

13. Definition of done

The feature is ready for a target firmware only when all of the following are true:

  • The profile is identified without ambiguous transaction probing.
  • New installs default to Do not change.
  • Every enabled setting has a validated getter, setter mapping, safety condition, and read-back test.
  • A moving or unknown-state vehicle produces zero setter calls.
  • An unsupported or failed setting leaves the vehicle’s current value untouched and does not block other independent settings.
  • The OEM settings app confirms every enabled write after a power-cycle test. For regenerative level 5, use named Binder getter/read-back plus the controlled test procedure because the normal OEM UI does not expose that value.
  • ESP/traction cannot be set to Off by the startup path.
  • Level 5 is selectable only through the explicit Advanced flow, never by default or by a preset, and values 4, 6, and 7 cannot be selected.
  • UI, diagnostics, README, and the supported-firmware list accurately describe what the build can change.