【Android】安卓开机禁止锁屏,禁止屏幕休眠

1.Settings 删掉开机锁屏界面

packages/apps/Settings/res/xml/display_settings.xml

 

注释掉这个ListPreference

 

packages/apps/Settings/src/com/android/settings/DisplaySettings.java
添加if条件,如果没有找到这个preference就不执行相关操作;具体可以参考被隐藏的 night_mode

  1. mScreenTimeoutPreference = (ListPreference) findPreference(KEY_SCREEN_TIMEOUT);

  2. if (mScreenTimeoutPreference !=null ) {

  3. final long currentTimeout = Settings.System.getLong(resolver, SCREEN_OFF_TIMEOUT,

  4. FALLBACK_SCREEN_TIMEOUT_VALUE);

  5. mScreenTimeoutPreference.setValue(String.valueOf(currentTimeout));

  6. mScreenTimeoutPreference.setOnPreferenceChangeListener(this);

  7. disableUnusableTimeouts(mScreenTimeoutPreference);

  8. updateTimeoutPreferenceDescription(currentTimeout);

2. 此处设置锁屏以及时间:
frameworks/base/packages/SettingsProvider/res/values/defaults.xml

vendor/mediatek/proprietary/packages/apps/SettingsProvider/res/values/defaults.xml

false 改为 true;即默认禁止锁屏

6000 6000改成2147483647,即默认永不灭屏

 

以下是 adb 设置方法

adb shell settings put system screen_off_timeout 2147483647

adb shell settings put system def_lockscreen_disabled true

 

 

 

 

 

你可能感兴趣的:(Android)