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);
}文章来源地址https://www.toymoban.com/news/detail-814951.html
文章来源:https://www.toymoban.com/news/detail-814951.html
到了这里,关于AndroidQ修改永不休眠never的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!