Merge "Make min longpress lock icon time configurable" into tm-d1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
828865904c
@@ -580,6 +580,9 @@
|
|||||||
280
|
280
|
||||||
</integer>
|
</integer>
|
||||||
|
|
||||||
|
<!-- The time (in ms) needed to trigger the lock icon view's long-press affordance -->
|
||||||
|
<integer name="config_lockIconLongPress" translatable="false">200</integer>
|
||||||
|
|
||||||
<!-- package name of a built-in camera app to use to restrict implicit intent resolution
|
<!-- package name of a built-in camera app to use to restrict implicit intent resolution
|
||||||
when the double-press power gesture is used. Ignored if empty. -->
|
when the double-press power gesture is used. Ignored if empty. -->
|
||||||
<string translatable="false" name="config_cameraGesturePackage"></string>
|
<string translatable="false" name="config_cameraGesturePackage"></string>
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
|||||||
private static final int sLockIconRadiusPx = (int) (sDefaultDensity * 36);
|
private static final int sLockIconRadiusPx = (int) (sDefaultDensity * 36);
|
||||||
private static final VibrationAttributes TOUCH_VIBRATION_ATTRIBUTES =
|
private static final VibrationAttributes TOUCH_VIBRATION_ATTRIBUTES =
|
||||||
VibrationAttributes.createForUsage(VibrationAttributes.USAGE_TOUCH);
|
VibrationAttributes.createForUsage(VibrationAttributes.USAGE_TOUCH);
|
||||||
private static final long LONG_PRESS_TIMEOUT = 200L; // milliseconds
|
|
||||||
|
|
||||||
|
private final long mLongPressTimeout;
|
||||||
@NonNull private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
@NonNull private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
||||||
@NonNull private final KeyguardViewController mKeyguardViewController;
|
@NonNull private final KeyguardViewController mKeyguardViewController;
|
||||||
@NonNull private final StatusBarStateController mStatusBarStateController;
|
@NonNull private final StatusBarStateController mStatusBarStateController;
|
||||||
@@ -176,6 +176,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
|||||||
mView.setImageDrawable(mIcon);
|
mView.setImageDrawable(mIcon);
|
||||||
mUnlockedLabel = resources.getString(R.string.accessibility_unlock_button);
|
mUnlockedLabel = resources.getString(R.string.accessibility_unlock_button);
|
||||||
mLockedLabel = resources.getString(R.string.accessibility_lock_icon);
|
mLockedLabel = resources.getString(R.string.accessibility_lock_icon);
|
||||||
|
mLongPressTimeout = resources.getInteger(R.integer.config_lockIconLongPress);
|
||||||
dumpManager.registerDumpable(TAG, this);
|
dumpManager.registerDumpable(TAG, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,7 +546,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
|||||||
/**
|
/**
|
||||||
* Handles the touch if it is within the lock icon view and {@link #isActionable()} is true.
|
* Handles the touch if it is within the lock icon view and {@link #isActionable()} is true.
|
||||||
* Subsequently, will trigger {@link #onLongPress()} if a touch is continuously in the lock icon
|
* Subsequently, will trigger {@link #onLongPress()} if a touch is continuously in the lock icon
|
||||||
* area for {@link #LONG_PRESS_TIMEOUT} ms.
|
* area for {@link #mLongPressTimeout} ms.
|
||||||
*
|
*
|
||||||
* Touch speed debouncing mimics logic from the velocity tracker in {@link UdfpsController}.
|
* Touch speed debouncing mimics logic from the velocity tracker in {@link UdfpsController}.
|
||||||
*/
|
*/
|
||||||
@@ -585,7 +586,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
|||||||
|
|
||||||
mDownDetected = true;
|
mDownDetected = true;
|
||||||
mLongPressCancelRunnable = mExecutor.executeDelayed(
|
mLongPressCancelRunnable = mExecutor.executeDelayed(
|
||||||
this::onLongPress, LONG_PRESS_TIMEOUT);
|
this::onLongPress, mLongPressTimeout);
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_MOVE:
|
case MotionEvent.ACTION_MOVE:
|
||||||
case MotionEvent.ACTION_HOVER_MOVE:
|
case MotionEvent.ACTION_HOVER_MOVE:
|
||||||
@@ -600,7 +601,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
|||||||
+ "high pointer velocity=" + velocity);
|
+ "high pointer velocity=" + velocity);
|
||||||
mLongPressCancelRunnable.run();
|
mLongPressCancelRunnable.run();
|
||||||
mLongPressCancelRunnable = mExecutor.executeDelayed(
|
mLongPressCancelRunnable = mExecutor.executeDelayed(
|
||||||
this::onLongPress, LONG_PRESS_TIMEOUT);
|
this::onLongPress, mLongPressTimeout);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
|
|||||||
Reference in New Issue
Block a user