Starting swipe-to-all-apps outside of areas triggering long-press
I suspect that some tests using TAPL run under pressure (mem or CPU,
created either intentionally or as a result of a leak somewhere)
where test process may generate a pause between DOWN and MOVE events
enough to be recognized as a long tap, which opens a context menu
instead of swiping.
While the clean solution is b/140252325, this is a workaround.
Bug: 144853809
Change-Id: I135eaee608270b7e60bb072cb360632763cbe5c5
diff --git a/src/com/android/launcher3/ResourceUtils.java b/src/com/android/launcher3/ResourceUtils.java
index 73e705b..7f327a5 100644
--- a/src/com/android/launcher3/ResourceUtils.java
+++ b/src/com/android/launcher3/ResourceUtils.java
@@ -29,7 +29,7 @@
return getDimenByName(resName, res, 48);
}
- private static int getDimenByName(String resName, Resources res, int defaultValue) {
+ public static int getDimenByName(String resName, Resources res, int defaultValue) {
final int frameSize;
final int frameSizeResID = res.getIdentifier(resName, "dimen", "android");
if (frameSizeResID != 0) {
@@ -40,6 +40,17 @@
return frameSize;
}
+ public static boolean getBoolByName(String resName, Resources res, boolean defaultValue) {
+ final boolean val;
+ final int resId = res.getIdentifier(resName, "bool", "android");
+ if (resId != 0) {
+ val = res.getBoolean(resId);
+ } else {
+ val = defaultValue;
+ }
+ return val;
+ }
+
public static int pxFromDp(float size, DisplayMetrics metrics) {
return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, size, metrics));
}