Merge "Close the KQS view when touching the gesture nav region" into 24D1-dev

This commit is contained in:
Lynn Yeh
2024-04-15 14:36:52 +00:00
committed by Android (Google) Code Review
5 changed files with 45 additions and 23 deletions

View File

@@ -193,10 +193,14 @@ public final class KeyboardQuickSwitchController implements
}
void closeQuickSwitchView() {
closeQuickSwitchView(true);
}
void closeQuickSwitchView(boolean animate) {
if (mQuickSwitchViewController == null) {
return;
}
mQuickSwitchViewController.closeQuickSwitchView(true);
mQuickSwitchViewController.closeQuickSwitchView(animate);
}
/**

View File

@@ -1567,4 +1567,9 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
public float getStashedTaskbarScale() {
return mControllers.stashedHandleViewController.getStashedHandleHintScale().value;
}
/** Closes the KeyboardQuickSwitchView without an animation if open. */
public void closeKeyboardQuickSwitchView() {
mControllers.keyboardQuickSwitchController.closeQuickSwitchView(false);
}
}

View File

@@ -248,7 +248,15 @@ public class OverviewCommandHelper {
case TYPE_SHOW:
// already visible
return true;
case TYPE_KEYBOARD_INPUT: {
if (visibleRecentsView.isHandlingTouch()) {
return true;
}
}
case TYPE_HIDE: {
if (visibleRecentsView.isHandlingTouch()) {
return true;
}
mKeyboardTaskFocusIndex = INVALID_PAGE;
int currentPage = visibleRecentsView.getNextPage();
TaskView tv = (currentPage >= 0

View File

@@ -754,6 +754,10 @@ public class TouchInteractionService extends Service {
boolean isOneHandedModeActive = mDeviceState.isOneHandedModeActive();
boolean isInSwipeUpTouchRegion = mRotationTouchHelper.isInSwipeUpTouchRegion(event);
TaskbarActivityContext tac = mTaskbarManager.getCurrentActivityContext();
if (isInSwipeUpTouchRegion && tac != null) {
tac.closeKeyboardQuickSwitchView();
}
if ((!isOneHandedModeActive && isInSwipeUpTouchRegion)
|| isHoverActionWithoutConsumer) {
reasonString.append(!isOneHandedModeActive && isInSwipeUpTouchRegion

View File

@@ -4237,30 +4237,31 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_TAB:
return snapToPageRelative(event.isShiftPressed() ? -1 : 1, true /* cycle */,
DIRECTION_TAB);
case KeyEvent.KEYCODE_DPAD_RIGHT:
return snapToPageRelative(mIsRtl ? -1 : 1, true /* cycle */, DIRECTION_RIGHT);
case KeyEvent.KEYCODE_DPAD_LEFT:
return snapToPageRelative(mIsRtl ? 1 : -1, true /* cycle */, DIRECTION_LEFT);
case KeyEvent.KEYCODE_DPAD_UP:
return snapToPageRelative(1, false /* cycle */, DIRECTION_UP);
case KeyEvent.KEYCODE_DPAD_DOWN:
return snapToPageRelative(1, false /* cycle */, DIRECTION_DOWN);
case KeyEvent.KEYCODE_DEL:
case KeyEvent.KEYCODE_FORWARD_DEL:
if (isHandlingTouch() || event.getAction() != KeyEvent.ACTION_DOWN) {
return super.dispatchKeyEvent(event);
}
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_TAB:
return snapToPageRelative(event.isShiftPressed() ? -1 : 1, true /* cycle */,
DIRECTION_TAB);
case KeyEvent.KEYCODE_DPAD_RIGHT:
return snapToPageRelative(mIsRtl ? -1 : 1, true /* cycle */, DIRECTION_RIGHT);
case KeyEvent.KEYCODE_DPAD_LEFT:
return snapToPageRelative(mIsRtl ? 1 : -1, true /* cycle */, DIRECTION_LEFT);
case KeyEvent.KEYCODE_DPAD_UP:
return snapToPageRelative(1, false /* cycle */, DIRECTION_UP);
case KeyEvent.KEYCODE_DPAD_DOWN:
return snapToPageRelative(1, false /* cycle */, DIRECTION_DOWN);
case KeyEvent.KEYCODE_DEL:
case KeyEvent.KEYCODE_FORWARD_DEL:
dismissCurrentTask();
return true;
case KeyEvent.KEYCODE_NUMPAD_DOT:
if (event.isAltPressed()) {
// Numpad DEL pressed while holding Alt.
dismissCurrentTask();
return true;
case KeyEvent.KEYCODE_NUMPAD_DOT:
if (event.isAltPressed()) {
// Numpad DEL pressed while holding Alt.
dismissCurrentTask();
return true;
}
}
}
}
return super.dispatchKeyEvent(event);
}