summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Edward Savage-Jones <edward.savage-jones@sony.com> 2018-11-14 22:19:28 +0100
committer Alison Cichowlas <asc@google.com> 2019-04-09 18:12:09 -0400
commit8f5c95bc17574fb7abf424db94330fb2b27e3310 (patch)
treeeb57e1e1bb7001d047747d4f15e45956b5cbf07a
parentdd07ae579c291a2b6ffe09bd576fd908eb9e5ddd (diff)
Add a longpress timeout config for screenshot chord
The global actions longpress timeout is currently used for the screenshot chord. This means that increasing the globalactions longpress timeout would also increase the time for triggering a screenshot. This adds a configuration item specifically for the screenshot chord. Bug: 119989329 Test: manual - increase the globalactions timeout and check that the screenshot chord is not affected. Change-Id: I6bd8416f7546aa1d2da43f37f3e76edac3ed543b
-rw-r--r--core/java/android/view/ViewConfiguration.java23
-rw-r--r--core/res/res/values/config.xml7
-rw-r--r--core/res/res/values/symbols.xml1
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java4
4 files changed, 32 insertions, 3 deletions
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index 81e9c1372aed..9e914d4e7d41 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -87,6 +87,12 @@ public class ViewConfiguration {
/**
* 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
*/
private static final int A11Y_SHORTCUT_KEY_TIMEOUT = 3000;
@@ -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);
}
/**
@@ -890,6 +901,18 @@ public class ViewConfiguration {
}
/**
+ * 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.
*
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 21f5acb6f620..860397a802fc 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2394,9 +2394,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>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index fb7be777098c..213ef71ccebb 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2227,6 +2227,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" />
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 0e0fc120dbfd..f236a5814a2a 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -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() {