From 9a8462117d873ac88244e0af821b955a2a46dcae Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Thu, 5 Sep 2019 11:47:12 -0700 Subject: [PATCH] Set exclusion rect for launcher before it gains focus Back gesture still shows if user attempts to swipe back while we're animating to launcher state normal. Focus is only granted after the animation has completed, but the user can interact w/ the back edge panels while it's ongoing. fixes: 138622418 Test: Open app, swipe home and quickly swipe from the edge of the screen. Should go to -1 screen and not see back arrow. Change-Id: I32228370c7ec1bdb75474fdff2d1c99cb677fa6a --- .../quickstep/LauncherActivityControllerHelper.java | 10 +++++++++- src/com/android/launcher3/LauncherRootView.java | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java index d7afd328db..46ba2a41a2 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java @@ -109,6 +109,14 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe // Ensure recents is at the correct position for NORMAL state. For example, when we detach // recents, we assume the first task is invisible, making translation off by one task. activity.getStateManager().reapplyState(); + setLauncherHideBackArrow(false); + } + + private void setLauncherHideBackArrow(boolean hideBackArrow) { + Launcher launcher = getCreatedActivity(); + if (launcher != null) { + launcher.getRootView().setForceHideBackArrow(hideBackArrow); + } } @Override @@ -139,7 +147,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe ? FloatingIconView.getFloatingIconView(activity, workspaceView, true /* hideOriginal */, iconLocation, false /* isOpening */) : null; - + setLauncherHideBackArrow(true); return new HomeAnimationFactory() { @Nullable @Override diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java index f964b8d9ee..ce1795aa11 100644 --- a/src/com/android/launcher3/LauncherRootView.java +++ b/src/com/android/launcher3/LauncherRootView.java @@ -39,6 +39,8 @@ public class LauncherRootView extends InsettableFrameLayout { private WindowStateListener mWindowStateListener; @ViewDebug.ExportedProperty(category = "launcher") private boolean mDisallowBackGesture; + @ViewDebug.ExportedProperty(category = "launcher") + private boolean mForceHideBackArrow; public LauncherRootView(Context context, AttributeSet attrs) { super(context, attrs); @@ -175,13 +177,19 @@ public class LauncherRootView extends InsettableFrameLayout { setDisallowBackGesture(mDisallowBackGesture); } + @TargetApi(Build.VERSION_CODES.Q) + public void setForceHideBackArrow(boolean forceHideBackArrow) { + this.mForceHideBackArrow = forceHideBackArrow; + setDisallowBackGesture(mDisallowBackGesture); + } + @TargetApi(Build.VERSION_CODES.Q) public void setDisallowBackGesture(boolean disallowBackGesture) { if (!Utilities.ATLEAST_Q) { return; } mDisallowBackGesture = disallowBackGesture; - setSystemGestureExclusionRects(mDisallowBackGesture + setSystemGestureExclusionRects((mForceHideBackArrow || mDisallowBackGesture) ? SYSTEM_GESTURE_EXCLUSION_RECT : Collections.emptyList()); }