Implementation of the function of turning on and off the black and white mode theme in Android 10.0 system

1 Overview

In the ROM system development and customization of 10.0, in the drop-down status bar of the system SystemUI, the product development functional requirements require adding the black and white mode function switch function, that is, turning on the black and white mode, the system color will become black and white, turning off the black and white mode
switch The system will turn into color mode, so you need to understand how the system sets the black and white mode and color mode, and then add it to the function switch of the drop-down status bar of systemui. Next, first check how the system implements the black and white mode function
. Then implement the function

The effect picture is as follows:

2. The core class that enables the system to turn on and off the black and white mode theme function

     frameworks/base/packages/SettingsLib/res/values/arrays.xml
     packages/apps/Settings/res/xml/development_settings.xml
     packages/apps/Settings/src/com/android/settings/development/SimulateColorSpacePreferenceController.java

3. Analysis and implementation of the core functions of the system to enable and disable the black and white mode theme function

After reading the system source code of 10.0, I found that in the system developer mode, you can select the simulated color space drop-down selection box to enter the black and white mode by selecting the full color blind system, and then select Stop to enter the color mode,
so Let's take a look at this code, and then implement the black and white mode function of the system. Next, let's analyze
the relevant layout of the system developer mode to implement the function.

3.1 Related information about simulated color space in development_settings.xml

Guess you like

Origin blog.csdn.net/baidu_41666295/article/details/132997322