packages/apps/Settings/res/values-zh-rCN/arrays.xml

@@ -37,6 +37,7 @@
     <item msgid="2693197579676214668">"5 分钟"</item>
     <item msgid="1955784331962974678">"10 分钟"</item>
     <item msgid="5578717731965793584">"30 分钟"</item>
+    <item msgid="1781492122915870416">"永不休眠"</item>
   </string-array>
   <string-array name="dream_timeout_entries">
     <item msgid="1999412608953538363">"永不"</item>

packages/apps/Settings/res/values/arrays.xml

@@ -48,6 +48,7 @@
         <item>5 minutes</item>
         <item>10 minutes</item>
         <item>30 minutes</item>
+        <item>Never</item>
     </string-array>

     <!-- Do not translate. -->
@@ -66,6 +67,8 @@
         <item>600000</item>
         <!-- Do not translate. -->
         <item>1800000</item>
+        <!-- Do not translate. -->
+        <item>2147483647</item>
     </string-array>

     <!-- Display settings.  The delay in inactivity before the dream is shown. These are shown in a list dialog. -->

packages/apps/Settings/src/com/android/settings/display/TimeoutPreferenceController.java

@@ -85,8 +85,10 @@ public class TimeoutPreferenceController extends AbstractPreferenceController im
     @Override
     public boolean onPreferenceChange(Preference preference, Object newValue) {
         try {
-            int value = Integer.parseInt((String) newValue);
-            Settings.System.putInt(mContext.getContentResolver(), SCREEN_OFF_TIMEOUT, value);
+            //+Begin mantis-66494 Modified for never goto sleep by james.zheng 2020-12-24
+            long value = Integer.parseInt((String) newValue);
+            Settings.System.putLong(mContext.getContentResolver(), SCREEN_OFF_TIMEOUT, value);
+            //-End mantis-66494 Modified for never goto sleep by james.zheng 2020-12-24
             updateTimeoutPreferenceDescription((TimeoutListPreference) preference, value);
         } catch (NumberFormatException e) {
             Log.e(TAG, "could not persist screen timeout setting", e);
@@ -120,9 +122,15 @@ public class TimeoutPreferenceController extends AbstractPreferenceController im
         } else {
             final CharSequence timeoutDescription = getTimeoutDescription(
                     currentTimeout, entries, values);
+            //+Begin mantis-66494 Modified for never goto sleep by james.zheng 2020-12-24
+            if(currentTimeout == 2147483647){
+                summary = timeoutDescription.toString();
+            } else {
+            //-End mantis-66494 Modified for never goto sleep by james.zheng 2020-12-24
             summary = timeoutDescription == null
                     ? ""
                     : mContext.getString(R.string.screen_timeout_summary, timeoutDescription);
+            }
         }
         preference.setSummary(summary);
     }

标签: aosp

添加新评论