mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 09:56:49 +00:00
Don't cancel or commit predictive back on multi touch in 3-button-nav
Bug: 381054861 Test: Manual, i.e. verify that tapping the taskbar while predictive back is in progress does not cancel or commit it Flag: com.android.window.flags.predictive_back_three_button_nav Change-Id: I4117aca74216849519a0cabcbd3cb14f7fc5b38f
This commit is contained in:
@@ -866,13 +866,19 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
TaskbarNavButtonController navButtonController) {
|
||||
final RectF rect = new RectF();
|
||||
buttonView.setOnTouchListener((v, event) -> {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
int motionEventAction = event.getAction();
|
||||
if (motionEventAction == MotionEvent.ACTION_DOWN) {
|
||||
rect.set(0, 0, v.getWidth(), v.getHeight());
|
||||
}
|
||||
boolean isCancelled = event.getAction() == MotionEvent.ACTION_CANCEL
|
||||
|| !rect.contains(event.getX(), event.getY());
|
||||
if (event.getAction() == MotionEvent.ACTION_MOVE && !isCancelled) return false;
|
||||
int motionEventAction = event.getAction();
|
||||
boolean isCancelled = motionEventAction == MotionEvent.ACTION_CANCEL
|
||||
|| (!rect.contains(event.getX(), event.getY())
|
||||
&& (motionEventAction == MotionEvent.ACTION_MOVE
|
||||
|| motionEventAction == MotionEvent.ACTION_UP));
|
||||
if (motionEventAction != MotionEvent.ACTION_DOWN
|
||||
&& motionEventAction != MotionEvent.ACTION_UP && !isCancelled) {
|
||||
// return early. we don't care about any other cases than DOWN, UP and CANCEL
|
||||
return false;
|
||||
}
|
||||
int keyEventAction = motionEventAction == MotionEvent.ACTION_DOWN
|
||||
? KeyEvent.ACTION_DOWN : ACTION_UP;
|
||||
navButtonController.sendBackKeyEvent(keyEventAction, isCancelled);
|
||||
|
||||
Reference in New Issue
Block a user