diff --git a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java index a10583cf86..9507a366b3 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java @@ -16,12 +16,11 @@ package com.android.launcher3.uioverrides; +import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; -import static com.android.launcher3.LauncherState.ALL_APPS; import android.content.Context; -import android.content.SharedPreferences; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.DeviceProfile; @@ -59,6 +58,10 @@ public class UiFactory { } } + public static void setOnTouchControllersChangedListener(Context context, Runnable listener) { + OverviewInteractionState.getInstance(context).setOnSwipeUpSettingChangedListener(listener); + } + public static StateHandler[] getStateHandler(Launcher launcher) { return new StateHandler[] { launcher.getAllAppsController(), launcher.getWorkspace(), diff --git a/quickstep/src/com/android/quickstep/OverviewInteractionState.java b/quickstep/src/com/android/quickstep/OverviewInteractionState.java index 471262ba6d..0c24e220bc 100644 --- a/quickstep/src/com/android/quickstep/OverviewInteractionState.java +++ b/quickstep/src/com/android/quickstep/OverviewInteractionState.java @@ -15,7 +15,6 @@ */ package com.android.quickstep; -import static com.android.launcher3.Utilities.getPrefs; import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_QUICK_SCRUB; import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_SWIPE_UP; import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_HIDE_BACK_BUTTON; @@ -86,6 +85,8 @@ public class OverviewInteractionState { private boolean mBackButtonVisible = true; private boolean mSwipeUpEnabled = true; + private Runnable mOnSwipeUpSettingChangedListener; + private OverviewInteractionState(Context context) { mUiHandler = new Handler(this::handleUiMessage); mBgHandler = new Handler(UiThreadHelper.getBackgroundLooper(), this::handleBgMessage); @@ -124,12 +125,19 @@ public class OverviewInteractionState { break; case MSG_SET_SWIPE_UP_ENABLED: mSwipeUpEnabled = msg.arg1 != 0; + if (mOnSwipeUpSettingChangedListener != null) { + mOnSwipeUpSettingChangedListener.run(); + } break; } applyFlags(); return true; } + public void setOnSwipeUpSettingChangedListener(Runnable listener) { + mOnSwipeUpSettingChangedListener = listener; + } + @WorkerThread private void applyFlags() { if (mISystemUiProxy == null) { diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 90c55c983a..88408606f5 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -18,7 +18,6 @@ package com.android.launcher3; import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION; import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE; - import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; @@ -81,7 +80,6 @@ import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.dragndrop.DragController; import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.dragndrop.DragView; -import com.android.launcher3.dynamicui.WallpaperColorInfo; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.folder.FolderIconPreviewVerifier; import com.android.launcher3.keyboard.CustomActionsPopup; @@ -923,7 +921,9 @@ public class Launcher extends BaseDraggingActivity | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); // Setup the drag layer - mDragLayer.setup(mDragController); + Runnable setupDragLayer = () -> mDragLayer.setup(mDragController); + UiFactory.setOnTouchControllersChangedListener(this, setupDragLayer); + setupDragLayer.run(); mWorkspace.setup(mDragController); // Until the workspace is bound, ensure that we keep the wallpaper offset locked to the @@ -1327,6 +1327,8 @@ public class Launcher extends BaseDraggingActivity unregisterReceiver(mReceiver); mWorkspace.removeFolderListeners(); + UiFactory.setOnTouchControllersChangedListener(this, null); + // Stop callbacks from LauncherModel // It's possible to receive onDestroy after a new Launcher activity has // been created. In this case, don't interfere with the new Launcher. diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java index be9d5b734b..bd1a96e536 100644 --- a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java +++ b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java @@ -16,6 +16,8 @@ package com.android.launcher3.uioverrides; +import android.content.Context; + import com.android.launcher3.Launcher; import com.android.launcher3.LauncherStateManager.StateHandler; import com.android.launcher3.util.TouchController; @@ -27,6 +29,8 @@ public class UiFactory { launcher.getDragController(), new AllAppsSwipeController(launcher)}; } + public static void setOnTouchControllersChangedListener(Context context, Runnable listener) { } + public static StateHandler[] getStateHandler(Launcher launcher) { return new StateHandler[] { launcher.getAllAppsController(), launcher.getWorkspace() };