Disable 3-button-nav buttons during back button hold
Bug: 373544911 Test: TaskbarNavButtonControllerTest Test: Manual, i.e. verify that pressing buttons in 3-button-nav while the back button is pressed does not have any effect Flag: com.android.window.flags.predictive_back_three_button_nav Change-Id: I5abad5f2f74d09c790380a2eeb27aff3b780b925
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import static android.view.KeyEvent.ACTION_UP;
|
||||
import static android.view.View.AccessibilityDelegate;
|
||||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION;
|
||||
@@ -72,7 +73,6 @@ import android.graphics.drawable.PaintDrawable;
|
||||
import android.graphics.drawable.RotateDrawable;
|
||||
import android.inputmethodservice.InputMethodService;
|
||||
import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Property;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
@@ -862,17 +862,12 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
TaskbarNavButtonController navButtonController) {
|
||||
buttonView.setOnTouchListener((v, event) -> {
|
||||
if (event.getAction() == MotionEvent.ACTION_MOVE) return false;
|
||||
long time = SystemClock.uptimeMillis();
|
||||
int action = event.getAction();
|
||||
KeyEvent keyEvent = new KeyEvent(time, time,
|
||||
action == MotionEvent.ACTION_DOWN ? KeyEvent.ACTION_DOWN : KeyEvent.ACTION_UP,
|
||||
KeyEvent.KEYCODE_BACK, 0);
|
||||
if (event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||
keyEvent.cancel();
|
||||
}
|
||||
navButtonController.executeBack(keyEvent);
|
||||
|
||||
if (action == MotionEvent.ACTION_UP) {
|
||||
int motionEventAction = event.getAction();
|
||||
int keyEventAction = motionEventAction == MotionEvent.ACTION_DOWN
|
||||
? KeyEvent.ACTION_DOWN : ACTION_UP;
|
||||
boolean isCancelled = event.getAction() == MotionEvent.ACTION_CANCEL;
|
||||
navButtonController.sendBackKeyEvent(keyEventAction, isCancelled);
|
||||
if (motionEventAction == MotionEvent.ACTION_UP) {
|
||||
buttonView.performClick();
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user