closed. The default is 0. -->
<integer name="config_lidNavigationAccessibility">0</integer>
+ <!-- Indicate whether closing the lid causes the lockscreen to appear.
+ The default is false. -->
+ <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. -->
<java-symbol type="bool" name="config_enableLockScreenRotation" />
<java-symbol type="bool" name="config_enableLockScreenTranslucentDecor" />
<java-symbol type="bool" name="config_enableTranslucentDecor" />
+ <java-symbol type="bool" name="config_lidControlsScreenLock" />
<java-symbol type="bool" name="config_lidControlsSleep" />
<java-symbol type="bool" name="config_reverseDefaultRotation" />
<java-symbol type="bool" name="config_showNavigationBar" />
boolean mDeskDockEnablesAccelerometer;
int mLidKeyboardAccessibility;
int mLidNavigationAccessibility;
+ boolean mLidControlsScreenLock;
boolean mLidControlsSleep;
int mShortPressOnPowerBehavior;
int mLongPressOnPowerBehavior;
com.android.internal.R.integer.config_lidKeyboardAccessibility);
mLidNavigationAccessibility = mContext.getResources().getInteger(
com.android.internal.R.integer.config_lidNavigationAccessibility);
+ mLidControlsScreenLock = mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_lidControlsScreenLock);
mLidControlsSleep = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_lidControlsSleep);
mTranslucentDecorEnabled = mContext.getResources().getBoolean(
mPowerManager.goToSleep(SystemClock.uptimeMillis(),
PowerManager.GO_TO_SLEEP_REASON_LID_SWITCH,
PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE);
+ } else if (mLidState == LID_CLOSED && mLidControlsScreenLock) {
+ mWindowManagerFuncs.lockDeviceNow();
}
synchronized (mLock) {
pw.print(prefix); pw.print("mLidKeyboardAccessibility=");
pw.print(mLidKeyboardAccessibility);
pw.print(" mLidNavigationAccessibility="); pw.print(mLidNavigationAccessibility);
+ pw.print(" mLidControlsScreenLock="); pw.println(mLidControlsScreenLock);
pw.print(" mLidControlsSleep="); pw.println(mLidControlsSleep);
pw.print(prefix);
pw.print("mShortPressOnPowerBehavior="); pw.print(mShortPressOnPowerBehavior);
// Called by window manager policy. Not exposed externally.
@Override
+ public void lockDeviceNow() {
+ lockNow(null);
+ }
+
+ // Called by window manager policy. Not exposed externally.
+ @Override
public int getCameraLensCoverState() {
int sw = mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY,
InputManagerService.SW_CAMERA_LENS_COVER);