【问题标题】:Programmatically change Simulate Color Space and other developer options in Android (Solved)以编程方式更改 Android 中的模拟色彩空间和其他开发人员选项(已解决)
【发布时间】:2020-04-03 12:55:55
【问题描述】:

我希望能够在我的应用程序中修改开发人员选项设置,我尝试查看 Settings.Global、Settings.System 和 Settings.Secure,但没有一个涵盖我所追求的特定切换,即“模拟色彩空间”。

在尝试找到此设置提供程序时,谁能指出我正确的方向?

【问题讨论】:

    标签: java android


    【解决方案1】:

    好消息!我现在解决了这个问题! (需要ROOT ADB

    请注意,要成功修改安全设置,您必须将您的应用权限授予android.permission.WRITE_SECURE_SETTINGS,否则会崩溃;您可以通过两种方式执行此操作,或者从 ADB Shell:“pm grant your.package.name android.permission.WRITE_SECURE_SETTINGS”或通过请求 root 权限并在您的应用程序中作为 SU 执行。

    使用以下行启用单色设置:

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

    并禁用:

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

    我在 Settings.Secure 类中找到了这些字符串常量,您将能够找到其他开发人员设置并根据您的喜好进行修改。

    以下是其他屏幕空间模式的值:

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

    享受吧!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-31
      • 2014-02-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-02
      • 2011-10-31
      相关资源
      最近更新 更多