From acf0a5da0bcb0c1d0ce918699a764c3b256b496e Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Wed, 4 Mar 2020 14:46:47 -0800 Subject: [PATCH 01/13] [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 02/13] [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 03/13] [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 04/13] 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 05/13] [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. From 1ff2be0dcea0cb0191963f8ec145802541d9e647 Mon Sep 17 00:00:00 2001 From: Alex Mang Date: Mon, 9 Mar 2020 12:57:11 -0700 Subject: [PATCH 06/13] [DO NOT MERGE] Initiailize APP_SEARCH_IMRPOVEMENT flag outside DEBUG builds. This is addressing a bug where flags are only changed on debug build devices or initially when changes. When nexuslauncher restarts the flag is no longer retrieved. Change-Id: Ieb6f460a271c918ee4e493b34692244f39cb3740 (cherry picked from commit e1664fcf1486d337ea998ded70d092590a0bfbd9) --- src/com/android/launcher3/config/BaseFlags.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java index cd7444bba9..b264b798c0 100644 --- a/src/com/android/launcher3/config/BaseFlags.java +++ b/src/com/android/launcher3/config/BaseFlags.java @@ -132,6 +132,7 @@ public abstract class BaseFlags { } } } + APP_SEARCH_IMPROVEMENTS.initialize(context); } static List getTogglableFlags() { From 9720993e9d58636762297e87ce10b5a14c30a521 Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Wed, 18 Mar 2020 22:23:49 +0000 Subject: [PATCH 07/13] Revert "[DO NOT MERGE] Turn off FOLDER_NAME_SUGGEST feature flag" This reverts commit a299714c7a080b87fab4bb0f1a9c15231558b8c4. Reason for revert: PM decided to keep it on until R release to not have press write about feature going away. Change-Id: I83c21e3938c38632e267498ba326d0da075e5dc8 --- 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 cd7444bba9..64d236fabe 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", false, + "FOLDER_NAME_SUGGEST", true, "Suggests folder names instead of blank text."); public static final TogglableFlag APP_SEARCH_IMPROVEMENTS = new TogglableFlag( From 3fd9d785eae40de41694a92db0b098fe572f505f Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Wed, 18 Mar 2020 22:06:50 -0700 Subject: [PATCH 08/13] Import translations. DO NOT MERGE BUG: 151750123 Auto-generated-cl: translation import Change-Id: I5c7e8ffccb7830d2159bfe0de0d35fe011938e74 --- res/values-rm/strings.xml | 203 -------------------------------------- 1 file changed, 203 deletions(-) delete mode 100644 res/values-rm/strings.xml diff --git a/res/values-rm/strings.xml b/res/values-rm/strings.xml deleted file mode 100644 index 0758148f58..0000000000 --- a/res/values-rm/strings.xml +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 3b5f2224c6b21d89d1962db2bee2d85efd406918 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 19 Mar 2020 13:19:31 -0700 Subject: [PATCH 09/13] [DO NOT MERGE] Support blacklisting live wallpapers from showing sysui scrims Add wallpaper changed broadcast receiver to BaseDragLayer, which checks if the new wallpaper is blacklisted and relays that to remove the scrims. Bug: 150144115 Change-Id: I55b7b98fdd419cd76532492461a872367efed67b (cherry picked from commit d6f917f1824ed97e6f9a225fe1600a8162922d31) --- .../quickstep/fallback/RecentsRootView.java | 3 +- res/values/config.xml | 3 + .../launcher3/dragndrop/DragLayer.java | 2 +- .../graphics/WorkspaceAndHotseatScrim.java | 11 ++-- .../launcher3/views/BaseDragLayer.java | 65 +++++++++++++++++++ 5 files changed, 78 insertions(+), 6 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java index 1820729576..2b369e7bf7 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java @@ -80,7 +80,8 @@ public class RecentsRootView extends BaseDragLayer { if (!insets.equals(mInsets)) { super.setInsets(insets); } - setBackground(insets.top == 0 ? null + setBackground(insets.top == 0 || !mAllowSysuiScrims + ? null : Themes.getAttrDrawable(getContext(), R.attr.workspaceStatusBarScrim)); } diff --git a/res/values/config.xml b/res/values/config.xml index 038718473b..9d36ee41fc 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -118,4 +118,7 @@ + + + diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java index cdc70611dd..0b6d8fb6a2 100644 --- a/src/com/android/launcher3/dragndrop/DragLayer.java +++ b/src/com/android/launcher3/dragndrop/DragLayer.java @@ -556,7 +556,7 @@ public class DragLayer extends BaseDragLayer { @Override public void setInsets(Rect insets) { super.setInsets(insets); - mWorkspaceScrim.onInsetsChanged(insets); + mWorkspaceScrim.onInsetsChanged(insets, mAllowSysuiScrims); mOverviewScrim.onInsetsChanged(insets); } diff --git a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java index 6740fa16e5..15ff207bd1 100644 --- a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java +++ b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java @@ -187,10 +187,13 @@ public class WorkspaceAndHotseatScrim extends Scrim { anim.start(); } - public void onInsetsChanged(Rect insets) { - mDrawTopScrim = mTopScrim != null && insets.top > 0; - mDrawBottomScrim = mBottomMask != null && - !mLauncher.getDeviceProfile().isVerticalBarLayout(); + /** + * Determines whether to draw the top and/or bottom scrim based on new insets. + */ + public void onInsetsChanged(Rect insets, boolean allowSysuiScrims) { + mDrawTopScrim = allowSysuiScrims && mTopScrim != null && insets.top > 0; + mDrawBottomScrim = allowSysuiScrims && mBottomMask != null + && !mLauncher.getDeviceProfile().isVerticalBarLayout(); } @Override diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java index e43fc8a01c..a4f6a8ef58 100644 --- a/src/com/android/launcher3/views/BaseDragLayer.java +++ b/src/com/android/launcher3/views/BaseDragLayer.java @@ -23,7 +23,13 @@ import static android.view.MotionEvent.ACTION_UP; import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs; import android.annotation.TargetApi; +import android.app.WallpaperInfo; +import android.app.WallpaperManager; +import android.content.BroadcastReceiver; +import android.content.ComponentName; import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.graphics.Insets; import android.graphics.Rect; import android.graphics.RectF; @@ -39,8 +45,11 @@ import android.view.WindowInsets; import android.view.accessibility.AccessibilityEvent; import android.widget.FrameLayout; +import androidx.annotation.Nullable; + import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.InsettableFrameLayout; +import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.MultiValueAlpha; @@ -100,6 +109,14 @@ public abstract class BaseDragLayer protected final T mActivity; private final MultiValueAlpha mMultiValueAlpha; + private final WallpaperManager mWallpaperManager; + private final BroadcastReceiver mWallpaperChangeReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + onWallpaperChanged(); + } + }; + private final String[] mWallpapersWithoutSysuiScrims; // All the touch controllers for the view protected TouchController[] mControllers; @@ -110,10 +127,15 @@ public abstract class BaseDragLayer private TouchCompleteListener mTouchCompleteListener; + protected boolean mAllowSysuiScrims = true; + public BaseDragLayer(Context context, AttributeSet attrs, int alphaChannelCount) { super(context, attrs); mActivity = (T) ActivityContext.lookupContext(context); mMultiValueAlpha = new MultiValueAlpha(this, alphaChannelCount); + mWallpaperManager = context.getSystemService(WallpaperManager.class); + mWallpapersWithoutSysuiScrims = getResources().getStringArray( + R.array.live_wallpapers_remove_sysui_scrims); } /** @@ -513,4 +535,47 @@ public abstract class BaseDragLayer } return super.dispatchApplyWindowInsets(insets); } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + mActivity.registerReceiver(mWallpaperChangeReceiver, + new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED)); + onWallpaperChanged(); + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + mActivity.unregisterReceiver(mWallpaperChangeReceiver); + } + + private void onWallpaperChanged() { + WallpaperInfo newWallpaperInfo = mWallpaperManager.getWallpaperInfo(); + boolean oldAllowSysuiScrims = mAllowSysuiScrims; + mAllowSysuiScrims = computeAllowSysuiScrims(newWallpaperInfo); + if (mAllowSysuiScrims != oldAllowSysuiScrims) { + // Reapply insets so scrim can be removed or re-added if necessary. + setInsets(mInsets); + } + } + + /** + * Determines whether we can scrim the status bar and nav bar for the given wallpaper by + * checking against a list of live wallpapers that we don't show the scrims on. + */ + private boolean computeAllowSysuiScrims(@Nullable WallpaperInfo newWallpaperInfo) { + if (newWallpaperInfo == null) { + // New wallpaper is static, not live. Thus, blacklist isn't applicable. + return true; + } + ComponentName newWallpaper = newWallpaperInfo.getComponent(); + for (String wallpaperWithoutScrim : mWallpapersWithoutSysuiScrims) { + if (newWallpaper.equals(ComponentName.unflattenFromString(wallpaperWithoutScrim))) { + // New wallpaper is blacklisted from showing a scrim. + return false; + } + } + return true; + } } From ed538e53b0625c874fe549c67ed612e8c3028e68 Mon Sep 17 00:00:00 2001 From: thiruram Date: Mon, 23 Mar 2020 13:26:44 -0700 Subject: [PATCH 10/13] [DO NOT MERGE] Adds basic smart-folder logging. This would allow collecting trimmed down version of smart-folder logs from QPR devices. Change-Id: Ida332bd969774cabcfd72def5bed0e6409d6c8e1 (cherry picked from commit d684eddd9f47e97931c8960e11e4434c58270150) --- protos/launcher_log.proto | 3 +- src/com/android/launcher3/folder/Folder.java | 41 +++++++++++++++++++ .../launcher3/logging/LoggerUtils.java | 2 +- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto index 055ade58eb..fd36d4ba53 100644 --- a/protos/launcher_log.proto +++ b/protos/launcher_log.proto @@ -137,7 +137,8 @@ message Action { AUTOMATED = 1; COMMAND = 2; TIP = 3; - // SOFT_KEYBOARD, HARD_KEYBOARD, ASSIST + SOFT_KEYBOARD = 4; + // HARD_KEYBOARD, ASSIST } enum Touch { diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index 0bd2c9af7f..f483d78f4a 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -17,6 +17,8 @@ package com.android.launcher3.folder; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; +import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP; +import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent; @@ -74,6 +76,7 @@ import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.logging.LoggerUtils; import com.android.launcher3.pageindicators.PageIndicatorDots; +import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; @@ -1340,6 +1343,9 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo if (hasFocus) { startEditingFolderName(); } else { + if (isEditingName()) { + logEditFolderLabel(); + } mFolderName.dispatchBackKey(); } } @@ -1517,4 +1523,39 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo super.draw(canvas); } } + + private void logEditFolderLabel() { + LauncherLogProto.LauncherEvent ev = new LauncherLogProto.LauncherEvent(); + LauncherLogProto.Action action = new LauncherLogProto.Action(); + action.type = LauncherLogProto.Action.Type.SOFT_KEYBOARD; + ev.action = action; + + LauncherLogProto.Target edittext_target = new LauncherLogProto.Target(); + edittext_target.type = LauncherLogProto.Target.Type.ITEM; + edittext_target.itemType = LauncherLogProto.ItemType.EDITTEXT; + + LauncherLogProto.Target folder_target = new LauncherLogProto.Target(); + folder_target.type = LauncherLogProto.Target.Type.CONTAINER; + folder_target.containerType = LauncherLogProto.ContainerType.FOLDER; + folder_target.pageIndex = mInfo.screenId; + folder_target.gridX = mInfo.cellX; + folder_target.gridY = mInfo.cellY; + folder_target.cardinality = mInfo.contents.size(); + + LauncherLogProto.Target parent_target = new LauncherLogProto.Target(); + parent_target.type = LauncherLogProto.Target.Type.CONTAINER; + switch (mInfo.container) { + case CONTAINER_HOTSEAT: + parent_target.containerType = LauncherLogProto.ContainerType.HOTSEAT; + break; + case CONTAINER_DESKTOP: + parent_target.containerType = LauncherLogProto.ContainerType.WORKSPACE; + break; + default: + Log.e(TAG, String.format("Expected container to be either %s or %s but found %s.", + CONTAINER_HOTSEAT, CONTAINER_DESKTOP, mInfo.container)); + } + ev.srcTarget = new LauncherLogProto.Target[]{edittext_target, folder_target, parent_target}; + mLauncher.getUserEventDispatcher().dispatchUserEvent(ev, null); + } } diff --git a/src/com/android/launcher3/logging/LoggerUtils.java b/src/com/android/launcher3/logging/LoggerUtils.java index 598792abce..925b7ba286 100644 --- a/src/com/android/launcher3/logging/LoggerUtils.java +++ b/src/com/android/launcher3/logging/LoggerUtils.java @@ -109,7 +109,7 @@ public class LoggerUtils { t.containerType == NAVBAR) { str += " id=" + t.pageIndex; } else if (t.containerType == ContainerType.FOLDER) { - str += " grid(" + t.gridX + "," + t.gridY + ")"; + str += "[PageIndex=" + t.pageIndex + ", grid(" + t.gridX + "," + t.gridY + ")]"; } break; default: From 66dc70c91b22026800b6f7cfb85fe233a72fd462 Mon Sep 17 00:00:00 2001 From: Andy Wickham Date: Tue, 24 Mar 2020 01:03:52 +0000 Subject: [PATCH 11/13] Fixes ag/10573640 on qt-future-dev branch. Original qt-future-dev change was ag/10601877. The change needed to be in UiFactory, not RecentsUiFactory. Fixes: 146593239 Test: Installed NexusLauncherDebug on a QD4A build and tried the repo steps. Also built other launcher variants. Merged-In: Ib9c85de2f83f99d1ef53fb17fde5d0b3c514849a Change-Id: I802e2b0069a19ca62a08325bb6d0de5275c43c9b --- .../android/launcher3/uioverrides/RecentsUiFactory.java | 8 -------- .../src/com/android/launcher3/uioverrides/UiFactory.java | 8 +++++++- 2 files changed, 7 insertions(+), 9 deletions(-) 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 4d935e1157..cac170c68c 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,7 +19,6 @@ 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; @@ -49,7 +48,6 @@ 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; @@ -210,12 +208,6 @@ 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 eb58b9425f..0790cf6b03 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java @@ -28,6 +28,7 @@ import static com.android.launcher3.allapps.DiscoveryBounce.HOME_BOUNCE_COUNT; import static com.android.launcher3.allapps.DiscoveryBounce.HOME_BOUNCE_SEEN; import static com.android.launcher3.allapps.DiscoveryBounce.SHELF_BOUNCE_COUNT; import static com.android.launcher3.allapps.DiscoveryBounce.SHELF_BOUNCE_SEEN; +import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS; import android.animation.AnimatorSet; import android.animation.ValueAnimator; @@ -58,6 +59,7 @@ import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.SysUINavigationMode.NavigationModeChangeListener; import com.android.quickstep.util.RemoteFadeOutAnimationListener; import com.android.systemui.shared.system.ActivityCompat; +import com.android.systemui.shared.system.ActivityManagerWrapper; import java.io.ByteArrayOutputStream; import java.io.PrintWriter; @@ -252,5 +254,9 @@ public class UiFactory extends RecentsUiFactory { return persons == null ? Utilities.EMPTY_PERSON_ARRAY : persons; } - public static void closeSystemWindows() {} + /** Closes system windows. */ + public static void closeSystemWindows() { + ActivityManagerWrapper.getInstance() + .closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS); + } } From 7899902b12dd7c4aece48585d4921bdf33d27194 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Wed, 18 Mar 2020 12:22:50 -0700 Subject: [PATCH 12/13] Ensure current animation is cancelled before building new folder animation. Fixes bug where folder clip padding gets stuck as false. Bug: 146884730 Change-Id: I3a24e561d15fbc46837bb21cd8f97283e69f9ce1 (cherry picked from commit 9794d4d52a8083514186774fb9a57764dff35ec4) --- src/com/android/launcher3/folder/Folder.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index f483d78f4a..8df5e7d031 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -445,9 +445,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo } private void startAnimation(final AnimatorSet a) { - if (mCurrentAnimator != null && mCurrentAnimator.isRunning()) { - mCurrentAnimator.cancel(); - } final Workspace workspace = mLauncher.getWorkspace(); final CellLayout currentCellLayout = (CellLayout) workspace.getChildAt(workspace.getCurrentPage()); @@ -553,6 +550,9 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo // dropping. One resulting issue is that replaceFolderWithFinalItem() can be called twice. mDeleteFolderOnDropCompleted = false; + if (mCurrentAnimator != null && mCurrentAnimator.isRunning()) { + mCurrentAnimator.cancel(); + } AnimatorSet anim = new FolderAnimationManager(this, true /* isOpening */).getAnimator(); anim.addListener(new AnimatorListenerAdapter() { @Override @@ -653,6 +653,9 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo } private void animateClosed() { + if (mCurrentAnimator != null && mCurrentAnimator.isRunning()) { + mCurrentAnimator.cancel(); + } AnimatorSet a = new FolderAnimationManager(this, false /* isOpening */).getAnimator(); a.addListener(new AnimatorListenerAdapter() { @Override From e0ae1afd5189e8f5a58abdb8114562a2f067dca4 Mon Sep 17 00:00:00 2001 From: jayaprakashs Date: Mon, 16 Mar 2020 11:04:46 -0700 Subject: [PATCH 13/13] [DO NOT MERGE] Enable APP_SEARCH_IMPROVEMENTS flag. Bug: 151196870 Merged-In: I0665be5d585f64f3d43d42201a6529fd88247ca4 Change-Id: I0665be5d585f64f3d43d42201a6529fd88247ca4 (cherry picked from commit 6b6dbc3442c492d8e35fb4a2d0976b4fbc036dc9) --- 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 2a3f5af75b..4b90e421ff 100644 --- a/src/com/android/launcher3/config/BaseFlags.java +++ b/src/com/android/launcher3/config/BaseFlags.java @@ -113,7 +113,7 @@ public abstract class BaseFlags { "Suggests folder names instead of blank text."); public static final TogglableFlag APP_SEARCH_IMPROVEMENTS = new TogglableFlag( - "APP_SEARCH_IMPROVEMENTS", false, + "APP_SEARCH_IMPROVEMENTS", true, "Adds localized title and keyword search and ranking"); public static final TogglableFlag ENABLE_PREDICTION_DISMISS = new TogglableFlag(