Skip to content

Glyph Controller 1.19

Choose a tag to compare

@Chengdong-Yu Chengdong-Yu released this 20 Sep 14:53
· 8 commits to main since this release

Glyph Controller 1.19

面向 Nothing Phone (2) 的 Glyph LED 控制器。以 root 身份直接读写 AW20036 驱动的 sysfs 节点来驱动灯带,不依赖 Nothing 官方 Glyph SDK,因此不受前台服务限制。

这是改名为 Glyph Controller、包名迁移到 com.richard.glyphcontroller、并完成 Java → Kotlin 重写之后的首个正式发布版本。

功能

全开 / 全关 — 一次写入 33 个可寻址区域的最大亮度。

充电扫光 — 插入充电器时从下往上扫一遍:感叹号竖条自底向上点亮,接着圆点、左下弧与右下弧、左右竖条、上侧弧,最后由主环收尾。逐段步进 15 ms,全亮保持 400 ms,随后渐暗熄灭。由 root 看门狗捕获充电状态上升沿触发。

通知闪光 — 新通知到达时三组灯带依次闪一次:最下方感叹号竖条 + 圆点 → 主环右上方弧段 → 相机 deco 周围两条灯带。每组亮 90 ms、组间熄 40 ms。分组摘要与常驻通知会被跳过,避免重复触发。

快捷设置磁贴 — 下拉通知栏一键全开 / 全关,状态持久化,重启后磁贴显示上次结果。

实现要点

  • 直接写 /sys/class/leds/led_strips/:operating_mode(0 灭 / 1 激活 / 2 待机)、frame_brightness(空格分隔的 33 个亮度值)、single_brightness、all_brightness
  • 33 区映射表(frame 索引 → AW20036 寄存器)集中在 RootGlyphClient.kt
  • 保活脚本由 app 自动落盘到 /data/adb/service.d/glyph_keepalive.sh(Magisk / KernelSU 开机自启目录),内含单例看门狗循环:app 进程消失则 am startservice 拉起;同时以 1 秒周期轮询 /sys/class/power_supply/battery/status 与 usb/online 捕获充电上升沿
  • 脚本幂等地为 app 加上电池白名单、RUN_ANY_IN_BACKGROUND、standby bucket 豁免与自启动权限
  • 通知监听注册通过 cmd notification allow_listener 在独立会话中完成,不与脚本安装挤在同一个 su 会话里,避免重绑监听导致安装序列被打断
  • Kotlin 重写,唯一依赖 com.google.android.material:material:1.12.0
  • 界面与资源中英双语,按系统语言自动切换

安装要求

  • Android 13(API 33)及以上

已知限制

  • release 变体与 debug 共用同一套签名,便于直接覆盖安装,不作正式分发签名使用
  • 通知闪光的节奏常量集中在 GlyphNotificationService 顶部(ON_MS / GAP_MS),充电扫光的在 ChargingSweepService 顶部(STEP_MS / HOLD_MS / FADE_MS),观感不合口味时可直接改

校验

项目 值
文件 app-release.apk
大小 1,944,807 字节(1.85 MiB)
SHA-256 E485A35B58B148F20506903E96BB5846622DB2EFE24C5A29837CFF77C3137DFE
versionCode / versionName 20 / 1.19
minSdk / targetSdk 33 / 35

English

Glyph LED controller for the Nothing Phone (2). It drives the AW20036 LEDs by reading and writing the driver's sysfs nodes directly as root, without depending on the official Nothing Glyph SDK, so there is no foreground-service restriction.

This is the first formal release after the rebrand to Glyph Controller, the migration to com.richard.glyphcontroller, and the Java → Kotlin rewrite.

Features

All-on / all-off across the 33 addressable zones in a single write. A bottom-up charging sweep on the charger rising edge: the exclamation bar lights bottom to top, then the dot, the left and right lower arcs, the left and right vertical bars, the upper arc, and finally the main ring. 15 ms per step, 400 ms hold, then a fade out. A three-stage notification flash: bottom exclamation bar + dot → upper-right ring arc → the two strips around the camera deco, 90 ms on per group with a 40 ms gap, skipping group summaries and ongoing notifications. A Quick Settings tile that toggles everything in one tap with persisted state.

Implementation

Direct writes to /sys/class/leds/led_strips/{operating_mode,frame_brightness,single_brightness,all_brightness}. A keepalive script is installed into /data/adb/service.d/glyph_keepalive.sh with a singleton watchdog loop plus 1-second charger-edge polling. Notification listener registration runs in its own shell session. Kotlin, single dependency (material:1.12.0), zh/en resources selected by system locale.

Requirements

Android 13+ (API 33).

Notes

The release variant is signed with the debug key so it can be side-loaded over an existing install; it is not a distribution signing key. Animation timing constants sit at the top of GlyphNotificationService and ChargingSweepService if you want to retune them.