0

I am looking to be able to modify developer option settings in my app, I have tried looking in the Settings.Global, Settings.System and Settings.Secure but none cover the specific toggle I'm after, which is "Simulate color space".

Would anyone be able to point me in the right direction in trying to locate this setting provider?

double-beep
  • 5,031
  • 17
  • 33
  • 41
Zintom
  • 184
  • 2
  • 12

1 Answers1

4

Great news!, I have solved this now! (Requires ROOT or ADB)

Please note, to successfully modify secure settings you must grant your app permission to android.permission.WRITE_SECURE_SETTINGS otherwise it will crash; you can do this in two ways, either from the ADB Shell: "pm grant your.package.name android.permission.WRITE_SECURE_SETTINGS" or by requesting root privileges and executing it within your app as SU.

Use the following lines to enable the Monochrome setting:

Settings.Secure.putString(this.getContentResolver(), "accessibility_display_daltonizer_enabled", "1");
Settings.Secure.putString(this.getContentResolver(), "accessibility_display_daltonizer", "0");

and to disable:

Settings.Secure.putString(this.getContentResolver(), "accessibility_display_daltonizer_enabled", "0");
Settings.Secure.putString(this.getContentResolver(), "accessibility_display_daltonizer", "-1");

I located these string constants in the Settings.Secure class and you will be able to find other developer settings and modify them to your fancy.

Below are the values for the other screen-space modes:

DISABLED = -1
MONOCHROMACY = 0
PROTANOMALY = 11
CORRECT_DEUTERANOMALY = 12
TRITANOMALY= 13

Enjoy!

Zintom
  • 184
  • 2
  • 12