frameworks/base/core/res/res/values/config.xml
@@ -907,12 +907,12 @@
<!-- Indicate whether closing the lid causes the lockscreen to appear.
The default is false. -->
- <bool name="config_lidControlsScreenLock">true</bool>
+ <bool name="config_lidControlsScreenLock">false</bool>
<!-- Indicate whether closing the lid causes the device to go to sleep and opening
it causes the device to wake up.
The default is false. -->
- <bool name="config_lidControlsSleep">true</bool>
+ <bool name="config_lidControlsSleep">false</bool>
//主要代码实现
frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
/** {@inheritDoc} */
@Override
public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) {
// lid changed state
final int newLidState = lidOpen ? LID_OPEN : LID_CLOSED;
if (newLidState == mDefaultDisplayPolicy.getLidState()) {
return;
}
mDefaultDisplayPolicy.setLidState(newLidState);
applyLidSwitchState();
updateRotation(true);
if (lidOpen) {
// 亮屏
wakeUp(SystemClock.uptimeMillis(), mAllowTheaterModeWakeFromLidSwitch,
PowerManager.WAKE_REASON_LID, "android.policy:LID");
} else if (getLidBehavior() != LID_BEHAVIOR_SLEEP) {
mPowerManager.userActivity(SystemClock.uptimeMillis(), false);
}
}
private void applyLidSwitchState() {
final int lidState = mDefaultDisplayPolicy.getLidState();
if (mLidControlsDisplayFold && mDisplayFoldController != null) {
mDisplayFoldController.requestDeviceFolded(lidState == LID_CLOSED);
} else if (lidState == LID_CLOSED) {
int lidBehavior = getLidBehavior();
if (isFactoryAppVisiable())
{
lidBehavior = LID_BEHAVIOR_NONE;
}
switch (lidBehavior) {
case LID_BEHAVIOR_LOCK:
mWindowManagerFuncs.lockDeviceNow();
break;
case LID_BEHAVIOR_SLEEP:
// 灭屏
goToSleep(SystemClock.uptimeMillis(),
PowerManager.GO_TO_SLEEP_REASON_LID_SWITCH,
PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE);
break;
case LID_BEHAVIOR_NONE:
// fall through
default:
break;
}
}
synchronized (mLock) {
updateWakeGestureListenerLp();
}
}
android 10 系统源码 配置hall开关或者开盖合盖屏幕亮灭屏控制
最新推荐文章于 2024-09-07 15:57:32 发布