Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11817c6b authored by Erik Wolsheimer's avatar Erik Wolsheimer Committed by Android (Google) Code Review
Browse files

Merge "Handle KeyEvent.FLAG_LONG_PRESS on power key"

parents 3270ae05 6e029849
Loading
Loading
Loading
Loading
+24 −16
Original line number Diff line number Diff line
@@ -1326,6 +1326,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                // When interactive, we're already awake.
                // Wait for a long press or for the button to be released to decide what to do.
                if (hasLongPressOnPowerBehavior()) {
                    if ((event.getFlags() & KeyEvent.FLAG_LONG_PRESS) != 0) {
                        powerLongPress();
                    } else {
                        Message msg = mHandler.obtainMessage(MSG_POWER_LONG_PRESS);
                        msg.setAsynchronous(true);
                        mHandler.sendMessageDelayed(msg,
@@ -1337,10 +1340,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                            mHandler.sendMessageDelayed(longMsg, mVeryLongPressTimeout);
                        }
                    }
                }
            } else {
                wakeUpFromPowerKey(event.getDownTime());

                if (mSupportLongPressPowerWhenNonInteractive && hasLongPressOnPowerBehavior()) {
                    if ((event.getFlags() & KeyEvent.FLAG_LONG_PRESS) != 0) {
                        powerLongPress();
                    } else {
                        Message msg = mHandler.obtainMessage(MSG_POWER_LONG_PRESS);
                        msg.setAsynchronous(true);
                        mHandler.sendMessageDelayed(msg,
@@ -1351,6 +1358,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                            longMsg.setAsynchronous(true);
                            mHandler.sendMessageDelayed(longMsg, mVeryLongPressTimeout);
                        }
                    }

                    mBeganFromNonInteractive = true;
                } else {