From 1cea2f3d87266a1d1df5d5f25fec2f026ca43206 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Mon, 8 Oct 2012 20:42:01 -0700 Subject: [PATCH] Increasing timeout for screenshot chord in keyguard. (Bug 6941775) Change-Id: Ie846ce18878f9597e9f0cd97d78322b59042d43c --- .../internal/policy/impl/PhoneWindowManager.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 3351e6157ec56..9307f37b1bfe8 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -447,6 +447,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { // Screenshot trigger states // Time to volume and power must be pressed within this interval of each other. private static final long SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS = 150; + // Increase the chord delay when taking a screenshot from the keyguard + private static final float KEYGUARD_SCREENSHOT_CHORD_DELAY_MULTIPLIER = 2.5f; private boolean mScreenshotChordEnabled; private boolean mVolumeDownKeyTriggered; private long mVolumeDownKeyTime; @@ -669,12 +671,21 @@ public class PhoneWindowManager implements WindowManagerPolicy { mVolumeDownKeyConsumedByScreenshotChord = true; cancelPendingPowerKeyAction(); - mHandler.postDelayed(mScreenshotChordLongPress, - ViewConfiguration.getGlobalActionKeyTimeout()); + mHandler.postDelayed(mScreenshotChordLongPress, getScreenshotChordLongPressDelay()); } } } + private long getScreenshotChordLongPressDelay() { + if (mKeyguardMediator.isShowing()) { + // Double the time it takes to take a screenshot from the keyguard + return (long) (KEYGUARD_SCREENSHOT_CHORD_DELAY_MULTIPLIER * + ViewConfiguration.getGlobalActionKeyTimeout()); + } else { + return ViewConfiguration.getGlobalActionKeyTimeout(); + } + } + private void cancelPendingScreenshotChordAction() { mHandler.removeCallbacks(mScreenshotChordLongPress); }