Android 去掉Power键按钮 锁屏界面 休眠时间


一、休眠时间,有的方案可能是在device目录下的补丁修改 比如Amlogic

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

private void loadSystemSettings(SQLiteDatabase db) {
loadIntegerSetting(stmt, Settings.System.SCREEN_OFF_TIMEOUT,
                    R.integer.def_screen_off_timeout);
frameworks/base/packages/SettingsProvider/res/values/defaults.xml
-1

以毫秒为单位,设为-1即可,重新编译Setting Provider模块
但是只是这样修改的话,启动后依旧会进入锁屏状态,解锁之后就再也不会锁屏了

二、开机不锁屏
frameworks/base/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
    /**
     * External apps (like the phone app) can tell us to disable the keygaurd.
     */
    private boolean mExternallyEnabled = true;
改为false
$ source build/envsetup.sh
$ mmm frameworks/base/policy/
Install: out/target/product/generic/data/app/FrameworkPolicyTests.apk
为了打开锁屏功能,可调用函数setKeyguardEnabled()

三、Power键按钮

frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

3870行,注释掉这个case;

 case KeyEvent.KEYCODE_POWER: {
            /*
                result &= ~ACTION_PASS_TO_USER;
                if (down) {
                    if (isScreenOn && !mPowerKeyTriggered
                            && (event.getFlags() & KeyEvent.FLAG_FALLBACK) == 0) {
                        ..
                }
               */
                break;

}

你可能感兴趣的:(Android 去掉Power键按钮 锁屏界面 休眠时间)