Merge "Disable 3-button-nav buttons during back button hold" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
8f8d29888a
@@ -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;
|
||||
@@ -864,17 +864,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