@@ -447,6 +447,8 @@ public void onInputEvent(InputEvent event) {
447447 // Screenshot trigger states
448448 // Time to volume and power must be pressed within this interval of each other.
449449 private static final long SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS = 150 ;
450+ // Increase the chord delay when taking a screenshot from the keyguard
451+ private static final float KEYGUARD_SCREENSHOT_CHORD_DELAY_MULTIPLIER = 2.5f ;
450452 private boolean mScreenshotChordEnabled ;
451453 private boolean mVolumeDownKeyTriggered ;
452454 private long mVolumeDownKeyTime ;
@@ -669,12 +671,21 @@ private void interceptScreenshotChord() {
669671 mVolumeDownKeyConsumedByScreenshotChord = true ;
670672 cancelPendingPowerKeyAction ();
671673
672- mHandler .postDelayed (mScreenshotChordLongPress ,
673- ViewConfiguration .getGlobalActionKeyTimeout ());
674+ mHandler .postDelayed (mScreenshotChordLongPress , getScreenshotChordLongPressDelay ());
674675 }
675676 }
676677 }
677678
679+ private long getScreenshotChordLongPressDelay () {
680+ if (mKeyguardMediator .isShowing ()) {
681+ // Double the time it takes to take a screenshot from the keyguard
682+ return (long ) (KEYGUARD_SCREENSHOT_CHORD_DELAY_MULTIPLIER *
683+ ViewConfiguration .getGlobalActionKeyTimeout ());
684+ } else {
685+ return ViewConfiguration .getGlobalActionKeyTimeout ();
686+ }
687+ }
688+
678689 private void cancelPendingScreenshotChordAction () {
679690 mHandler .removeCallbacks (mScreenshotChordLongPress );
680691 }
0 commit comments