Architecture & protocol

How iNA runs Apple Continuity, L2CAP AAP and system overlays on Android

Apple accessories speak a handful of Bluetooth protocols to iPhone. iNA speaks them too, from an ordinary Android app — no root, no Magisk modules and no iOS virtual machine.

The iNA chameleon perched next to the bitten apple á

Four layers, all in user space

01

Listen

Bluetooth LE · Company ID 0x004C · type 0x07

A foreground service scans for Apple Continuity manufacturer data. Proximity Pairing packets carry the model ID, in-ear status, Left / Right / Case battery and the lid-open counter — enough to pop up the moment you open the case.

  • BluetoothLeScanner with a 0x004C filter
  • RSSI gate so only the case in your hand triggers
  • Disconnected battery stays --%, never guessed
02

Talk

L2CAP CoC · PSM 0x1001 · AAP

Once paired, iNA opens a raw connection-oriented L2CAP channel and speaks the Apple Accessory Protocol directly — the same channel an iPhone uses for listening modes and sensor events.

  • ANC · Transparency · Adaptive · Off
  • Conversation Awareness 0x28 · Personalized Volume 0x26
  • Ear detection, head gestures and stem events
03

Adapt

ORT / OTA dynamic rule engine

OtaProtocolRuleManager loads signed JSON rules, so new model IDs, opcodes and PSM overrides ship without an app update. Models can be hot-registered at runtime and inspected in the app.

  • Signed rule bundles with version pinning
  • Dynamic L2CAP PSM override
  • Model hot-registration
04

Surface

WindowManager · TYPE_APPLICATION_OVERLAY

The case-open sheet is drawn as a system overlay above whatever app you're in, with a fallback Activity when overlay access isn't granted — plus a Quick Settings tile and a live status notification.

  • One-tap Connect via CompanionDeviceManager
  • iNA Noise Control Quick Settings tile
  • Persistent live status with battery

Anatomy of a 0x07 Proximity Pairing packet

manufacturer data · 0x004C
Byte 0
0x07 — Proximity Pairing type
Byte 3–4
16-bit model ID (e.g. 0x2420)
Byte 5
Status · bit 1 Left in ear · bit 3 Right in ear
Byte 6
Left battery (high nibble) · Right battery (low nibble), ×10%
Byte 7
Case battery (low nibble) · bits 4/5/6 L/R/Case charging
Byte 8
Lid-open counter (low 3 bits)