Notification Icon Fix

中文

A module for AOSP, MIUI and HyperOS. Using an algorithm to convert white notification icons into recognizable icons.

Supported System

  • Android 8.1 ~ AOSP main branch
  • HyperOS
  • MIUI 10 and above

Screenshots

Single Notification Multiple notifications with the same icon are automatically grouped
Multiple notification icons are automatically grouped Multiple notification icons are automatically grouped

Algorithm Details

  1. Determine and reduce oversized icons exceeding the maximum allowed size (512×512 dp)
  2. (For MIUI) Detect transparent borders and symmetrically trim icons around the visual center
  3. (For MIUI and HyperOS) Determine if the icon has a marketing banner and replace it with a perfect icon (need to install it yourself)
  4. (For HyperOS) Determine if the icon is a weather icon and replace it with a real-time temperature icon (there is a system bug on HyperOS that causes this to malfunction)
  5. Build a full-image luminance histogram, compute the global Otsu threshold, and count the ratio of light vs. dark opaque pixels
  6. Collect border pixels from the outermost edge ring, and extract the dominant border color using K-means quantization
  7. Calculate the Euclidean distance in Lab color space between each border pixel and the dominant border color to determine whether the icon has a solid single-color border
  8. Sample several points along each of the four sides to compute an alpha-weighted representative color per side (skipping border-colored pixels); detect marketing-banner-style edge splits via a "three-sides-similar, one-outlier" rule with three tiers (strict, relaxed, weak); additionally detect corner badges where one corner color clearly differs from the other three
  9. If a marketing-banner edge split, corner badge, or low-resolution icon is detected, attempt to substitute the icon by extracting the launcher icon from the application
  10. Use CelebiQuantizer (Android 12+) or VariationalKMeansQuantizer to perform K-means quantization and extract the primary theme color of the icon
  11. Apply a circular mask to the icon, unconditionally clearing all pixels outside the inscribed circle to eliminate rounded-corner border regions
  12. Estimate a per-pixel background color by bilinear interpolation of the four side representative colors; separate foreground from background using a dynamically computed squared-distance threshold; fall back to Otsu luminance thresholding if the foreground pixel count degenerates (too few or too many)
  13. Convert foreground pixels to grayscale; if the foreground coverage exceeds 42% of opaque pixels, apply a second Otsu minority-clear pass to remove whichever of the dark or light side is the minority (skipped for gradient-like foregrounds)
  14. Tightly crop transparent edges from the final grayscale foreground pixels and output the minimal bounding rectangle with symmetric padding around the visual center
  15. Cache the result (icon and primary color) keyed by generation ID in a ConcurrentHashMap backed by SoftReferences for memory-efficient reuse

Releases

v1.7.1

Stable

3/22/2026, 4:03:03 PM

变更日志

  1. 重构图标生成算法,现在背景是渐变色的也可以计算轮廓
  2. 支持 API 101

Changelog

  1. Refactored icon generation algorithm; now it can calculate outlines even with gradient backgrounds.
  2. Added support for API 101.

Fix #1,#12,#13

Assets

1

1.6.11

Stable

9/26/2025, 11:45:35 AM

Changelog

Fixed an issue with not working properly on HyperOS 3

更新日志

修复在 HyperOS 3 上不正常工作的问题

Assets

1

1.6.10

Stable

9/9/2025, 4:32:04 PM

Changelog

  1. Fixed the media notification hook for Android R~T. Some car system UIs use an older version of media notifications even on Android T, but I'm probably the only user using this module in my car.
  2. Attempted to improve compatibility with Evolution-X. While keeping compatibility with third-party ROM changes like this tends to be a waste of time, it only requires three lines of code.
  3. Added two pixels to the outer border of the icon.

It's time to rewrite the icon generation algorithm. It's currently based on a "heuristic foreground extraction" algorithm written in Java. In layman's terms, it redraws the icon based on average brightness, but tries to optimize for edges. There are a ton of issues. It's impossible to cram OpenCV into the system module. Should I switch to the Sobel operator? Or implement erosion manually in Java? Anyway, I can't call external packages, so I'll have to write my own magic. My previous plan to use a third-party icon library hasn't been put on the agenda.

变更日志

  1. 为Android R~T修复媒体通知 hook。有些车机的系统界面即使是Android T 也在用低版本的媒体通知,但是车载上用这个模块的用户可能只有我。
  2. 尝试兼容 Evolution-X。虽然不应该浪费时间去兼容这种第三方ROM变更,但是只需要3行代码。
  3. 图标外边界增加2行像素。

生成图标的算法是时候重写了,现在是Java写的“启发式前景提取”,说人话是基于平均亮度的图标重绘,只不过尽量根据边的情况优化,一堆问题。也不可能把OpenCV塞进系统模块里。之后改用索伯算子?或者是手工用Java实现腐蚀?反正不能调用外部包,只能自己写魔法。之前计划的直接用第三方绘制的图标库也没提上日程。

Assets

1

1.6.8

Stable

7/8/2025, 5:22:52 PM

Changelog

  1. Handle null channelId
  2. (Android 13+) Workaround: assume an app with a monochrome launch icon always has a monochrome small icon.
  3. Skip the media control panel hook if the class is not found. For some car head units, the Android Automotive SystemUI may not have a media control panel.

Assets

1

1.6.7

Stable

6/3/2025, 8:45:59 AM

Changelog

  • Fix performance degradation caused by reflection call
    In the previous version, ActivityThread.currentActivityThread().getSystemUiContext() was changed to reflection call, because in Android 16, the return type of getSystemUiContext() was changed from ContextImpl to Context but the method signature was kept the same, which made it impossible to call it in the form of hidden api stub and only reflection was allowed. Since there was no cache for the results, each call to createIcons or updateIcons required a reflection call, which caused a serious degradation in notification display performance.

Assets

1

1.6.5

Stable

6/1/2025, 4:59:01 PM

Change log

  • Adjust the transparency tolerance of the detection icon to trim the icon to more accurately determine whether it is a grayscale icon
    isAbsolutelyAlpha -> isAlpha: Alpha channel tolerance 50 away from full transparency

Assets

1

1.6.4

Stable

5/27/2025, 9:02:22 PM

Changelog

  • Fixed grayscale icon judgment errors for certain icon types that cannot be converted to a bitmap, such as GradientDrawable

Assets

1

1.6.3

Stable

5/13/2025, 10:50:48 AM

Change log

  1. Reduce the transparent area before judging the grayscale icon to fix the grayscale icon judgment error in some cases
  2. Fix the problem that the processed media's small icon is always black
  3. Manually recycle some unused bitmaps instead of waiting for the system UI GC, which may be beneficial to performance, but not obvious
  4. Always replace notification icons with a resolution less than 48 × 48
  5. Fix the grayscale icon size limit calculation error, which was not converted according to the screen pixel density before

Assets

1

1.6.2

Stable

5/9/2025, 3:15:03 AM

ChangeLog

  • Rolling back changes to fix grayscale icon determination
    image

There are no comments in the code. After a few months, I forgot about the bugs I had fixed. An insignificant modification is a building block that falls apart at the first touch.

Assets

1

1.6.1

Stable

5/8/2025, 8:51:28 AM

Change log

  1. (HyperOS & MIUI based on Android 12+) Fix the occasional removal of icon background and padding
  2. (All) Fix the grayscale icon judgment error caused by the target size calculation of square bitmap compression being skipped (stupid mistake +1)
    image

Originally, I planned not to release 1.x updates before the next major version, but there are still many bugs.

Assets

1

1.6

Stable

5/1/2025, 11:22:44 AM

Change log

  1. Processing media notification icons
  2. Support more MIUI versions
    The system UIs that are being adapted are:
fuxi_MIUI14.0.5.0_android14
fuxi_MIUI23.5.6_android14
fuxi_MIUI14.0.31_android13
fuxi_MIUI14.0.23.6.26_android13
cupid_MIUI13.0.21.0_android12
venus_MIUI13.0.4_android12
venus_MIUI12.5.1.0_android12
umi_OS1.0.5_android13
dipper_MIUI12.5.2.0_android10
houji all CN version
cepheus_MIUI12.5.6_android11
cepheus_OS2.0.1.2_android14

If you encounter a bug, please provide the system version number and Android version number to help fix it

  1. Minor bug fixes

The next version will try to add support for third-party notification icon packages. It is safer to release a version before major changes.

Assets

1

1.5

Stable

2/27/2025, 2:40:22 PM

Changelog

  • (Revert) Modify the grayscale icon judgment threshold
  • (HyperOS and MIUI) Grayscale icon judgment does not exempt color icons with transparent areas pushed from MiPush
  • Fix the icon ratio issue when compressing the surrounding transparent area
  • Fix the icon being cut off when compressing the surrounding transparent area

Assets

1

1.4.1

Stable

2/20/2025, 3:31:15 PM

Change log

  • Modify the grayscale icon judgment threshold
    image

  • Modify the icon inversion threshold
    image

Assets

1

1.4.1-rc

Stable

2/19/2025, 11:22:40 AM

Changelog

  • (HyperOS & MIUI) Minor changes to icon color determination
  • (HyperOS) Refresh weather icons more aggressively (race with race)

Assets

1

1.4

Stable

2/3/2025, 8:51:39 AM

Changelog

  • Don't set color for auto-group summary
  • Don't ignore icon check results for auto-group summary

Assets

1

1.3

Stable

1/29/2025, 5:24:40 PM

Changelog

  • Don't assume VectorDrawable is ok, there are many colorful VectorDrawable icons set by the system on HyperOS
    image

Assets

1

1.2.1

Stable

1/29/2025, 9:21:33 AM

Changelog

  • (MIUI and HyperOS) International version supports replacing ad icons with perfect icons

AOSP users can ignore this update

Assets

1

1.2

Stable

1/29/2025, 8:59:49 AM

Changelog

  • Fixed release build trim icon failure (stupid bug)
    image
  • Fixed some resource icon loading failures
  • (MIUI) Skip hook NotificationViewWrapper on R-

Assets

1