http://blog.csdn.net/chenyafei617/article/details/6575621
我知道,需要在settings软件里修改。不过,我是想直接利用设置里的对锁屏和休眠的设置的选项,查找源码搞。看了settings源码很久,太多了。估计继续找下去,需要一段时间。正好在卓睿的群里的聊天记录找到这方面的讨论。知道了上面的网址。
然后就搞定了。哈!……
1、 去除休眠
frameworks/base/packages/SettingsProvider/res/values/defaults.xml
里<integer name="def_screen_off_timeout">60000</integer>
60000ms,修改为-1。-1代表0xffffffff,等于永远不要休眠了
2、 去除锁屏
frameworks/policies/base/phone/com/android/internal/policy/impl/KeyguardViewMediator.java
文章里的路径有错误
正确的路径是:
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
将mExternallyEnabled 修改为false
这样就默认,不启动锁屏了。
也可以通过应用层软件去修改,这样在你的软件里,就可以控制是否锁屏了
/** * Same semantics as [email protected] WindowManagerPolicy#enableKeyguard}; provide * a way for external stuff to override normal keyguard behavior. For instance * the phone app disables the keyguard when it receives incoming calls. */ public void setKeyguardEnabled(boolean enabled) { synchronized (this) { if (DEBUG) Log.d(TAG, "setKeyguardEnabled(" + enabled + ")");
mExternallyEnabled = enabled;
if (!enabled && mShowing) { if (mExitSecureCallback != null) { if (DEBUG) Log.d(TAG, "in process of verifyUnlock request, ignoring"); // we're in the process of handling a request to verify the user // can get past the keyguard. ignore extraneous requests to disable / reenable return; }
// hiding keyguard that is showing, remember to reshow later if (DEBUG) Log.d(TAG, "remembering to reshow, hiding keyguard, " + "disabling status bar expansion"); mNeedToReshowWhenReenabled = true; hideLocked(); } else if (enabled && mNeedToReshowWhenReenabled) { ... ... } }
|