版本比较

密钥

  • 该行被添加。
  • 该行被删除。
  • 格式已经改变。

Background

Certain applications can only function properly in specific compatibility modes during runtime. Therefore, there is a need to design a universal compatibility settings framework. This framework should be capable of reading user configuration values and determining whether to enable compatibility configuration features. This document serves as a guide for developers on how to develop their own compatibility framework and incorporate new compatibility configuration options.

Steps

1. Adding Configuration

First, add the following configuration to the file "comp_config.xml" located in the directory "openfde/boringdroidsystemui/tree/fde_w/app/main/res/raw/":

代码块
languagexml
<compatible>
    <keycode>isAllowHideDecorCaption</keycode>
    <keydesc>{
        "en":"Allow to hide the title bar",
        "ch":"允许隐藏标题栏"
        }</keydesc>
    <defaultvalue>false</defaultvalue>
    <inputtype>switch</inputtype>
    <notes>
        {
        "en":"test text",
        "ch":"测试文本"
        }
    </notes>
    <optionjson>[]</optionjson>
</compatible>

Field Descriptions:

  • keycode: Compatibility Configuration Key

  • keydesc: Compatibility Description used for display purposes. Requires configuration in both Chinese and English.

  • defaultvalue: Default value

  • inputtype: Currently supports three types: switch, input, and select.

  • notes: Notes to guide users on how to use the configuration. Requires configuration in both Chinese and English.

  • optionjson: If the inputtype is select, the optionjson option needs to be configured.

2. Framework Interface Invocation

Asynchronous Method:

代码块
CompatibleConfig.queryTrainingData(Context context, String packageName, String keycode)

Synchronous Method:

代码块
CompatibleConfig.queryValueData(Context context, String packageName, String keycode)

Parameter Descriptions:

  • context: Context object

  • packageName: Package name

  • keycode: Compatibility Configuration Key