设置-显示-屏保-启用时机-去除插入基座相关(不支持该功能的话)
- 1-项目场景:
- 2-问题描述
- 3-解决方案:
- 4-代码修改前后效果对比图:
- 代码修改前:
- 代码修改后:
1-项目场景:
展锐平台
2-问题描述
选择“插入基座”时暂无法触发屏保
步骤:设置-显示-屏保-启用时机-插入基座
选择“插入基座”时暂无法触发屏保
该版本不支持该功能
3-解决方案:
去除基座相关:
- 定义宏(/device/common/common.mk)
+ ifeq ($(strip $(AGN_WHEN_TO_START_SCREENSAVER)),yes)
+ PRODUCT_VENDOR_PROPERTIES +=odm.agn.when_to_start_screensaver = true
+ endif
- 开宏(/device/sprd/qogirn6pro/…/…/…/BoardConfigAP.mk)
+ AGN_WHEN_TO_START_SCREENSAVER = yes
3.( /packages/apps/Settings)
- 定义两个字符串数组,这些字符串数组可以用于创建下拉列表,以便用户可以选择在何时启动屏幕保护程序。(res/values/arrays.xml)
+ <string-array name="when_to_start_screenSaver_entries" translatable="false">
+ <item>@string/screensaver_settings_summary_sleep</item>
+ <item>@string/screensaver_settings_summary_never</item>
+ </string-array>+ <string-array name="when_to_start_screenSaver_values" translatable="false">
+ <item>while_charging_only</item>
+ <item>never</item>
+ </string-array>
- 根据 WHEN_TO_START_SCREENSAVER 变量的值来选择要返回的字符串数组(也就是上一步定义的字符串数组)(src/com/android/settings/dream/WhenToDreamPicker.java)
package com.android.settings.dream;+import android.os.SystemProperties;public class WhenToDreamPicker extends RadioButtonPickerFragment {private static final String TAG = "WhenToDreamPicker";
+ private static final boolean WHEN_TO_START_SCREENSAVER = SystemProperties.getBoolean("odm.agn.when_to_start_screensaver", false);+ //Add by Huangshiqi for BUG #78448 beginprivate String[] entries() {
+ if(WHEN_TO_START_SCREENSAVER){
+ return getResources().getStringArray(R.array.when_to_start_screenSaver_entries);
+ }return getResources().getStringArray(R.array.when_to_start_screensaver_entries);}private String[] keys() {
+ if(WHEN_TO_START_SCREENSAVER){
+ return getResources().getStringArray(R.array.when_to_start_screenSaver_values);
+ }return getResources().getStringArray(R.array.when_to_start_screensaver_values);}
- 首次进入屏保时,启用时机下方小字也去除基座相关内容(src/com/android/settings/dream/DreamSetting.java)
static int getDreamSettingDescriptionResId(@WhenToDream int dreamSetting) {switch (dreamSetting) {case WHILE_CHARGING:return R.string.screensaver_settings_summary_sleep;
- case WHILE_DOCKED:
- return R.string.screensaver_settings_summary_dock;
- case EITHER:
- return R.string.screensaver_settings_summary_either_long;case NEVER:default:return R.string.screensaver_settings_summary_never;}