18 KiB
18 KiB
长安语言刷入工具 (Changan Language Flashing Tool)
Overview
Windows GUI tool suite (Python 3.6+ / tkinter) for flashing or pushing multi-language APKs to Android-based vehicle infotainment systems. Built by 宜宾科宜科技有限公司.
Most tools are single-file tkinter apps with the same rough architecture: GUI, VIN authorization, package extraction, ADB commands, logging, and worker threads live in one class. Preserve that style unless the user explicitly asks for a larger refactor.
Tool Variants
| Tool file | Vehicle / purpose | Window title | Pack script |
|---|---|---|---|
Q07/app.py |
启源Q07 | 长安语言安装工具 | Q07/pack_q07.bat |
S05/S05.py |
深蓝S05 original | 深蓝S05多语言安装 | S05/pack_s05.bat |
S05/S05_fixed.py |
深蓝S05 fixed/experimental copy | 长安语言安装工具 | S05/pack_s05_fixed.bat |
X5plus/X5plusTool.py |
X5plus | 适用于X5plus多语言安装 | X5plus/pack_x5plus.bat |
CS55-Q05/CS55-Q05_Installer.py |
CS55Plus/Q05 通用 | CS55Plus/Q05 语言刷入工具 | CS55-Q05/pack_cs55_q05.bat |
Yidong/app-yidong.py |
长安逸动 | 长安逸动语言刷入工具 | Yidong/pack_yidong.bat |
UNIZ/UNIZ.py |
UNI-Z file pusher | UNI-Z语言文件推送工具 | UNIZ/pack_uniz.bat |
Mazda-EZ60/Mazda-EZ60_1.2.py |
Mazda-EZ60 OS 1.2 | Mazda-EZ60_OS-1.2适用 | Mazda-EZ60/pack_mazda_ez60_1.2.bat |
Mazda-EZ60/Mazda_EZ60-Language-Install_v1.0.py |
Mazda-EZ60 OS 1.0 | 马自达EZ60刷机工具_OS-1.0 | Mazda-EZ60/pack_mazda_ez60_1.0.bat |
Q05-Lidar/Q05-Lidar_Installer.py |
Q05_Lidar permission/bootstrap + language installer | Q05_Lidar | Q05-Lidar/pack_q05_lidar.bat |
Project Structure
├── Q07/ # Q07 script, pack scripts, ignored build outputs
├── S05/ # S05 original and fixed copy
├── X5plus/ # X5plus tool
├── CS55-Q05/ # CS55Plus/Q05 common installer and icon
├── Yidong/ # Yidong-specific tool
├── UNIZ/ # UNI-Z file pusher
├── Mazda-EZ60/ # Mazda-EZ60 tool
├── A07/ # Qiyuan A07 tool
├── Q05-Lidar/ # Q05_Lidar tool plus resource.dat/tools
├── app.ico
├── package.bin # encrypted package, not committed; shared from root
└── tools/ # shared adb/fastboot/7za dependencies for pack scripts
├── adb.exe
├── AdbWinApi.dll
├── AdbWinUsbApi.dll
├── fastboot.exe
└── 7za.exe # 7-Zip Extra 26.01, bundled by pack scripts
Architecture Notes
- Most tools use class
ADKAPKGUI;UNIZ/UNIZ.pyusesUNIZLanguageGUI. - Worker actions run in
threading.Thread(..., daemon=True). - Tkinter calls from workers must go through
run_on_ui_thread(...). - Prefer
self.root.after(0, lambda: func(*args, **kwargs))inrun_on_ui_thread; directafter(0, func, *args, **kwargs)breaks when kwargs such astext=orfg=are passed. - Background
messagebox.*calls should be scheduled withrun_on_ui_thread. - Keep files UTF-8 with
# -*- coding: utf-8 -*-.
ADB And Auth
run_adb_command(command)handles normal ADB commands such asadb devices,adb push, and non-shell install calls.run_adb_shell(shell_command)exists in the 逸动-family tools and Mazda copy; it shells into the device and automatically sends passwordadb36987.- All
adb shelloperations inCS55-Q05/CS55-Q05_Installer.py,Yidong/app-yidong.py, andMazda-EZ60/Mazda-EZ60_1.2.pyshould go throughrun_adb_shell(). UNIZ/UNIZ.pymust not useadb shell; it only checks devices and pushes APKs to/storage/emulated/0/Download/.- Standard auth flow uses:
auth-check?vin=...for authorization.package-key?vin=...forpackage.binextraction password.
- VIN keys:
- Q07/S05/X5plus:
ca_vin_infoorVIN. - 逸动/Mazda:
settings get system ca.car.vinvia auto-password shell. - UNI-Z: user manually enters VIN.
- Q07/S05/X5plus:
Package Extraction
package.binis extracted under%LOCALAPPDATA%\.cache\system\.android\....- Current cache directories:
Q07/app.py->apps_cache_Q07S05/S05.py/S05/S05_fixed.py->apps_cache_S05X5plus/X5plusTool.py->apps_cache_X5plusCS55-Q05/CS55-Q05_Installer.py->apps_cache_commonYidong/app-yidong.py->apps_cache_yidongUNIZ/UNIZ.py->apps_cache_UNIZMazda-EZ60/Mazda-EZ60_1.2.py->apps_cache_Mazda_EZ60
- Shared binaries are managed under root
tools/:adb.exe,AdbWinApi.dll,AdbWinUsbApi.dll,fastboot.exe, and7za.exe. Vehicle pack scripts in subfolders should copy from%ROOT%\tools, not from each vehicle folder. - For progress display, detect support for
-bsp1by checking for-bs{o|e|p}in 7za help output. - If
Incorrect command lineappears, retry with the basic compatible command:x package.bin -pPASSWORD -oDIR -y. - Decode 7za output with GBK first, then UTF-8 fallback.
- 7za progress must parse streamed output cumulatively. Do not read one byte and regex that single byte; percentages such as
42%span multiple bytes and will otherwise jump from 0 to 100. - User-facing resource extraction text should say
资源准备中/Preparing resources, not资源解压/Extracting package, unless the UI is an explicit debug test. - Cache cleanup should be best effort in three places when feasible: before a new extraction, during normal window close, and via
atexitfor ordinary process exit. A forced process kill cannot be guaranteed, so also clear stale caches at next extraction/startup.
Shared UX And Safety Rules
- Hosts update logic should replace conflicting entries for the managed domain. If the hosts file already contains the target domain with a different IP, delete that line and write the expected
IP domainentry instead of appending duplicates. - VIN authorization logs should be explicit for operator-facing flows: print the current VIN, print
data.vehicleNamewhenauth-checkreturns it, print authorization success, and print a clear unauthorized/failure log when denied. package-keyrequests should use the vehicle name returned byauth-check(data.vehicleName) whenever available. Do not hardcode a model name if the authorization API already returned the exact vehicle name for the VIN.- Normal users should not see low-level sensitive process details such as
fastboot,init_boot, boot keys, or image names during permission/bootstrap flows. Use black-box text such as正在获取权限中,获取成功, and获取失败; leave command details for debug mode only. - Process logs should stay minimal in normal mode. Detailed ADB/7za/API command logs belong behind debug mode.
- All Tkinter UI updates and
messagebox.*calls from workers must go throughrun_on_ui_thread(...).
Model-Specific Behavior
S05
- Keep
S05/S05.pyas original unless explicitly asked. - Use
S05/S05_fixed.pyfor experimental/fixed S05 changes. - Do not add
chmod,chown, orrestoreconto the S05 system-app push path unless explicitly requested; the target system inherits permissions. S05/S05_fixed.pyincludes debug extract testCtrl+Shift+Eand 7za progress support.
UNI-Z
- Endpoint for visible passwords:
/api/authorizations/get-uni-z-pwd. - Display
factoryPwdas factory mode password andpasswordas debug password. - If
authorized == falseorpasswordis empty, show unauthorized state and do not proceed. passwordfromget-uni-z-pwdis not the package extraction password.- Before push, call
/api/authorizations/package-key?vin=...to get the realpackage.binpassword. - Push only to
/storage/emulated/0/Download/; noadb shell. - Language selection: RU/FR/ES/EN. Only the selected language Settings APK is pushed; other language Settings APKs are skipped silently.
- Hidden debug mode:
Ctrl+Shift+D, passwordzxch5200, logs full ADB/7za/API details.
CS55-Q05
- CS55Plus/Q05 common installer lives in
CS55-Q05/CS55-Q05_Installer.py, with iconCS55-Q05/cs55-q05.icoand pack scriptCS55-Q05/pack_cs55_q05.bat. pack_cs55_q05.batis Cython-only. If Cython fails or no_core*.pydis generated, stop the build; do not fall back to normal PyInstaller.- Normal
刷入语言包logs should not reveal APK names; show generic current/total progress only.安装Appmay show each APK result and current APK name.
Mazda-EZ60
- Based on
CS55-Q05/CS55-Q05_Installer.py/ 逸动 flow. - Uses auto-password shell (
adb36987) for VIN reads,pm install, overlay enable, disable commands, settings, and reboot. - Installs APKs from extracted
appsvia push to/data/local/tmpthenpm install -r -d. Mazda-EZ60/Mazda-EZ60_1.2.pyshould show 7za extraction progress with stream parsing.- Mazda 1.2 package cache is
%LOCALAPPDATA%\.cache\system\.android\apps_cache_Mazda_EZ60; clean it on startup, before extraction, on normal window close, and throughatexit. - Mazda
package-keyrequests must include bothvinandvehicleName; cachedata.vehicleNamefromauth-check, and queryauth-checkbeforepackage-keyif it is missing. - Mazda hosts setup should keep exactly one target mapping for
spm.auto-pai.com: replace mismatched IPs with103.236.55.140 spm.auto-pai.cominstead of appending a conflicting duplicate. If hosts setup fails, tell the user环境配置失败. - Mazda UI should not show the company/about subtitle.
- Mazda language switching should cover all operator-facing buttons, labels, dialogs, logs, progress text, hotspot status, password query UI, and quick-language popup text. The right-side usage tips should render from translated
hint_lineswith wrapping so English text does not overlap or overflow. - Mazda normal logs/prompts should keep only key operator-facing outcomes and fuzzy resource/environment errors. Do not show package names, language package APK names, raw commands, paths, or command output during
刷入语言包; manual安装Appmay show selected APK filenames. VIN andvehicleNameare not sensitive and may remain visible. - Mazda debug mode uses
Ctrl+Shift+Dand verifies the password throughPOST /api/authorizations/verify-debug-mode-password; detailed ADB/7za/API output belongs in debug mode only. - Mazda pack scripts
pack_mazda_ez60_1.0.batandpack_mazda_ez60_1.2.batare Cython-only. If dependencies, Cython compilation, PYD generation, resource copy, PyInstaller, or final exe output fail, stop immediately with an[ERROR]reason; do not fall back to normal PyInstaller. - Regardless of APK install failures, run post-install configuration after the install loop.
- Post-install overlays to enable:
com.tinnove.launcher.overlaycom.tinnove.scenemode.overlaycom.incall.dvr.overlay
- Post-install packages to disable:
com.carinno.p1com.wtcl.electronicdirectionscom.ximalaya.ting.android.carcom.tinnove.netease.musiccom.migu.miguplay.carcn.cmvideo.car.playcom.tinnove.carshowcom.tinnove.changbacom.qiyi.video.iv
- User cancelled the
Ctrl+Shift+Edirect extract test request for Mazda; do not add it unless asked again.
Q05_Lidar
- This is the Q05_Lidar-specific tool and must not be confused with any ordinary Q05 variant or package.
- Based on the shared installer visual style, but its resource structure and flashing flow are Q05_Lidar-specific.
- The first-row
获取权限button installsruntime.dat->base.apk, reboots to fastboot, waits for a realfastboot devicesrow like<serial> fastbootwith a non-aggressive interval, then fetches a boot key throughPOST /api/authorizations/boot-challengethenPOST /api/authorizations/boot-key, decrypts embeddedresource.dat, flashesinit_boot, immediately reboots, and deletes the temporary img. Keep the decrypted img lifetime as short as possible. resource.datis AES-GCM encrypted and must match the serverBOOT_KEY; the tool only acceptsdata.sessionKeyfromboot-key.- Device fingerprint data sent to the server includes ADB serial,
ro.serialno,ro.boot.serialno, manufacturer, model, device, build fingerprint, and VIN. 刷入语言包installs Magisk modules, not APKs. It openscom.topjohnwu.magisk, warns the user to grant Shell/root permission, verifies/debug_ramdisk/su -c "id"returnsuid=0, extractsQ05_Lidar-package.bin, then pushes module files to/data/local/tmp/q05_lidar_modules/<MODID>/and root-copies them into/data/adb/modules/<MODID>.Q05_Lidar-package.binshould unpack with module files at archive root:module.prop, scripts,system/, anddisable-wireless-adb-vecentek-magisk.zip; do not wrap them in an outerQ05_LIDAR_DATA/directory.- Q05_Lidar package cache is
%LOCALAPPDATA%\.cache\system\.android\apps_cache_Q05_Lidar; the tool cleans it on startup/extraction and on normal/atexit shutdown. - Q05_Lidar
runtime.datcache is%LOCALAPPDATA%\.cache\system\.android\apps_cache_q05_lidar_runtime; treat it as temporary and clean stale contents before extraction. Q05_Lidar-package.binis an external release file next to the exe because it is large.resource.datis embedded in the exe;runtime.datshould be copied next to the exe by the pack script.package-keymust include thevehicleNamereturned byauth-checkfor the VIN. The tool cachesdata.vehicleNamefrom password query / authorization check and uses it for package-key; if missing, queryauth-checkfirst rather than falling back to a hardcoded Q05_Lidar value.- All
adb shellcommands in Q05_Lidar, including Magisk launch and/debug_ramdisk/su -c ..., must go throughrun_adb_shell()so the tool silently sendsadb36987. - The
安装Appbutton remains the APK install path: file picker ->adb push->setprop vecentek.model 1->pm install -r -d -f-> cleanup. Do not replace it with the Magisk module flow. - Temporary debug mode exists only for development and should be removed before release when requested. Press
Ctrl+Shift+D; the password is verified throughPOST /api/authorizations/verify-debug-mode-password. - In Q05_Lidar debug mode, hidden buttons appear for:
指纹测试: collect and log device fingerprint fields plus local SHA256 summary.解密测试: if VIN/device is available, fetch boot key; otherwise prompt for a pastedBOOT_KEY/sessionKey, decryptresource.datlocally to a temporary img, log size/SHA256, then delete it.解压测试: fetchpackage-key, extractQ05_Lidar-package.bin, and verify the main Magisk module plusdisable_wireless_adb_vecentekmodule can be identified.
- Do not log the actual boot key/session key in debug mode.
Yidong/app-yidong.py
- Uses
apps_cache_yidong. - Has 7za compatibility handling for progress switches and
Incorrect command linefallback. Yidong/pack_yidong.batoutput name is ASCII:Changan-Yidong-Language-Installer.exe, to avoid CMD codepage issues with ChineseNAME.
Build Notes
- Pack scripts install/use
pyinstaller,cython, and usuallypyzipper. - Cython success requires Microsoft C++ Build Tools.
- Cython success signs in logs:
building '_core' extension_core.cpXXX-win_amd64.pydPYD: _core...pyd- output under
dist_cy\dist\...exe
- If logs show
[WARN] Cython failed, fallbackand[INFO] Normal PyInstaller, the exe still builds but is normal PyInstaller and easier to reverse. - For security-sensitive tools like Q05_Lidar, do not keep a normal PyInstaller fallback. If Cython fails or no
_core*.pydis generated, stop the build and show an error. - A Cython onefile PyInstaller build should use a tiny
launcher.pythat importsmainfrom compiled_core.pyd, and the exe archive should contain_core*.pyd. Confirm with PyInstaller archive viewer when in doubt. UNIZ/pack_uniz.batand Mazda-EZ60 pack scripts use ASCII output names to avoid CMD encoding problems.- Generated
.exe,.spec,build/,dist/, anddist_cy/are build artifacts and should not be committed unless explicitly requested.
Key Behaviors To Preserve
- Keep original tools untouched when a fixed or model-specific copy exists.
- Preserve VIN-based authorization for normal flashing tools.
- Fetch
package-keyfrom the server instead of hardcoding package passwords. - Keep all shell commands in 逸动/Mazda tools behind
run_adb_shell(). - Keep UNI-Z shell-free.
- Use
run_on_ui_thread()for all tkinter UI updates from worker threads. - Keep shared Android/7za binaries under root
tools/and have pack scripts copy from there.
Current Local State (2026-05-28)
UNIZ/UNIZ.pyandUNIZ/pack_uniz.batexist locally. Cython build has succeeded after installing Microsoft C++ Build Tools, producingdist_cy\dist\UNIZ-Language-Pusher.exe.Mazda-EZ60/Mazda-EZ60_1.2.pywithpack_mazda_ez60_1.2.bat, andMazda-EZ60/Mazda_EZ60-Language-Install_v1.0.pywithpack_mazda_ez60_1.0.bat, exist locally. Mazda has 7za progress extraction, Cython-only packaging, and version-specific output names.Yidong/app-yidong.pyhas been updated for 7za progress compatibility andIncorrect command linefallback.Yidong/pack_yidong.bathas been updated with quoted paths,cd /d "%~dp0", and ASCII output name..gitignorehas been expanded to ignore generated exe/spec artifacts.- There may be untracked local build outputs and generated specs; inspect
git status --ignoredbefore committing.
Known Issues
- Some older tools still have minimal exception handling and bare
except: pass. test_extract.pyhardcodes a password and should not be treated as production flow.on_disable_upgradebehavior is Windows/vehicle specific.- Pure PyInstaller fallback is easy to reverse; prefer successful Cython builds for release.