Skip to content

Commit e45c4e4

Browse files
Winson ChungAndroid (Google) Code Review
authored andcommitted
Merge "Increasing timeout for screenshot chord in keyguard. (Bug 6941775)" into jb-mr1-dev
2 parents af3cd21 + 1cea2f3 commit e45c4e4

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)