Adding a separate state for QuickScrub

Bug: 74014237
Change-Id: Ie86ac589f0ad0e1470fb6b0b71263ec6593eb1e3
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 402d73d..54df1da 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -26,6 +26,7 @@
 
 import com.android.launcher3.uioverrides.AllAppsState;
 import com.android.launcher3.states.SpringLoadedState;
+import com.android.launcher3.uioverrides.FastOverviewState;
 import com.android.launcher3.uioverrides.OverviewState;
 import com.android.launcher3.uioverrides.UiFactory;
 import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
@@ -46,6 +47,9 @@
     protected static final int FLAG_DISABLE_PAGE_CLIPPING = 1 << 5;
     protected static final int FLAG_PAGE_BACKGROUNDS = 1 << 6;
     protected static final int FLAG_ALL_APPS_SCRIM = 1 << 7;
+    protected static final int FLAG_DISABLE_INTERACTION = 1 << 8;
+    protected static final int FLAG_OVERVIEW_UI = 1 << 9;
+
 
     protected static final PageAlphaProvider DEFAULT_ALPHA_PROVIDER =
             new PageAlphaProvider(ACCEL_2) {
@@ -55,7 +59,7 @@
                 }
             };
 
-    private static final LauncherState[] sAllStates = new LauncherState[4];
+    private static final LauncherState[] sAllStates = new LauncherState[5];
 
     /**
      * TODO: Create a separate class for NORMAL state.
@@ -69,6 +73,8 @@
 
     public static final LauncherState OVERVIEW = new OverviewState(3);
 
+    public static final LauncherState FAST_OVERVIEW = new FastOverviewState(4);
+
     public final int ordinal;
 
     /**
@@ -114,6 +120,16 @@
      */
     public final boolean disablePageClipping;
 
+    /**
+     * True if launcher can not be directly interacted in this state;
+     */
+    public final boolean disableInteraction;
+
+    /**
+     * True if the state has overview panel visible.
+     */
+    public final boolean overviewUi;
+
     public LauncherState(int id, int containerType, int transitionDuration, int flags) {
         this.containerType = containerType;
         this.transitionDuration = transitionDuration;
@@ -129,6 +145,8 @@
         this.disableRestore = (flags & FLAG_DISABLE_RESTORE) != 0;
         this.workspaceIconsCanBeDragged = (flags & FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED) != 0;
         this.disablePageClipping = (flags & FLAG_DISABLE_PAGE_CLIPPING) != 0;
+        this.disableInteraction = (flags & FLAG_DISABLE_INTERACTION) != 0;
+        this.overviewUi = (flags & FLAG_OVERVIEW_UI) != 0;
 
         this.ordinal = id;
         sAllStates[id] = this;
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index 7e3335a..301070c 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -172,6 +172,11 @@
             return true;
         }
 
+        if (mLauncher.getStateManager().getState().disableInteraction) {
+            // You Shall Not Pass!!!
+            return true;
+        }
+
         if (mDragController.onControllerInterceptTouchEvent(ev)) {
             mActiveController = mDragController;
             return true;
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index 993663e..b3310c7 100644
--- a/src/com/android/launcher3/folder/Folder.java
+++ b/src/com/android/launcher3/folder/Folder.java
@@ -930,7 +930,7 @@
         int centeredTop = centerY - height / 2;
 
         // We need to bound the folder to the currently visible workspace area
-        if (mLauncher.isInState(OVERVIEW)) {
+        if (mLauncher.getStateManager().getState().overviewUi) {
             mLauncher.getDragLayer().getDescendantRectRelativeToSelf(mLauncher.getOverviewPanel(),
                     sTempRect);
         } else {