Skip to content

fix: notification icons on ColorOS 16 (fixAppIcon, drawable override, sizing) - #104

Closed
h465855hgg wants to merge 3 commits into
fankes:masterfrom
h465855hgg:fix/coloros16-icons
Closed

h465855hgg wants to merge 3 commits into
fankes:masterfrom
h465855hgg:fix/coloros16-icons

Conversation

@h465855hgg

Copy link
Copy Markdown

Fixes the notification icon problems on ColorOS 16 (tested on OnePlus PJF110 / ColorOS 16.0.5.701 / Android 16).

Symptoms

  • status bar notification icons render ~25% larger than the system icons
  • some shade icons show the raw monochrome small icon without the MD3 rounded background (e.g. QQ, LSPosed)
  • icons flip between the colored app icon and the plain white small icon

Root causes

  1. ColorOS 16 renamed the app-icon substitution path. OplusNotificationFixHelper in oplus-services.jar now runs fixAppIcon, while the module only intercepts fixSmallIcon (logcat: NotificationService--OplusNotificationFixHelper: fixAppIcon: pkg=...), so the substitution keeps running.

  2. The system resets the icon drawable after we style it. setImageDrawable() is called again on the icon view; for QQ the module drawable was replaced 48 times per minute.

  3. Conversation notifications bypass our hook. Notifications with an avatar (QQ) go through OplusNotificationHeaderViewWrapperExImp.updateIconWithAppIconIfNeeded and never hit proxyOnContentUpdated, so they are never styled.

  4. Status bar icon size. ColorOS SystemUI uses status_bar_icon_size = 20dp (AOSP: 22dp). StatusBarIconView is CENTER_INSIDE, so a bitmap >= the slot gets clamped and ends up ~52.5px (15dp) whether the source is 22dp or 20dp.

Changes

  • FrameworkHooker: also intercept fixAppIcon.
  • SystemUIHooker:
    • scale replaced status bar icons to 0.8 x status_bar_icon_size
    • hook ImageView.setImageDrawable and substitute the module drawable for icon views the module has taken over
    • restyle after updateIconWithAppIconIfNeeded
    • readable glyph color by luminance, plus a badge fallback when the resolved color is transparent

Verification

  • before: fixAppIcon: on every boot, Icon drawable was replaced by system 48x/min for QQ
  • after: both 0; QQ gets a #6BB8F1 rounded background, LSPosed uses its pink notification color, status bar icons match the system size

Notes

  • the 0.8 factor is a tunable constant; on 560dpi the rendered ink is still ~52px, use 0.6 if a smaller icon is preferred
  • ANIP rule sync has to succeed for custom icons; on failure the module falls back to the original small icon

中文摘要:ColorOS 16 把 fixSmallIcon 换成了 fixAppIcon,且会在模块设置图标后再次覆盖;会话通知(QQ)还走 updateIconWithAppIconIfNeeded。这三处都已处理,另外把状态栏图标按 ColorOS 的 20dp 槽位缩放,并修正浅色背景/面板上的 glyph 颜色。

fankes and others added 3 commits October 27, 2026 19:25
ColorOS 16.0.5 ships OplusNotificationFixHelper.fixAppIcon and keeps
replacing notification icons with app icons even though fixSmallIcon is
intercepted. Intercept both.
- normalize replaced status bar icons to the ColorOS 20dp slot (0.8x) so
  they match the system icon size
- enforce the module drawable through ImageView.setImageDrawable when the
  system resets the icon after styling
- restyle conversation notifications after updateIconWithAppIconIfNeeded
- pick readable glyph colors for light badges and light panels
@h465855hgg
h465855hgg marked this pull request as draft October 28, 2026 02:47
@h465855hgg
h465855hgg marked this pull request as ready for review October 28, 2026 02:55
@h465855hgg

Copy link
Copy Markdown
Author
Record_2026-10-28-15-01-44_401ff76492c7d5c4b6e2ac93ffeafc64.mp4

可能出现的问题:

在配置里有很多默认没开启覆盖的软件图标可能 绘制的背景 并不会生效而是取自图标内的颜色

需要手动打开覆盖才行,如视频所示

@h465855hgg

Copy link
Copy Markdown
Author
Record_2026-10-28-15-01-44_401ff76492c7d5c4b6e2ac93ffeafc64.mp4

可能出现的问题:

在配置里有很多默认没开启覆盖的软件图标可能 绘制的背景 并不会生效而是取自图标内的颜色

需要手动打开覆盖才行,如视频所示

这个我也不太确定,哔哩哔哩的话就正常不需要覆盖也能用上,但贴吧就得开这个覆盖,或需可以加个一键启用的功能/多选/全选/ 列表等

@fankes

fankes commented Oct 28, 2026

Copy link
Copy Markdown
Owner

PR 有问题,它暴力重设所有图标,对比了 16/17 的源码,无法复现,目前的 Hook 点都是准确的,唯一怀疑就是,是不是用了别的模块 Hook 了系统界面,这些变化都无法认定于来自于这个模块

建议后续:
CachingIconView 本身就重写了 setImageDrawable,只 hook 这一个类,范围就限定在通知图标的 View 上,不会影响整个系统界面的 ImageView。只对模块处理过的 View 生效,系统设图之后再把模块样式加一遍。本质上还是治标,但影响范围比 PR 小得多。

但是我不会将这个作为主分支合并,可以先自用,后期看有没有其他人存在这个问题,我再继续收集有用的问题信息

@fankes fankes closed this Oct 28, 2026
@h465855hgg

Copy link
Copy Markdown
Author

ok

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants