devicePolicyManager.setMaximumTimeToLock(componentName,timeoutMillis); 1. 上述代码中,componentName是组件名称,可以通过以下代码获取: componentName=newComponentName(this,DeviceAdminReceiver.class); 1. timeoutMillis是以毫秒为单位的超时时间。例如,要设置屏幕关闭超时时间为5分钟,我们可以使用以下代码: longtimeoutM...
timeoutListPreference.removeUnusableTimeouts(maxTimeout, admin); } updateTimeoutPreferenceDescription(timeoutListPreference, currentTimeout);//更新屏幕超时休眠时间描述 EnforcedAdmin admin = RestrictedLockUtils.checkIfRestrictionEnforced( mContext, UserManager.DISALLOW_CONFIG_SCREEN_TIMEOUT, UserHandle.myUserId...
// use screen off timeout setting as the timeout for the lockscreen mLockScreenTimeout = Settings.System.getIntForUser(resolver, Settings.System.SCREEN_OFF_TIMEOUT,0, UserHandle.USER_CURRENT); c.postDelayed 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 privatevoidupdateLockScreenTimeo...
其中L上永不休眠时 mLockScreenTimeout是-1,所以这个ScreenLockTimeout子线程不会被执行,也就不会去锁屏。而M上由于mLockScreenTimeout等于0,所以立即锁屏,就会出现一下锁屏的画面。 所以再将此函数修改如下: private void updateLockScreenTimeout() { synchronized (mScreenLockTimeout) { boolean enable = (mAll...
+<integer name="def_screen_off_timeout">0</integer> android/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java private void updateLockScreenTimeout() { synchronized (mScreenLockTimeout) { boolean enable = (mAllowLockscreenWhenOn && mAwake && ...
// 6、nextTimeout的时间:BASE + 30 - 6 = BASE + 24 nextTimeout = mLastUserActivityTime + screenOffTimeout - screenDimDuration; if (now < nextTimeout) { // now在屏幕Dim之前,说明屏幕亮着,设置flag mUserActivitySummary |= USER_ACTIVITY_SCREEN_BRIGHT; ...
ViewConfiguration.get(mContext).getDeviceGlobalActionKeyTimeout()); } } else { //这个方法,可以放在其他按键的down事件中,也可以起到唤醒屏幕的作用 //当然也可以用PowerManager.ACQUIRE_CAUSES_WAKEUP|PowerManager.SCREEN_DIM_WAKE_LOCK 结合亮屏
从 代码中我们可以看出,假如 Settings.System.SCREEN_OFF_TIMEOUT没有初始化的话(系统首次启动,这个字段肯定是没有初 始化的),将会利用资源中的R.integer.def_screen_off_timeout来初始化。我们为了让系统永不锁屏,只需要把资源 R.integer.def_screen_off_timeout设为-1即可。查看文件 ...
// without a screen lock selected, the biometric unlock would be suppressed the first // time they try to use it. // // Note that the biometric unlock will still not show if it is not the selected method. // Calling setAlternateUnlockEnabled(true) simply says don't suppress it if it...
mLockScreenTimeout是settings里设置的屏幕超时时间,mScreenLockTimeout是一个runable,代码如下: Runnable mScreenLockTimeout = new Runnable() { public void run() { synchronized (this) { if (localLOGV) Log.v(TAG, "mScreenLockTimeout activating keyguard"); ...