Android 11 设置菜单增加永不休眠选项

diff --git a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java

--- a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -5202,7 +5202,11 @@ public class PhoneWindowManager extends AbsPhoneWindowManager implements WindowM
                 if (enable) {
                     if (localLOGV) Log.v(TAG, "setting lockscreen timer");
                     mHandler.removeCallbacks(mScreenLockTimeout); // remove any pending requests
-                    mHandler.postDelayed(mScreenLockTimeout, mLockScreenTimeout);
+                    //mod mHandler.postDelayed(mScreenLockTimeout, mLockScreenTimeout);
+                     if (mLockScreenTimeout != 0) {
+                        mHandler.postDelayed(mScreenLockTimeout, mLockScreenTimeout);
+                    }
+                    //end
                 } else {
                     if (localLOGV) Log.v(TAG, "clearing lockscreen timer");
                     mHandler.removeCallbacks(mScreenLockTimeout);
diff --git a/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java b/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java

--- a/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
@@ -2479,7 +2479,7 @@ public final class PowerManagerService extends SystemService
                     nextTimeout = -1;
                 }
 
-                if ((mUserActivitySummary & USER_ACTIVITY_SCREEN_BRIGHT) != 0
+                /* if ((mUserActivitySummary & USER_ACTIVITY_SCREEN_BRIGHT) != 0
                         && (mWakeLockSummary & WAKE_LOCK_STAY_AWAKE) == 0) {
                     nextTimeout = mAttentionDetector.updateUserActivity(nextTimeout,
                             screenDimDuration);
@@ -2491,7 +2491,21 @@ public final class PowerManagerService extends SystemService
 
                 if (mUserActivitySummary != 0 && nextTimeout >= 0) {
                     scheduleUserInactivityTimeout(nextTimeout);
-                }
+                }*/
+                
+                //mod
+                if (mScreenOffTimeoutSetting != 0) {
+                    if ((mUserActivitySummary & USER_ACTIVITY_SCREEN_BRIGHT) != 0
+                            && (mWakeLockSummary & WAKE_LOCK_STAY_AWAKE) == 0) {
+                        nextTimeout = mAttentionDetector.updateUserActivity(nextTimeout,screenDimDuration);
+                    }
+                    if (nextProfileTimeout > 0) {
+                            nextTimeout = Math.min(nextTimeout, nextProfileTimeout);
+                    }
+                    if (mUserActivitySummary != 0 && nextTimeout >= 0) {
+                            scheduleUserInactivityTimeout(nextTimeout);
+                    }
+                 } else {
+                    mUserActivitySummary |= USER_ACTIVITY_SCREEN_BRIGHT;
+                }
+                //end
             } else {
                 mUserActivitySummary = 0;
             }
diff --git a/packages/apps/Settings/res/xml/display_settings.xml b/packages/apps/Settings/res/xml/display_settings.xml

--- a/packages/apps/Settings/res/xml/display_settings.xml
+++ b/packages/apps/Settings/res/xml/display_settings.xml
@@ -74,8 +74,8 @@
         android:key="screen_timeout"
         android:title="@string/screen_timeout"
         android:summary="@string/summary_placeholder"
-        android:entries="@array/screen_timeout_entries"
-        android:entryValues="@array/screen_timeout_values"
+        android:entries="@array/dream_timeout_entries"
+        android:entryValues="@array/dream_timeout_values"
         settings:keywords="@string/keywords_screen_timeout" />
 
     

你可能感兴趣的:(SPRD,Android,R,开发,android,java)