am 168d0ade: am 1e53b98c: Merge "Allow press and hold from non-interactive." into lmp-mr1-modular-dev
* commit '168d0ade0cb5a733c83d7dcfdf0a0efa3250cb16':
Allow press and hold from non-interactive.
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index a383359..519cf3d 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -515,6 +515,8 @@
<bool name="config_allowTheaterModeWakeFromWindowLayout">false</bool>
<!-- If this is true, go to sleep when theater mode is enabled from button press -->
<bool name="config_goToSleepOnButtonPressTheaterMode">true</bool>
+ <!-- If this is true, long press on power button will be available from the non-interactive state -->
+ <bool name="config_supportLongPressPowerWhenNonInteractive">false</bool>
<!-- Auto-rotation behavior -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index b204a0b..d13c411 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1603,6 +1603,7 @@
<java-symbol type="bool" name="config_allowTheaterModeWakeFromDock" />
<java-symbol type="bool" name="config_allowTheaterModeWakeFromWindowLayout" />
<java-symbol type="bool" name="config_goToSleepOnButtonPressTheaterMode" />
+ <java-symbol type="bool" name="config_supportLongPressPowerWhenNonInteractive" />
<java-symbol type="bool" name="config_wifi_background_scan_support" />
<java-symbol type="bool" name="config_wifi_dual_band_support" />
<java-symbol type="bool" name="config_wimaxEnabled" />
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 1e64017..62e7af4 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -539,6 +539,9 @@
private boolean mAllowTheaterModeWakeFromLidSwitch;
private boolean mAllowTheaterModeWakeFromWakeGesture;
+ // Whether to support long press from power button in non-interactive mode
+ private boolean mSupportLongPressPowerWhenNonInteractive;
+
// Whether to go to sleep entering theater mode from power button
private boolean mGoToSleepOnButtonPressTheaterMode;
@@ -885,12 +888,21 @@
}
} else {
wakeUpFromPowerKey(event.getDownTime());
- final int maxCount = getMaxMultiPressPowerCount();
- if (maxCount <= 1) {
- mPowerKeyHandled = true;
- } else {
+ if (mSupportLongPressPowerWhenNonInteractive && hasLongPressOnPowerBehavior()) {
+ Message msg = mHandler.obtainMessage(MSG_POWER_LONG_PRESS);
+ msg.setAsynchronous(true);
+ mHandler.sendMessageDelayed(msg,
+ ViewConfiguration.get(mContext).getDeviceGlobalActionKeyTimeout());
mBeganFromNonInteractive = true;
+ } else {
+ final int maxCount = getMaxMultiPressPowerCount();
+
+ if (maxCount <= 1) {
+ mPowerKeyHandled = true;
+ } else {
+ mBeganFromNonInteractive = true;
+ }
}
}
}
@@ -1259,6 +1271,9 @@
mGoToSleepOnButtonPressTheaterMode = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_goToSleepOnButtonPressTheaterMode);
+ mSupportLongPressPowerWhenNonInteractive = mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_supportLongPressPowerWhenNonInteractive);
+
mShortPressOnPowerBehavior = mContext.getResources().getInteger(
com.android.internal.R.integer.config_shortPressOnPowerBehavior);
mLongPressOnPowerBehavior = mContext.getResources().getInteger(