Merge "Add a longpress timeout config for screenshot chord" into qt-dev

This commit is contained in:
Alison Cichowlas
2019-04-11 18:33:43 +00:00
committed by Android (Google) Code Review
4 changed files with 32 additions and 3 deletions

View File

@@ -85,6 +85,12 @@ public class ViewConfiguration {
*/
private static final int GLOBAL_ACTIONS_KEY_TIMEOUT = 500;
/**
* Defines the duration in milliseconds a user needs to hold down the
* appropriate buttons (power + volume down) to trigger the screenshot chord.
*/
private static final int SCREENSHOT_CHORD_KEY_TIMEOUT = 500;
/**
* Defines the duration in milliseconds a user needs to hold down the
* appropriate button to bring up the accessibility shortcut for the first time
@@ -316,6 +322,7 @@ public class ViewConfiguration {
private final float mVerticalScrollFactor;
private final float mHorizontalScrollFactor;
private final boolean mShowMenuShortcutsWhenKeyboardPresent;
private final long mScreenshotChordKeyTimeout;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123768915)
private boolean sHasPermanentMenuKey;
@@ -353,6 +360,7 @@ public class ViewConfiguration {
mHorizontalScrollFactor = HORIZONTAL_SCROLL_FACTOR;
mVerticalScrollFactor = VERTICAL_SCROLL_FACTOR;
mShowMenuShortcutsWhenKeyboardPresent = false;
mScreenshotChordKeyTimeout = SCREENSHOT_CHORD_KEY_TIMEOUT;
// Getter throws if mConstructedWithContext is false so doesn't matter what
// this value is.
@@ -457,6 +465,9 @@ public class ViewConfiguration {
mMinScalingSpan = res.getDimensionPixelSize(
com.android.internal.R.dimen.config_minScalingSpan);
mScreenshotChordKeyTimeout = res.getInteger(
com.android.internal.R.integer.config_screenshotChordKeyTimeout);
}
/**
@@ -889,6 +900,18 @@ public class ViewConfiguration {
return mGlobalActionsKeyTimeout;
}
/**
* The amount of time a user needs to press the relevant keys to trigger
* the screenshot chord.
*
* @return how long a user needs to press the relevant keys to trigger
* the screenshot chord.
* @hide
*/
public long getScreenshotChordKeyTimeout() {
return mScreenshotChordKeyTimeout;
}
/**
* The amount of time a user needs to press the relevant keys to activate the accessibility
* shortcut.

View File

@@ -2398,9 +2398,14 @@
<!-- Maximum velocity to initiate a fling, as measured in dips per second. -->
<dimen name="config_viewMaxFlingVelocity">8000dp</dimen>
<!-- Amount of time in ms the user needs to press the relevant key to bring up the global actions dialog -->
<!-- Amount of time in ms the user needs to press the relevant key to bring up the
global actions dialog -->
<integer name="config_globalActionsKeyTimeout">500</integer>
<!-- Amount of time in ms the user needs to press the relevant keys to trigger the
screenshot chord -->
<integer name="config_screenshotChordKeyTimeout">500</integer>
<!-- Default width of a vertical scrollbar and height of a horizontal scrollbar.
Takes effect only if the scrollbar drawables have no intrinsic size. -->
<dimen name="config_scrollbarSize">4dp</dimen>

View File

@@ -2228,6 +2228,7 @@
<java-symbol type="id" name="button_always" />
<java-symbol type="id" name="button_app_settings" />
<java-symbol type="integer" name="config_globalActionsKeyTimeout" />
<java-symbol type="integer" name="config_screenshotChordKeyTimeout" />
<java-symbol type="integer" name="config_maxResolverActivityColumns" />
<java-symbol type="array" name="config_notificationSignalExtractors" />

View File

@@ -1361,9 +1361,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (mKeyguardDelegate.isShowing()) {
// Double the time it takes to take a screenshot from the keyguard
return (long) (KEYGUARD_SCREENSHOT_CHORD_DELAY_MULTIPLIER *
ViewConfiguration.get(mContext).getDeviceGlobalActionKeyTimeout());
ViewConfiguration.get(mContext).getScreenshotChordKeyTimeout());
}
return ViewConfiguration.get(mContext).getDeviceGlobalActionKeyTimeout();
return ViewConfiguration.get(mContext).getScreenshotChordKeyTimeout();
}
private long getRingerToggleChordDelay() {