android去掉锁屏界面,android9.0去掉默认的锁屏界面和屏幕超时锁屏

目录

1、 修改SystemUI

2、设置屏幕超时时间为最大值不休眠实现

3、android 命令行settings进行相关设置项的修改

1、 修改SystemUI

将android/frameworks/base/packages/SystemUI/res/values/config.xml

中config_enableKeyguardService修改为false

编译SystemUI.apk

adb push SystemUI.apk /system/priv-app/SystemUI/

patch:

diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml

index 47a6ed3..418fbb3 100644

--- a/packages/SystemUI/res/values/config.xml

+++ b/packages/SystemUI/res/values/config.xml

@@ -220,7 +220,7 @@

2.5

- true

+ false

2、设置屏幕超时时间为最大值不休眠实现

android/frameworks/base/packages/SettingsProvider/res/values/defaults.xml

将def_screen_off_timeout休眠时间修改为最大值,最大值就是永不休眠。

编译SettingsProvider.apk

adb push SettingsProvider.apk /system/priv-app/SettingsProvider/

patch:

diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml

index 5f2496f..06e356a 100644

--- a/packages/SettingsProvider/res/values/defaults.xml

+++ b/packages/SettingsProvider/res/values/defaults.xml

@@ -18,7 +18,7 @@

-->

true

- 60000

+ 2147483647 #####休眠时间修改为最大值,最大值就是永不休眠

-1

false

false

@@ -86,7 +86,7 @@

1000

15000

- false ##### 默认不要锁屏,设置-安全--屏幕锁定 (无)

+ true

false

1

3、android 命令行settings进行相关设置项的修改

frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsService.java

455 public void onHelp() {

456 PrintWriter pw = getOutPrintWriter();

457 dumpHelp(pw, mDumping);

458 }

459

460 static void dumpHelp(PrintWriter pw, boolean dumping) {

461 if (dumping) {

462 pw.println("Settings provider dump options:");

463 pw.println(" [-h] [--proto]");

464 pw.println(" -h: print this help.");

465 pw.println(" --proto: dump as protobuf.");

466 } else {

467 pw.println("Settings provider (settings) commands:");

468 pw.println(" help");

469 pw.println(" Print this help text.");

470 pw.println(" get [--user | current] NAMESPACE KEY");

471 pw.println(" Retrieve the current value of KEY.");

472 pw.println(" put [--user | current] NAMESPACE KEY VALUE [TAG] [default]");

473 pw.println(" Change the contents of KEY to VALUE.");

474 pw.println(" TAG to associate with the setting.");

475 pw.println(" {default} to set as the default, case-insensitive only for global/secure namespace");

476 pw.println(" delete NAMESPACE KEY");

477 pw.println(" Delete the entry for KEY.");

478 pw.println(" reset [--user | current] NAMESPACE {PACKAGE_NAME | RESET_MODE}");

479 pw.println(" Reset the global/secure table for a package with mode.");

480 pw.println(" RESET_MODE is one of {untrusted_defaults, untrusted_clear, trusted_defaults}, case-insensitive");

481 pw.println(" list NAMESPACE");

482 pw.println(" Print all defined keys.");

483 pw.println(" NAMESPACE is one of {system, secure, global}, case-insensitive");

484 }

485 }

选项中的key为什么值,很难从帮助信息中看出,从代码中查看该key值是在android.provider.Settings中定义了。

该命令可以很方便的更改系统设置中的参数(如修改系统默认输入法),给出几个使用该命令的例子:

#获取屏幕休眠时间

C:\Users\Administrator>adb shell settings get system screen_off_timeout

60000

#休眠时间修改为最大值,最大值就是永不休眠。

C:\Users\Administrator>adb shell settings put system screen_off_timeout 2147483647

你可能感兴趣的:(android去掉锁屏界面)