Defer gesture when IME is currently rendering nav buttons
Normally we only defer when touching the nav buttons themselves, but that will be difficult to propagate when IME is hosting the nav buttons. So just defer no matter what if IME is currently showing and rendering the nav buttons, ignoring the touch region.
Test: Enabled "persist.sys.ime.can_render_gestural_nav_buttons", ensure RecentsAnimationDeviceState#isImeRenderingNavButtons() returns true iff IME is showing in gesture nav.
Fixes: 215593010
Change-Id: I265cc042f9e24eb060f090febfbccebd3ba4d3c2
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index 1d4ed4c..0cf9b4c 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -167,7 +167,7 @@
public abstract boolean allowMinimizeSplitScreen();
public boolean deferStartingActivity(RecentsAnimationDeviceState deviceState, MotionEvent ev) {
- return deviceState.isInDeferredGestureRegion(ev);
+ return deviceState.isInDeferredGestureRegion(ev) || deviceState.isImeRenderingNavButtons();
}
/**
diff --git a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java
index 719c2ae..38331a9 100644
--- a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java
@@ -326,7 +326,8 @@
if (uiController == null) {
return super.deferStartingActivity(deviceState, ev);
}
- return uiController.isEventOverAnyTaskbarItem(ev);
+ return uiController.isEventOverAnyTaskbarItem(ev)
+ || super.deferStartingActivity(deviceState, ev);
}
@Override
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
index 19baaf1..54ff6a0 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
@@ -34,6 +34,7 @@
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_GLOBAL_ACTIONS_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_MAGNIFICATION_OVERLAP;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
@@ -52,6 +53,7 @@
import android.content.IntentFilter;
import android.content.res.Resources;
import android.graphics.Region;
+import android.inputmethodservice.InputMethodService;
import android.net.Uri;
import android.os.Process;
import android.os.RemoteException;
@@ -592,6 +594,12 @@
return mRotationTouchHelper;
}
+ /** Returns whether IME is rendering nav buttons, and IME is currently showing. */
+ public boolean isImeRenderingNavButtons() {
+ return InputMethodService.canImeRenderGesturalNavButtons() && mMode == NO_BUTTON
+ && ((mSystemUiStateFlags & SYSUI_STATE_IME_SHOWING) != 0);
+ }
+
public void dump(PrintWriter pw) {
pw.println("DeviceState:");
pw.println(" canStartSystemGesture=" + canStartSystemGesture());