2/ Notify adjust touch slop when one handed mode activated
When one handed mode activated, user swipe-up to exit usually
cross over the NavBar region, and then invoke TouchController
intercept touch event to trigger All Apps drawer on Home.
To enhanced the UX of gesture conflict of exit OHM & All Apps,
notify TouchController throught LauncherActivityInterface,
and Launcher dispatch onOneHandedModeStateChanged() event to
all mTouchControllers in DragLayer that touchController can
adjust the touch slop by it's SingleAxisSwipeDetector.
Test: manual trigger One handed mode and swipe-up to exit
Test: monitor minDisplacement of SingleAxisSwipeDetector
OHM activated : touchSlop x multiplier
OHM deactivated : touchSlop x 1
Test: check All Apps doesn't mis-trigger when exit one handed mode
Bug: 186235522
Change-Id: I7b9e6e7fa898231697d1866186a5f9b1717a9aa3
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index 4ae6fa8..7ab371b 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -114,6 +114,9 @@
public abstract void onAssistantVisibilityChanged(float visibility);
+ /** Called when one handed mode activated or deactivated. */
+ public abstract void onOneHandedModeStateChanged(boolean activated);
+
public abstract AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback);
diff --git a/quickstep/src/com/android/quickstep/FallbackActivityInterface.java b/quickstep/src/com/android/quickstep/FallbackActivityInterface.java
index 4ee4398..906599f 100644
--- a/quickstep/src/com/android/quickstep/FallbackActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/FallbackActivityInterface.java
@@ -73,6 +73,11 @@
// set to zero prior to this class becoming active.
}
+ @Override
+ public void onOneHandedModeStateChanged(boolean activated) {
+ // Do nothing for FallbackActivityInterface
+ }
+
/** 6 */
@Override
public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
diff --git a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java
index 9014774..30abfbb 100644
--- a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java
@@ -105,6 +105,15 @@
}
@Override
+ public void onOneHandedModeStateChanged(boolean activated) {
+ Launcher launcher = getCreatedActivity();
+ if (launcher == null) {
+ return;
+ }
+ launcher.onOneHandedStateChanged(activated);
+ }
+
+ @Override
public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback) {
notifyRecentsOfOrientation(deviceState.getRotationTouchHelper());
diff --git a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
index fb8f9fe..0efe666 100644
--- a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
+++ b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
@@ -111,6 +111,11 @@
if (mDeviceState.isHomeDisabled() != mIsHomeDisabled) {
updateOverviewTargets();
}
+
+ // Notify ALL_APPS touch controller when one handed mode state activated or deactivated
+ if (mDeviceState.isOneHandedModeEnabled()) {
+ mActivityInterface.onOneHandedModeStateChanged(mDeviceState.isOneHandedModeActive());
+ }
}
private void updateOverviewTargets(Intent unused) {
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 8889e60..299c68f 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -576,6 +576,14 @@
mHotseat.getQsb().setAlpha(1f - visibility);
}
+ /**
+ * Called when one handed mode activated and deactivated.
+ * @param activated true if one handed mode activated, false otherwise.
+ */
+ public void onOneHandedStateChanged(boolean activated) {
+ mDragLayer.onOneHandedModeStateChanged(activated);
+ }
+
private void initDeviceProfile(InvariantDeviceProfile idp) {
// Load configuration-specific DeviceProfile
mDeviceProfile = idp.getDeviceProfile(this);