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 to the maximum allowed icon size
  2. Map the icon pixel position to a two-dimensional coordinate system and calculate the geometric center
  3. (For MIUI) Detect transparent borders and trim icons
  4. (For MIUI and HyperOS) Determine if the icon has a marketing banner and replace it with a perfect icon (Need to install it yourself)
  5. (For HyperOS) Determine if the icon is a weather icon, and replace it with an MAML icon with real-time temperature (there is a race on HyperOS, which shows that the temperature area is blank, which is a system bug)
  6. Calculate the average lumens, excluding transparent pixels
  7. Quantify the most common color of edge pixels
  8. Calculate the Euclidean distance between the color of the edge pixel and the most common color obtained above in the Lab color space to determine whether the icon has a border
  9. Determine whether the icon background is light or dark
  10. Use K-means quantizer to extract the primary color of the icon
  11. Invert the icon foreground according to the background and remove the border
  12. Determine the actual visible area of ​​the icon and remove the blank area based on the visual center
  13. Final result output, cache icon, and accent color to WeakHashMap

Package

io.github.howard20181.notificationiconfix

Authors

Howard Wu

Releases

1.6.7

Release type: 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.

1.6.6

Release type: Stable

6/3/2025, 6:59:04 AM

Changelog

  • Fix Android 16 compatibility

1.6.5

Release type: 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

1.6.4

Release type: 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

1.6.3

Release type: 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

1.6.2

Release type: 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.

1.6.1

Release type: 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.

1.6

Release type: 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.

1.5

Release type: 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

1.4.1

Release type: Stable

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

Change log

  • Modify the grayscale icon judgment threshold
    image

  • Modify the icon inversion threshold
    image

1.4.1-rc

Release type: 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)

1.4

Release type: 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

1.3

Release type: 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

1.2.1

Release type: 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

1.2

Release type: 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-

1.1

Release type: Stable

1/28/2025, 5:57:07 PM

Change log

  • remove missing debug code

1.0

Release type: Stable

1/28/2025, 4:29:04 PM

Changelog

Initial release