From dfcec9c71c2583275bdac8d45331c340a3dc57ba Mon Sep 17 00:00:00 2001 From: Shamali P Date: Tue, 8 Oct 2024 23:20:26 +0000 Subject: [PATCH] Fix issue that widget drag and drop failed when are off Remove extra screen & go to normal state only if widget addition was complete. If a config activity was started, then don't change to remove screen yet or go to normal state. Else, QuickStepLauncher clears the existing activity open requests when going to normal state. When animations are off, this led to config activity to never launch and hence, such widgets not being added. Bug: 369422714 Test: Manual Flag: EXEMPT BUGFIX Change-Id: I4e7e29fd998a0cc5ca18a7a48b91a5b788a60a52 --- src/com/android/launcher3/Launcher.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index b0ec9b0573..200d5a78d0 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1872,13 +1872,18 @@ public class Launcher extends StatefulActivity } } - // Exit spring loaded mode if necessary after adding the widget - Runnable onComplete = MULTI_SELECT_EDIT_MODE.get() ? null - : () -> mStateManager.goToState(NORMAL, SPRING_LOADED_EXIT_DELAY); + // Exit spring loaded mode if necessary after adding the widget; unless config activity was + // started. + Runnable onComplete = MULTI_SELECT_EDIT_MODE.get() ? null : () -> mStateManager.goToState( + NORMAL, SPRING_LOADED_EXIT_DELAY); completeAddAppWidget(appWidgetId, info, boundWidget, addFlowHandler.getProviderInfo(this), addFlowHandler.needsConfigure(), false, widgetPreviewBitmap); - mWorkspace.removeExtraEmptyScreenDelayed(delay, false, onComplete); + // Remove extra screen if widget drop concluded. If a config activity was started, extra + // screen will be removed when we get back its result. + if (!isActivityStarted) { + mWorkspace.removeExtraEmptyScreenDelayed(delay, false, onComplete); + } } public void addPendingItem(PendingAddItemInfo info, int container, int screenId,