蜻蜓伴读
Open sourceAndroid

MTBOX

An Android video and local-music toolbox, secondary-developed from FongMi/TV under GPL-3.0. The whole package is open source: music engine, lyric panel, transparent audio path and hardening included. Local decoding, works offline.

How it is built

MTBOX is secondary-developed from the open-source FongMi/TV project (GPL-3.0), version 6.6.19. The whole package — baseline, patches, music engine and build scripts — is on GitHub: 11,200 files, about 183 MB.

The local music engine is thirteen Java files: javac and d8 produce a classes4.dex that is injected directly, with no smali round-trip. It drives a MediaSession with a MediaStyle notification, so the lock screen, control centre and headset or car buttons all work.

The effect chain is exactly Equalizer plus BassBoost. LoudnessEnhancer is disabled and setPlaybackParams is never called at 1.0×, so a full-scale lossless source is never clipped by dynamic loudness processing — playback stays on the native path.

Lyrics come from the public NetEase endpoint: LRC is synced word by word and cover art falls back gracefully. If both cover and lyrics fail, playback continues silently instead of throwing an error at you.

Hardening: NanoHTTPD is bound to 127.0.0.1 instead of 0.0.0.0, six dangerous permissions including CAMERA are removed, and the scanner page simply finishes instead of opening the camera.

Packages are signed with a keystore I keep myself and verified with apksigner for v2/v3 — no third-party re-signing. It complements TTBOX: one guards the HarmonyOS ecosystem, the other guards Android.

Features

What it does

No need to open GitHub — this page spells it out.

01

Covers non-HarmonyOS devices

A separate Android package next to TTBOX, so the Android projector or the old tablet in the house can play too.

02

Self-held signing key

Signed with a keystore I keep myself, verifiable before install, never re-signed by a third party.

03

Local import, straight to playback

No cloud account, no sign-in. Import local media and it plays; the network can be off entirely.

04

Open source under GPL-3.0

The whole package — music engine and build scripts included — is on GitHub, and the FongMi/TV baseline is GPL-3.0 as well.

05

Transparent audio path

Equalizer and BassBoost only; LoudnessEnhancer is never enabled, setPlaybackParams is untouched at 1.0×, and lossless sources play through the native path.

Screens

MTBOX in the interface

MTBOX interface screenshot 1
Local music · track list
MTBOX interface screenshot 2
Lyrics panel · word-synced
MTBOX interface screenshot 3
Theme and playback
Architecture

How the package is assembled

Two halves — the decompiled baseline plus the injected music engine — with apktool run twice to pin the resource ids down.

01

The work_fong baseline

FongMi/TV 5.6.1 decompiled, renamed, version bumped to 6.6.19 (versionCode 60619).

02

smali patches

Unified theming, the version display, fullscreen rotation and the security hardening all live in smali, each one with a written-up plan.

03

The javainject music engine

Thirteen Java files through javac and d8 produce a classes4.dex, dropped into work_fong/unknown and copied verbatim into the APK by apktool — no smali round-trip.

04

R.java regeneration

genr.ps1 assembles the resource id table from public.xml and an aapt2 dump. Touch res/ and every id shifts, which is why the build runs twice.

05

The unknown directory

apktool copies everything under work_fong/unknown into the APK as-is, and ART loads classes 1 through 4.dex together.

06

Signing

apksigner signs v2/v3 and verifies; the keystore stays with me and out of the repository.

Build

Building it locally

Four steps, and the order matters.

  1. 01

    Generate R.java

    powershell -File javainject/genr.ps1 -Apk <freshly built .apk>. Resource ids shift, so this runs on every round.

  2. 02

    Set the signing passwords

    Export MTBOX_KS_PASS and MTBOX_KEY_PASS. You generate your own keystore.

  3. 03

    Package

    powershell -File javainject/build.ps1 -Tag music. apktool runs twice — do not skip pass 1.

  4. 04

    Verify

    apksigner verify passes and the ids in R.java line up (tabSongs, musicList and the rest) — that is what success looks like.

Upstream

Credits

  • FongMi/TV —— the baseline this project is built on, GPL-3.0
  • mpv —— playback core, GPL-2.0-or-later
  • FFmpeg —— codecs, LGPL / GPL
Questions

FAQ

Why does apktool have to run twice?
Touch res/ and aapt2 re-sorts the whole @+id table, while R.id is a compile-time constant. Pass 1 captures the resource table and regenerates R.java; pass 2 packages the same res. Only then do the two passes agree on the ids. Skip pass 1 and findViewById returns somebody else's view — or null — and the app dies on the spot.
Why not write the music engine in smali?
Thirteen Java files go through javac and d8 into a classes4.dex, which goes straight into work_fong/unknown — apktool copies that directory into the APK verbatim. It saves a whole round of smali compilation and never touches a register.
Does the sound effect chain distort anything?
The chain is Equalizer plus BassBoost only; LoudnessEnhancer is disabled — it is a dynamic loudness processor, not a gain, and it clips full-scale lossless sources. The original preset is all-zero EQ plus zero bass, which is completely transparent.
Can the lock screen and the car be controlled?
Hardware media keys work: headset and car skip, play and pause are forwarded into the container. The lock-screen and control-centre media cards do not appear — they depend on the system querying the MediaSession, and container isolation blocks that. No fix exists at the app layer.
Why are no sources bundled?
Deliberately. Every external subscription is configured by the user; the project ships no content sources and no online parsing URLs.
Legal

Disclaimer

  1. This project is a secondary development of the open-source FongMi/TV project (GPL-3.0). The full source and the third-party notice are in the GitHub repository.
  2. This project ships no content sources and no online parsing URLs. Every external subscription and channel is configured by the user and is not provided by this project.
  3. This project offers no commercial service: no fees, no payment, no transaction of any kind. It exists for personal study and technical research only.
  4. Comply with local laws before use. The user alone is responsible for any consequence of using this software, and the author is not liable.
  5. Upstream third-party components (Thunder SDK, ForceTV, mpv, FFmpeg and others) remain under their own licenses — verify their terms before redistributing.
  6. This site shows technical and implementation details only and involves no transaction; afdian is a channel for supporting the work and is unrelated to how the APK is distributed.