From acf0a5da0bcb0c1d0ce918699a764c3b256b496e Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Wed, 4 Mar 2020 14:46:47 -0800 Subject: [PATCH 1/5] [DO NOT MERGE] Prevent hotseat touch hijack Currently in AllAppsContinerView#onInterceptTouchEvent we check if a touch event is in bounds of RecyclerViewFastScroller and set mTouchHandler so the scroll bar handles onTouchEvent. However, if a user performs a back gesture from the right side (which overlaps with the scroller) and returns home, touches to the hotseat get intercepted. Bug: 148639821 Test: Manual Change-Id: Ie44f3a16b628b12ad00a7ae6c6bc5703171fbb56 --- .../allapps/AllAppsContainerView.java | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 37ee24850e..2d5b04058c 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -26,14 +26,18 @@ import android.os.Process; import android.text.Selection; import android.text.SpannableStringBuilder; import android.util.AttributeSet; -import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.WindowInsets; - +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.StringRes; +import androidx.dynamicanimation.animation.DynamicAnimation; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import com.android.launcher3.AppInfo; import com.android.launcher3.DeviceProfile; import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; @@ -45,11 +49,11 @@ import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.R; -import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.Utilities; import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.keyboard.FocusedItemDecorator; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.ItemInfoMatcher; @@ -60,13 +64,6 @@ import com.android.launcher3.views.BottomUserEducationView; import com.android.launcher3.views.RecyclerViewFastScroller; import com.android.launcher3.views.SpringRelativeLayout; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.dynamicanimation.animation.DynamicAnimation; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - /** * The all apps view container. */ @@ -200,7 +197,10 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo // The AllAppsContainerView houses the QSB and is hence visible from the Workspace // Overview states. We shouldn't intercept for the scrubber in these cases. - if (!mLauncher.isInState(LauncherState.ALL_APPS)) return false; + if (!mLauncher.isInState(LauncherState.ALL_APPS)) { + mTouchHandler = null; + return false; + } if (ev.getAction() == MotionEvent.ACTION_DOWN) { AllAppsRecyclerView rv = getActiveRecyclerView(); @@ -219,6 +219,16 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo @Override public boolean onTouchEvent(MotionEvent ev) { + if (ev.getAction() == MotionEvent.ACTION_DOWN) { + AllAppsRecyclerView rv = getActiveRecyclerView(); + if (rv != null && rv.getScrollbar() + .isHitInParent(ev.getX(), ev.getY(), mFastScrollerOffset)) { + mTouchHandler = rv.getScrollbar(); + } else { + mTouchHandler = null; + } + } + if (mTouchHandler != null) { mTouchHandler.handleTouchEvent(ev, mFastScrollerOffset); return true; From a299714c7a080b87fab4bb0f1a9c15231558b8c4 Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Fri, 6 Mar 2020 12:53:42 -0800 Subject: [PATCH 2/5] [DO NOT MERGE] Turn off FOLDER_NAME_SUGGEST feature flag Bug: 150788630 Change-Id: I740d6b6f3ee1a33a95debfafa29b3caea24a03c3 (cherry picked from commit f538393e42896e5488ca10fccc4cf9409d7295e2) --- src/com/android/launcher3/config/BaseFlags.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java index 64d236fabe..cd7444bba9 100644 --- a/src/com/android/launcher3/config/BaseFlags.java +++ b/src/com/android/launcher3/config/BaseFlags.java @@ -109,7 +109,7 @@ public abstract class BaseFlags { "Rotate launcher UI instead of using transposed layout"); public static final TogglableFlag FOLDER_NAME_SUGGEST = new TogglableFlag( - "FOLDER_NAME_SUGGEST", true, + "FOLDER_NAME_SUGGEST", false, "Suggests folder names instead of blank text."); public static final TogglableFlag APP_SEARCH_IMPROVEMENTS = new TogglableFlag( From 96c2220f7fbc349562b3385d74456470c6354354 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Mon, 9 Mar 2020 12:50:38 -0700 Subject: [PATCH 3/5] [DO NOT MERGE] Fix some visual jumps when swiping home All caused by running the transform progress from 0 to 1 instead of starting at whatever the progress was before ending the gesture, e.g.: - When swiping to home without animating into an icon, the corner radius was set back to the window corner radius. - Before this change, the clip didn't update throughout the animation, making the window slightly bigger than the floating icon view; after this change, the clip jumped to show the insets again before clipping back down during the home animation. Partial backport of ag/Ie48f4b665a5bf3cbef76bdf7f043febe99fb84a0 Bug: 150680980 Change-Id: Ida65097f0ef7d2e11d48b84ecdd353ef89078015 --- .../src/com/android/quickstep/BaseSwipeUpHandler.java | 7 ++++++- .../com/android/quickstep/util/ClipAnimationHelper.java | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java index 5cce53ebf1..e5d2b411a8 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java @@ -386,6 +386,10 @@ public abstract class BaseSwipeUpHandler Date: Tue, 10 Mar 2020 01:36:02 +0000 Subject: [PATCH 4/5] Dismisses system overlays for Home intent. Test: Used Facebook chatheads (not system bubble). Before the change, Home gesture didn't work. After the change, it does work :) Bug: 146593239 Merged-In: Ib9c85de2f83f99d1ef53fb17fde5d0b3c514849a Change-Id: I19d91aaed19ccaec68478e364ce6b80049d49a98 --- .../android/launcher3/uioverrides/RecentsUiFactory.java | 8 ++++++++ .../src/com/android/launcher3/uioverrides/UiFactory.java | 2 ++ src/com/android/launcher3/Launcher.java | 1 + .../com/android/launcher3/uioverrides/UiFactory.java | 2 ++ 4 files changed, 13 insertions(+) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java index cac170c68c..4d935e1157 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java @@ -19,6 +19,7 @@ package com.android.launcher3.uioverrides; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; +import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS; import android.content.Context; import android.graphics.Rect; @@ -48,6 +49,7 @@ import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.TouchInteractionService; import com.android.quickstep.views.RecentsView; +import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.WindowManagerWrapper; import java.util.ArrayList; @@ -208,6 +210,12 @@ public abstract class RecentsUiFactory { } } + /** Closes system windows. */ + public static void closeSystemWindows() { + ActivityManagerWrapper.getInstance() + .closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS); + } + private static final class LauncherTaskViewController extends TaskViewTouchController { diff --git a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java index c02df9386c..eb58b9425f 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java @@ -251,4 +251,6 @@ public class UiFactory extends RecentsUiFactory { Person[] persons = si.getPersons(); return persons == null ? Utilities.EMPTY_PERSON_ARRAY : persons; } + + public static void closeSystemWindows() {} } diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 80860455c2..1338b3062b 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1397,6 +1397,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, if (!internalStateHandled) { // In all these cases, only animate if we're already on home AbstractFloatingView.closeAllOpenViews(this, isStarted()); + UiFactory.closeSystemWindows(); if (!isInState(NORMAL)) { // Only change state, if not already the same. This prevents cancelling any diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java index 467ae02d5c..f2b5ed219b 100644 --- a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java +++ b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java @@ -101,4 +101,6 @@ public class UiFactory { public static Person[] getPersons(ShortcutInfo si) { return Utilities.EMPTY_PERSON_ARRAY; } + + public static void closeSystemWindows() {} } From 97ce9ee93fd290d706f89c2819c21fea3a508bdf Mon Sep 17 00:00:00 2001 From: Govinda Wasserman Date: Thu, 5 Mar 2020 16:50:22 -0500 Subject: [PATCH 5/5] [DO NOT MERGE] Adds fling gesture suppression to Launcher Test: Tested locally BUG: 150688842 Change-Id: Ifa96bd01363de47cf1d8cdce34d81d525c8c2c04 --- .../quickstep/TouchInteractionService.java | 17 +++++++++++++---- .../inputconsumers/AssistantTouchConsumer.java | 13 ++++++++----- .../quickstep/OverviewComponentObserver.java | 5 +++++ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index f32182600a..2fa789fd6c 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -563,9 +563,13 @@ public class TouchInteractionService extends Service implements // not interrupt it. QuickSwitch assumes that interruption can only happen if the // next gesture is also quick switch. mUncheckedConsumer = - new AssistantTouchConsumer(this, mISystemUiProxy, + new AssistantTouchConsumer( + this, + mISystemUiProxy, mOverviewComponentObserver.getActivityControlHelper(), - InputConsumer.NO_OP, mInputMonitorCompat); + InputConsumer.NO_OP, + mInputMonitorCompat, + mOverviewComponentObserver.assistantGestureIsConstrained()); } else { mUncheckedConsumer = InputConsumer.NO_OP; } @@ -612,8 +616,13 @@ public class TouchInteractionService extends Service implements final ActivityControlHelper activityControl = mOverviewComponentObserver.getActivityControlHelper(); if (canTriggerAssistantAction(event)) { - base = new AssistantTouchConsumer(this, mISystemUiProxy, activityControl, base, - mInputMonitorCompat); + base = new AssistantTouchConsumer( + this, + mISystemUiProxy, + activityControl, + base, + mInputMonitorCompat, + mOverviewComponentObserver.assistantGestureIsConstrained()); } if ((mSystemUiStateFlags & SYSUI_STATE_SCREEN_PINNING) != 0) { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java index 346969e592..d4cdaf0403 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java @@ -91,14 +91,16 @@ public class AssistantTouchConsumer extends DelegateInputConsumer { private final ISystemUiProxy mSysUiProxy; private final Context mContext; private final GestureDetector mGestureDetector; + private final boolean mIsAssistGestureConstrained; public AssistantTouchConsumer(Context context, ISystemUiProxy systemUiProxy, ActivityControlHelper activityControlHelper, InputConsumer delegate, - InputMonitorCompat inputMonitor) { + InputMonitorCompat inputMonitor, boolean isAssistGestureConstrained) { super(delegate, inputMonitor); final Resources res = context.getResources(); mContext = context; mSysUiProxy = systemUiProxy; + mIsAssistGestureConstrained = isAssistGestureConstrained; mDragDistThreshold = res.getDimension(R.dimen.gestures_assistant_drag_threshold); mFlingDistThreshold = res.getDimension(R.dimen.gestures_assistant_fling_threshold); mTimeThreshold = res.getInteger(R.integer.assistant_gesture_min_time_threshold); @@ -273,10 +275,11 @@ public class AssistantTouchConsumer extends DelegateInputConsumer { private class AssistantGestureListener extends SimpleOnGestureListener { @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { - if (isValidAssistantGestureAngle(velocityX, -velocityY) - && mDistance >= mFlingDistThreshold - && !mLaunchedAssistant - && mState != STATE_DELEGATE_ACTIVE) { + if (!mIsAssistGestureConstrained + && isValidAssistantGestureAngle(velocityX, -velocityY) + && mDistance >= mFlingDistThreshold + && !mLaunchedAssistant + && mState != STATE_DELEGATE_ACTIVE) { mLastProgress = 1; try { mSysUiProxy.onAssistantGestureCompletion( diff --git a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java index 88a4eb6d11..93a6127ed7 100644 --- a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java +++ b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java @@ -22,6 +22,7 @@ import static android.content.Intent.ACTION_PACKAGE_REMOVED; import static com.android.launcher3.util.PackageManagerHelper.getPackageFilter; import static com.android.systemui.shared.system.PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED; import android.content.BroadcastReceiver; @@ -107,6 +108,10 @@ public final class OverviewComponentObserver { } } + public boolean assistantGestureIsConstrained() { + return (mSystemUiStateFlags & SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED) != 0; + } + /** * Update overview intent and {@link ActivityControlHelper} based off the current launcher home * component.