在有的设备中没有永不息屏的选项,客户需要这时就需要自己来添加,是需要将screen_timeout_entries文件给为dream_timeout_entries文件,这些都是系统自带的,替换就可以。另外在PhoneWindowManager和PowerManagerService进行更改。
--- frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java (版本 7704)
+++ frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java (版本 7708)
@@ -4921,7 +4921,11 @@
if (enable) {
if (localLOGV) Log.v(TAG, "setting lockscreen timer");
mHandler.removeCallbacks(mScreenLockTimeout); // remove any pending requests
- mHandler.postDelayed(mScreenLockTimeout, mLockScreenTimeout);
+ //added by wxw start
+ if(mLockScreenTimeout != 0){
+ mHandler.postDelayed(mScreenLockTimeout, mLockScreenTimeout);
+ }
+ //added by wxw end
} else {
if (localLOGV) Log.v(TAG, "clearing lockscreen timer");
mHandler.removeCallbacks(mScreenLockTimeout);
===================================================================
--- frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java (版本 7704)
+++ frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java (版本 7708)
@@ -2598,7 +2598,9 @@
groupUserActivitySummary = USER_ACTIVITY_SCREEN_DREAM;
groupNextTimeout = -1;
}
-
+ //added by wxw start
+
+ if(mScreenOffTimeoutSetting != 0){
if ((groupUserActivitySummary & USER_ACTIVITY_SCREEN_BRIGHT) != 0
&& (mDisplayGroupPowerStateMapper.getWakeLockSummaryLocked(groupId)
& WAKE_LOCK_STAY_AWAKE) == 0) {
@@ -2613,6 +2615,10 @@
} else if (groupNextTimeout != -1) {
nextTimeout = Math.min(nextTimeout, groupNextTimeout);
}
+ }else{
+ groupUserActivitySummary |= USER_ACTIVITY_SCREEN_BRIGHT;
+ }
+ //added by wxw end
}
mDisplayGroupPowerStateMapper.setUserActivitySummaryLocked(groupId,
===================================================================
--- vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/display/ScreenTimeoutPreferenceController.java (版本 7651)
+++ vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/display/ScreenTimeoutPreferenceController.java (版本 7652)
@@ -45,8 +45,8 @@
public ScreenTimeoutPreferenceController(Context context, String key) {
super(context, key);
- mTimeoutEntries = context.getResources().getStringArray(R.array.screen_timeout_entries);
- mTimeoutValues = context.getResources().getStringArray(R.array.screen_timeout_values);
+ mTimeoutEntries = context.getResources().getStringArray(R.array.dream_timeout_entries);
+ mTimeoutValues = context.getResources().getStringArray(R.array.dream_timeout_values);
}
@Override
===================================================================
--- vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/display/ScreenTimeoutSettings.java (版本 7651)
+++ vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/display/ScreenTimeoutSettings.java (版本 7652)
@@ -114,8 +114,8 @@
public void onAttach(Context context) {
super.onAttach(context);
mContext = context;
- mInitialEntries = getResources().getStringArray(R.array.screen_timeout_entries);
- mInitialValues = getResources().getStringArray(R.array.screen_timeout_values);
+ mInitialEntries = getResources().getStringArray(R.array.dream_timeout_entries);
+ mInitialValues = getResources().getStringArray(R.array.dream_timeout_values);
mAdaptiveSleepController = new AdaptiveSleepPreferenceController(context);
mAdaptiveSleepPermissionController = new AdaptiveSleepPermissionPreferenceController(
context);