天天看点

Android隐藏系统设置中“模拟颜色空间”选项

Android系统rom开发过程中,由于项目需求,需隐藏(屏蔽)设置中“模拟颜色空间”条目,采用的暴力隐藏方式解决,大体思路是找到对应布局文件,将对应布局删除,并将源码中调用位置代码删除,具体如下:

1、apps/Settings/res/xml/development_prefs.xml中

<!--<ListPreference
                android:entries="@array/simulate_color_space_entries"
                android:entryValues="@array/simulate_color_space_values"
                android:key="simulate_color_space"
                android:persistent="false"
                android:summary="%s"
                android:title="@string/simulate_color_space" />-->
           

2、apps/Settings/src/com/android/settings/DevelopmentSettings.java中需要屏蔽的代码如下

//private static final String SIMULATE_COLOR_SPACE = "simulate_color_space";

onCreate方法

//mSimulateColorSpace = addListPreference(SIMULATE_COLOR_SPACE);

updateAllOptions方法

//updateSimulateColorSpace();

resetDangerousOptions方法

  // Only poke the color space setting if we control it.

onPreferenceChange方法

由于当时项目催的紧,就直接用了这种方式,个人不推荐这种方式,采用removePreference()会更为优雅

Android隐藏系统设置中“模拟颜色空间”选项