Skip to content

feat(telephony): Add Data SIM switcher & Network Mode band locking with Shizuku reflection#565

Closed
zax4r0 wants to merge 4 commits into
sameerasw:mainfrom
zax4r0:feat/data-sim-tile
Closed

feat(telephony): Add Data SIM switcher & Network Mode band locking with Shizuku reflection#565
zax4r0 wants to merge 4 commits into
sameerasw:mainfrom
zax4r0:feat/data-sim-tile

Conversation

@zax4r0

@zax4r0 zax4r0 commented Jul 10, 2026

Copy link
Copy Markdown

Purpose

This PR adds support for quick toggling of the Default Data SIM subscription and force locking network bands (e.g. LTE-only, 5G-only) on dual-SIM Android devices. The implementation uses Shizuku and standard Java reflection to directly interface with internal Android telephony binder stubs (ISub and ITelephony), fully bypassing hidden API restriction blocks without requiring root access.

Core Features Added

  1. Data SIM Quick Setting Tile:
    • Cycles through active SIM slots (SIM 1 / SIM 2) as default mobile data connections.
    • Leverages Shizuku reflection over ISub.setDefaultDataSubId to instantly apply changes at the system level.
    • Auto-activates/enables mobile data (setDataEnabledForReason / setDataEnabled) on the target subID on switch, preventing connection drops.
  2. Network Mode Quick Setting Tile:
    • Cycles between LTE-only (4G) and NR-only (5G) configurations on the currently active data SIM.
    • Dynamic fallback logic handles Android 14/15/16/17+ reflection signatures (falling back between 4-parameter and 3-parameter setAllowedNetworkTypesForReason methods).
  3. Telephony Controller Settings Activity:
    • Accessible by long-pressing either QS Tile.
    • Built entirely in Jetpack Compose, featuring a single flat row selector for the default Data SIM.
    • Displays individual card controls for each active SIM to choose and lock between 5 network modes (5G Preferred, NR Only, LTE Only, 3G Only, 2G Only) via dropdown dialogs.
    • Filters out disabled eSIM profiles and historical inactive records in the database.
  4. ADB Broadcast Controls:
    • TelephonyActionReceiver listens to intent-driven commands (com.sameerasw.essentials.SET_DATA_SIM and com.sameerasw.essentials.SET_NETWORK_MODE), enabling full automation.
  5. Release Signing Config:
    • Configures release build types to utilize default debug signing keys for easy developer installations.
  6. Unit Test Suite:
    • Unit tests added in TelephonyParserTest.kt to verify active SIM parsing from dumpsys isub output.

Commit Structure (4 Clean Commits)

  • be8e42b9 test: Add TelephonyParserTest unit test suite & configure release signing
  • 95d5edd1 feat: Add NetworkModeSettingsActivity for in-app configuration
  • 127f7b3f feat: Add TelephonyActionReceiver for ADB controls and register services
  • 45fd9b3a feat: Add core Data SIM and Network Mode quick setting tiles

Manual Testing & Verification

1. Data SIM Toggle

  • QS Tile Action: Click Data SIM tile to switch data connection from Airtel to Jio and vice-versa.
  • Expected Result: Settings update instantly, and mobile data is automatically turned ON for the target SIM.
  • ADB Command:
    adb shell am broadcast -p com.sameerasw.essentials -a com.sameerasw.essentials.SET_DATA_SIM --ei subId 3

2. Network Mode Toggle

  • QS Tile Action: Click Network Mode tile to toggle between 4G (LTE Only) and 5G (NR Only) on the active data SIM.
  • Expected Result: Mobile connection cycles bands instantly.
  • ADB Command:
    adb shell am broadcast -p com.sameerasw.essentials -a com.sameerasw.essentials.SET_NETWORK_MODE --ei subId 3 --el bitmask 266240

3. Settings UI Overlay

  • Launch: Long press either the Data SIM or Network Mode tile.
  • Expected Result: Renders a clean list of active SIMs, displays their current lock configuration, and enables switching. Disabled eSIM cards with slot index -1 are successfully ignored.

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant