Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ad7a592 authored by Tyler Freeman's avatar Tyler Freeman
Browse files

feat(force invert): detect the polarity of an app to decide if we should force invert it

Added the ColorArea class to track the app's overall polarity (i.e. dark
or light theme) by counting the areas of backgrounds and their colors.
This is used to determine if we should force invert the app, for
instance if the user prefers dark theme but this app is mainly light.

The idea is that we count the fill colors of any background-type draw
calls: drawRect(), drawColor(), etc. If the area of light fills drawn to
the screen is greater than the area of dark fills drawn to the screen,
we can reasonably guess that the app is light theme, and vice-versa.

Bug: 372558459
Flag: android.view.accessibility.force_invert_color
Test: atest hwui_unit_tests

Change-Id: I524c3f5cde0a65cad4087aeefdec8eb0477a7971
parent e7ba61fd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment