Skip to content

The gear reading on every car: straight from the car's system service when the map has none - #489

Open
VysseCodes wants to merge 1 commit into
release/2.0from
feat/gear-without-map
Open

VysseCodes wants to merge 1 commit into
release/2.0from
feat/gear-without-map

Conversation

@VysseCodes

Copy link
Copy Markdown
Collaborator

Problem

HMG-API reads "in P" through the hook map (framework.system_service.gear_p_status). A car with no map, like the US EV6 on 260903 before #488, has no gear reading at all. That leaves two things with nothing to go on:

Finding

That point is a method on a stock Binder service, not obfuscated app code:

  • service com.hkmc.micom.system (com.hkmc.Service.SYSTEM_SERVICE), interface com.hkmc.micom.ISystemService, method getGearPStatus(), 1 in P
  • its transaction number is 36 (0x24) in all 21 stock frameworks we have (framework/automotive.odex): Kia and Hyundai; US, Canada, Korea; builds from 250818 to 260903, the Ioniq 6 included; the same 100-method interface everywhere
  • the implementation (automotive-service.odex, SystemService.getGearPStatus) returns a field (mGearPStatus), with no permission check

So any root or system process can read it with service call com.hkmc.micom.system 36, with no map, no hook and no patched file. It's a read through the car's own service, as the project's rules ask for vehicle access.

Change

  • Hub.gearP() (vehicle service): the map's point when the map has it, else a direct transact(36) on the stock service. read("gear.park") and the commands' park() use it, with or without a map, so hmgapid vehicle gear.park answers on every car.
  • lib.sh stock_gear_park: the same reading with toolbox's service call, for the installer and boot scripts when the vehicle service isn't running (early in boot, or no mod reading the car). It prints 1, 0, or nothing for no reading.

Fixes / unblocks

Tested

Off-car:

  • install/common/test.sh: stock_gear_park in P, not in P, the service not there, a failing call; it asks for com.hkmc.micom.system 36
  • core/runtime/commands-test.sh (212), core/runtime/homewifi-test.sh (157); javac clean

Not on a car yet. Before merging: adb shell service call com.hkmc.micom.system 36 once in P (expect Parcel(00000000 00000001 …)) and once in D (… 00000000 …), on a car with a map and on one without.

… when the map has none

HMG-API read "in P" through the hook map's framework.system_service.gear_p_status,
so a car with no map had no gear reading. That point is a stock Binder service:
com.hkmc.micom.system (com.hkmc.Service.SYSTEM_SERVICE), ISystemService
.getGearPStatus. Its transaction number is 36 (0x24) in all 21 stock frameworks
we have (Kia and Hyundai; US, CA, KOR; 250818 to 260903; the Ioniq 6 too), and
its implementation (SystemService) returns a field with no permission check.

Hub.gearP: the map's point when there is one, else a direct transact on that
service (no map, hook or patched file). read("gear.park") and the commands'
park() use it, also with no map. lib.sh stock_gear_park reads the same with
toolbox's service call, for the installer and boot scripts when the vehicle
service isn't running: 1, 0, or nothing.

Tested off-car: install/common/test.sh (stock_gear_park: P, not P, no service,
a failing call), commands-test.sh (212), homewifi-test.sh (157); javac clean.
Not on a car yet: service call com.hkmc.micom.system 36 in P and in D.
@VysseCodes
VysseCodes requested a review from a team as a code owner December 2, 2026 18:13
VysseCodes added a commit that referenced this pull request Dec 2, 2026
With no gear reading, an error or hmgapid not answering, the app could open
mid-drive. It now opens only on gear.park 1 from HMG-API's vehicle service or,
when that gives no reading, a 1 from the car's own system service (lib.sh
stock_gear_park, #489: no map needed, so cars without a map get it too, used
once the installed lib.sh has it). "Not in P" from the vehicle service wins
over the other. Otherwise it waits, and tries again at the next start.

Tested off-car: install/common/test.sh in sh and bash (no reading at all: not
opened; the car's service P / not P; the vehicle service's "not in P" wins).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant