Loading policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +51 −1 Original line number Diff line number Diff line Loading @@ -459,6 +459,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { private boolean mVolumeDownKeyConsumedByScreenshotChord; private boolean mVolumeUpKeyTriggered; private boolean mPowerKeyTriggered; private long mVolumeUpKeyTime; private boolean mVolumeUpKeyConsumedByScreenshotChord; private long mPowerKeyTime; /* The number of steps between min and max brightness */ Loading Loading @@ -707,6 +709,24 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } private void interceptScreenshotLog() { if (mScreenshotChordEnabled && mVolumeUpKeyTriggered && mPowerKeyTriggered && !mVolumeDownKeyTriggered) { final long now = SystemClock.uptimeMillis(); if (now <= mVolumeUpKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS && now <= mPowerKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS) { mVolumeUpKeyConsumedByScreenshotChord = true; cancelPendingScreenshotForLog(); mHandler.postDelayed(mScreenshotForLog, getScreenshotChordLongPressDelay()); } } } private void cancelPendingScreenshotForLog() { mHandler.removeCallbacks(mScreenshotForLog); } private long getScreenshotChordLongPressDelay() { if (mKeyguardDelegate.isShowing()) { // Double the time it takes to take a screenshot from the keyguard Loading Loading @@ -762,6 +782,19 @@ public class PhoneWindowManager implements WindowManagerPolicy { } }; private final Runnable mScreenshotForLog = new Runnable() { public void run() { Intent intent = new Intent(); intent.setAction("android.system.agent"); intent.putExtra("para", "takeLogs"); try { mContext.startService(intent); } catch (Exception e) { Slog.e(TAG, "Exception when start SystemAgent service", e); } } }; void showGlobalActionsDialog() { if (mGlobalActions == null) { mGlobalActions = new GlobalActions(mContext, mWindowManagerFuncs); Loading Loading @@ -2011,6 +2044,20 @@ public class PhoneWindowManager implements WindowManagerPolicy { } return -1; } if (mVolumeUpKeyTriggered && !mPowerKeyTriggered) { final long now = SystemClock.uptimeMillis(); final long timeoutTime = mVolumeUpKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS; if (now < timeoutTime) { return timeoutTime - now; } } if (keyCode == KeyEvent.KEYCODE_VOLUME_UP && mVolumeUpKeyConsumedByScreenshotChord) { if (!down) { mVolumeUpKeyConsumedByScreenshotChord = false; } return -1; } } // First we always handle the home key here, so applications Loading Loading @@ -3916,8 +3963,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (isScreenOn && !mVolumeUpKeyTriggered && (event.getFlags() & KeyEvent.FLAG_FALLBACK) == 0) { mVolumeUpKeyTriggered = true; mVolumeUpKeyTime = event.getDownTime(); mVolumeUpKeyConsumedByScreenshotChord = false; cancelPendingPowerKeyAction(); cancelPendingScreenshotChordAction(); interceptScreenshotLog(); } } else { mVolumeUpKeyTriggered = false; Loading Loading @@ -4009,6 +4058,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mPowerKeyTriggered = true; mPowerKeyTime = event.getDownTime(); interceptScreenshotChord(); interceptScreenshotLog(); if (mButtonLightEnabled) { try { Loading Loading
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +51 −1 Original line number Diff line number Diff line Loading @@ -459,6 +459,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { private boolean mVolumeDownKeyConsumedByScreenshotChord; private boolean mVolumeUpKeyTriggered; private boolean mPowerKeyTriggered; private long mVolumeUpKeyTime; private boolean mVolumeUpKeyConsumedByScreenshotChord; private long mPowerKeyTime; /* The number of steps between min and max brightness */ Loading Loading @@ -707,6 +709,24 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } private void interceptScreenshotLog() { if (mScreenshotChordEnabled && mVolumeUpKeyTriggered && mPowerKeyTriggered && !mVolumeDownKeyTriggered) { final long now = SystemClock.uptimeMillis(); if (now <= mVolumeUpKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS && now <= mPowerKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS) { mVolumeUpKeyConsumedByScreenshotChord = true; cancelPendingScreenshotForLog(); mHandler.postDelayed(mScreenshotForLog, getScreenshotChordLongPressDelay()); } } } private void cancelPendingScreenshotForLog() { mHandler.removeCallbacks(mScreenshotForLog); } private long getScreenshotChordLongPressDelay() { if (mKeyguardDelegate.isShowing()) { // Double the time it takes to take a screenshot from the keyguard Loading Loading @@ -762,6 +782,19 @@ public class PhoneWindowManager implements WindowManagerPolicy { } }; private final Runnable mScreenshotForLog = new Runnable() { public void run() { Intent intent = new Intent(); intent.setAction("android.system.agent"); intent.putExtra("para", "takeLogs"); try { mContext.startService(intent); } catch (Exception e) { Slog.e(TAG, "Exception when start SystemAgent service", e); } } }; void showGlobalActionsDialog() { if (mGlobalActions == null) { mGlobalActions = new GlobalActions(mContext, mWindowManagerFuncs); Loading Loading @@ -2011,6 +2044,20 @@ public class PhoneWindowManager implements WindowManagerPolicy { } return -1; } if (mVolumeUpKeyTriggered && !mPowerKeyTriggered) { final long now = SystemClock.uptimeMillis(); final long timeoutTime = mVolumeUpKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS; if (now < timeoutTime) { return timeoutTime - now; } } if (keyCode == KeyEvent.KEYCODE_VOLUME_UP && mVolumeUpKeyConsumedByScreenshotChord) { if (!down) { mVolumeUpKeyConsumedByScreenshotChord = false; } return -1; } } // First we always handle the home key here, so applications Loading Loading @@ -3916,8 +3963,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (isScreenOn && !mVolumeUpKeyTriggered && (event.getFlags() & KeyEvent.FLAG_FALLBACK) == 0) { mVolumeUpKeyTriggered = true; mVolumeUpKeyTime = event.getDownTime(); mVolumeUpKeyConsumedByScreenshotChord = false; cancelPendingPowerKeyAction(); cancelPendingScreenshotChordAction(); interceptScreenshotLog(); } } else { mVolumeUpKeyTriggered = false; Loading Loading @@ -4009,6 +4058,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mPowerKeyTriggered = true; mPowerKeyTime = event.getDownTime(); interceptScreenshotChord(); interceptScreenshotLog(); if (mButtonLightEnabled) { try { Loading