1:修改显示列表:
/home/roadwell/Allwinner/SDK/A133/A133_PLUS_AndroidQV1.1NEW/android/packages/apps/Settings/res/values/arrays.xml
--- a/res/values/arrays.xml
+++ b/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,7 @@
<item>600000</item>
<!-- Do not translate. -->
<item>1800000</item>
+ <item>2147483647</item>
</string-array>
2:修改选择判断:
/home/roadwell/Allwinner/SDK/A133/A133_PLUS_AndroidQV1.1NEW/android/packages/apps/Settings/src/com/android/settings/display/TimeoutPreferenceController.java
+++ b/src/com/android/settings/display/TimeoutPreferenceController.java
@@ -85,8 +85,11 @@ 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);
+ //int value = Integer.parseInt((String) newValue);
+ //Settings.System.putInt(mContext.getContentResolver(), SCREEN_OFF_TIMEOUT, value);
+ //add by zyh Nevery sleep
+ long value = Integer.parseInt((String) newValue);
+ Settings.System.putLong(mContext.getContentResolver(), SCREEN_OFF_TIMEOUT, value);
updateTimeoutPreferenceDescription((TimeoutListPreference) preference, value);
} catch (NumberFormatException e) {
Log.e(TAG, "could not persist screen timeout setting", e);
@@ -120,9 +123,15 @@ public class TimeoutPreferenceController extends AbstractPreferenceController im
} else {
final CharSequence timeoutDescription = getTimeoutDescription(
currentTimeout, entries, values);
- summary = timeoutDescription == null
- ? ""
+ //add by zyh Never sleep
+ if(currentTimeout == 2147483647){
+ summary = timeoutDescription.toString();
+ }else{
+ summary = timeoutDescription == null
+ ? ""
: mContext.getString(R.string.screen_timeout_summary, timeoutDescription);
+ }
+
}
preference.setSummary(summary);
}
AndroidQ修改永不休眠never
于 2024-01-12 17:13:49 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)