diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index fdef39f2eb..ba6f1651ed 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -197,6 +197,10 @@ public class LauncherTaskbarUIController extends TaskbarUIController { return mTaskbarLauncherStateController.applyState(fromInit ? 0 : duration, startAnimation); } + public void refreshResumedState() { + onLauncherResumedOrPaused(mLauncher.hasBeenResumed()); + } + /** * Create Taskbar animation when going from an app to Launcher as part of recents transition. * @param toState If known, the state we will end up in when reaching Launcher. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index 4422fd4b75..d6e559a9b4 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -33,11 +33,13 @@ import android.view.WindowInsets.Type.tappableElement import android.view.WindowManager import android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD import android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION +import androidx.core.graphics.toRegion import com.android.internal.policy.GestureNavigationSettingsObserver import com.android.launcher3.DeviceProfile import com.android.launcher3.R import com.android.launcher3.anim.AlphaUpdateListener import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController +import com.android.launcher3.util.DisplayController import java.io.PrintWriter /** Handles the insets that Taskbar provides to underlying apps and the IME. */ @@ -220,7 +222,16 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas controllers.taskbarViewController.areIconsVisible() || context.isNavBarKidsModeActive ) { // Taskbar has some touchable elements, take over the full taskbar area - insetsInfo.touchableRegion.set(touchableRegion) + if ( + controllers.uiController.isInOverview && + DisplayController.isTransientTaskbar(context) + ) { + insetsInfo.touchableRegion.set( + controllers.taskbarActivityContext.dragLayer.lastDrawnTransientRect.toRegion() + ) + } else { + insetsInfo.touchableRegion.set(touchableRegion) + } insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) insetsIsTouchableRegion = false } else { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 75cfd05d41..dfbd5bbfd1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -207,10 +207,6 @@ public class TaskbarLauncherStateController { com.android.launcher3.taskbar.Utilities.setOverviewDragState( mControllers, finalState.disallowTaskbarGlobalDrag(), disallowLongClick, finalState.allowTaskbarInitialSplitSelection()); - // LauncherTaskbarUIController depends on the state when checking whether - // to handle resume, so it should also be poked if current state changes - mLauncher.getTaskbarUIController().onLauncherResumedOrPaused( - mLauncher.hasBeenResumed()); } }; @@ -424,6 +420,10 @@ public class TaskbarLauncherStateController { // We're changing state to home, should close open popups e.g. Taskbar AllApps handleOpenFloatingViews = true; } + if (mLauncherState == LauncherState.OVERVIEW) { + // Calling to update the insets in TaskbarInsetController#updateInsetsTouchability + mControllers.taskbarActivityContext.notifyUpdateLayoutParams(); + } } if (hasAnyFlag(changedFlags, FLAGS_LAUNCHER_ACTIVE)) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java index f3e2ee2e9d..f3513fdb97 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java @@ -318,4 +318,9 @@ public class TaskbarUIController { } return null; } + + /** + * Refreshes the resumed state of this ui controller. + */ + public void refreshResumedState() {} } diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 7d47945fc4..b49eb24971 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -334,6 +334,7 @@ public abstract class AbsSwipeUpHandler, private boolean mCanSlowSwipeGoHome = true; // Indicates whether the divider is shown, only used when split screen is activated. private boolean mIsDividerShown = true; + private boolean mStartMovingTasks; @Nullable private RemoteAnimationTargets.ReleaseCheck mSwipePipToHomeReleaseCheck = null; @@ -1722,12 +1723,19 @@ public abstract class AbsSwipeUpHandler, return keepClearArea; } + /** + * Notifies to start intercepting touches in the app window and hide the divider bar if needed. + * @see RecentsAnimationController#enableInputConsumer() + */ private void startInterceptingTouchesForGesture() { - if (mRecentsAnimationController == null) { + if (mRecentsAnimationController == null || !mStartMovingTasks) { return; } mRecentsAnimationController.enableInputConsumer(); + + // Hide the divider as it starts intercepting touches in the app window. + setDividerShown(false); } private void computeRecentsScrollIfInvisible() { @@ -2339,9 +2347,9 @@ public abstract class AbsSwipeUpHandler, boolean setRecentsScroll = mRecentsViewScrollLinked && mRecentsView != null; float progress = Math.max(mCurrentShift.value, getScaleProgressDueToScroll()); int scrollOffset = setRecentsScroll ? mRecentsView.getScrollOffset() : 0; - if (progress > 0 || scrollOffset != 0) { - // Hide the divider as the tasks start moving. - setDividerShown(false); + if (!mStartMovingTasks && (progress > 0 || scrollOffset != 0)) { + mStartMovingTasks = true; + startInterceptingTouchesForGesture(); } for (RemoteTargetHandle remoteHandle : mRemoteTargetHandles) { AnimatorControllerWithResistance playbackController = diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java index d3e4ce5db8..64ec1d8a6d 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java @@ -58,6 +58,7 @@ import android.os.SystemProperties; import android.os.UserManager; import android.provider.Settings; import android.view.MotionEvent; +import android.view.ViewConfiguration; import androidx.annotation.BinderThread; import androidx.annotation.NonNull; @@ -87,6 +88,10 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener { static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode"; + // TODO: Move to quickstep contract + private static final float QUICKSTEP_TOUCH_SLOP_RATIO_TWO_BUTTON = 9; + private static final float QUICKSTEP_TOUCH_SLOP_RATIO_GESTURAL = 2; + private final Context mContext; private final DisplayController mDisplayController; private final int mDisplayId; @@ -577,6 +582,19 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener { && ((mSystemUiStateFlags & SYSUI_STATE_IME_SHOWING) != 0); } + /** + * Returns the touch slop for {@link InputConsumer}s to compare against before pilfering + * pointers. Note that this is squared because it expects to be compared against + * {@link com.android.launcher3.Utilities#squaredHypot} (to avoid square root on each event). + */ + public float getSquaredTouchSlop() { + float slopMultiplier = isFullyGesturalNavMode() + ? QUICKSTEP_TOUCH_SLOP_RATIO_GESTURAL + : QUICKSTEP_TOUCH_SLOP_RATIO_TWO_BUTTON; + float touchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop(); + return slopMultiplier * touchSlop * touchSlop; + } + public String getSystemUiStateString() { return QuickStepContract.getSystemUiStateString(mSystemUiStateFlags); } diff --git a/quickstep/src/com/android/quickstep/TopTaskTracker.java b/quickstep/src/com/android/quickstep/TopTaskTracker.java index 6f502d0ece..24cf72c718 100644 --- a/quickstep/src/com/android/quickstep/TopTaskTracker.java +++ b/quickstep/src/com/android/quickstep/TopTaskTracker.java @@ -127,23 +127,16 @@ public class TopTaskTracker extends ISplitScreenListener.Stub implements TaskSta @Override public void onTaskStageChanged(int taskId, @StageType int stage, boolean visible) { - // If task is not visible but we are tracking it, stop tracking it - if (!visible) { + // If a task is not visible anymore or has been moved to undefined, stop tracking it. + if (!visible || stage == SplitConfigurationOptions.STAGE_TYPE_UNDEFINED) { if (mMainStagePosition.taskId == taskId) { - resetTaskId(mMainStagePosition); + mMainStagePosition.taskId = INVALID_TASK_ID; } else if (mSideStagePosition.taskId == taskId) { - resetTaskId(mSideStagePosition); + mSideStagePosition.taskId = INVALID_TASK_ID; } // else it's an un-tracked child return; } - // If stage has moved to undefined, stop tracking the task - if (stage == SplitConfigurationOptions.STAGE_TYPE_UNDEFINED) { - resetTaskId(taskId == mMainStagePosition.taskId - ? mMainStagePosition : mSideStagePosition); - return; - } - if (stage == SplitConfigurationOptions.STAGE_TYPE_MAIN) { mMainStagePosition.taskId = taskId; } else { @@ -161,10 +154,6 @@ public class TopTaskTracker extends ISplitScreenListener.Stub implements TaskSta mPinnedTaskId = INVALID_TASK_ID; } - private void resetTaskId(SplitStageInfo taskPosition) { - taskPosition.taskId = -1; - } - /** * @return index 0 will be task in left/top position, index 1 in right/bottom position. * Will return empty array if device is not in staged split diff --git a/quickstep/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java index 42a74d9251..59a9582c1f 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java @@ -20,7 +20,6 @@ import static android.view.MotionEvent.ACTION_POINTER_DOWN; import static android.view.MotionEvent.ACTION_UP; import static com.android.launcher3.Utilities.squaredHypot; -import static com.android.launcher3.Utilities.squaredTouchSlop; import static com.android.launcher3.util.VelocityUtils.PX_PER_MS; import static com.android.quickstep.AbsSwipeUpHandler.MIN_PROGRESS_FOR_OVERVIEW; import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; @@ -115,7 +114,7 @@ public class DeviceLockedInputConsumer implements InputConsumer, mDeviceState = deviceState; mTaskAnimationManager = taskAnimationManager; mGestureState = gestureState; - mTouchSlopSquared = squaredTouchSlop(context); + mTouchSlopSquared = mDeviceState.getSquaredTouchSlop(); mTransformParams = new TransformParams(); mInputMonitorCompat = inputMonitorCompat; mMaxTranslationY = context.getResources().getDimensionPixelSize( diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java index d7ed79ba0a..5387c8a852 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/OneHandedModeInputConsumer.java @@ -21,8 +21,8 @@ import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_MOVE; import static android.view.MotionEvent.ACTION_UP; -import static com.android.launcher3.testing.shared.ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE; import static com.android.launcher3.Utilities.squaredHypot; +import static com.android.launcher3.testing.shared.ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE; import android.content.Context; import android.graphics.Point; @@ -31,7 +31,6 @@ import android.view.MotionEvent; import com.android.launcher3.R; import com.android.launcher3.testing.shared.ResourceUtils; -import com.android.launcher3.Utilities; import com.android.launcher3.util.DisplayController; import com.android.quickstep.InputConsumer; import com.android.quickstep.RecentsAnimationDeviceState; @@ -69,7 +68,7 @@ public class OneHandedModeInputConsumer extends DelegateInputConsumer { mDeviceState = deviceState; mDragDistThreshold = context.getResources().getDimensionPixelSize( R.dimen.gestures_onehanded_drag_threshold); - mSquaredSlop = Utilities.squaredTouchSlop(context); + mSquaredSlop = mDeviceState.getSquaredTouchSlop(); mDisplaySize = DisplayController.INSTANCE.get(mContext).getInfo().currentSize; mNavBarSize = ResourceUtils.getNavbarSize(NAVBAR_BOTTOM_GESTURE_SIZE, mContext.getResources()); diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java index 2dcbbb907a..f9cd4ee1cd 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java @@ -80,10 +80,6 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC public static final String DOWN_EVT = "OtherActivityInputConsumer.DOWN"; private static final String UP_EVT = "OtherActivityInputConsumer.UP"; - // TODO: Move to quickstep contract - public static final float QUICKSTEP_TOUCH_SLOP_RATIO_TWO_BUTTON = 9; - public static final float QUICKSTEP_TOUCH_SLOP_RATIO_GESTURAL = 2; - // Minimum angle of a gesture's coordinate where a release goes to overview. public static final int OVERVIEW_MIN_DEGREES = 15; @@ -157,11 +153,8 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC boolean continuingPreviousGesture = mTaskAnimationManager.isRecentsAnimationRunning(); mIsDeferredDownTarget = !continuingPreviousGesture && isDeferredDownTarget; - float slopMultiplier = mDeviceState.isFullyGesturalNavMode() - ? QUICKSTEP_TOUCH_SLOP_RATIO_GESTURAL - : QUICKSTEP_TOUCH_SLOP_RATIO_TWO_BUTTON; mTouchSlop = ViewConfiguration.get(this).getScaledTouchSlop(); - mSquaredTouchSlop = slopMultiplier * mTouchSlop * mTouchSlop; + mSquaredTouchSlop = mDeviceState.getSquaredTouchSlop(); mPassedPilferInputSlop = mPassedWindowMoveSlop = continuingPreviousGesture; mDisableHorizontalSwipe = !mPassedPilferInputSlop && disableHorizontalSwipe; diff --git a/quickstep/src/com/android/quickstep/inputconsumers/TaskbarUnstashInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/TaskbarUnstashInputConsumer.java index 65c825c0f6..fbe7fde236 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/TaskbarUnstashInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/TaskbarUnstashInputConsumer.java @@ -81,6 +81,7 @@ public class TaskbarUnstashInputConsumer extends DelegateInputConsumer { InputMonitorCompat inputMonitor, TaskbarActivityContext taskbarActivityContext) { super(delegate, inputMonitor); mTaskbarActivityContext = taskbarActivityContext; + // TODO(b/270395798): remove this when cleaning up old Persistent Taskbar code. mSquaredTouchSlop = Utilities.squaredTouchSlop(context); mScreenWidth = taskbarActivityContext.getDeviceProfile().widthPx; diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index 134ef6cce3..d57070847b 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -849,6 +849,13 @@ public class TaskView extends FrameLayout implements Reusable { // QuickstepTransitionManager.createWallpaperOpenAnimations when launcher // shows again getRecentsView().startHome(false /* animated */); + RecentsView rv = getRecentsView(); + if (rv != null && rv.mSizeStrategy.getTaskbarController() != null) { + // LauncherTaskbarUIController depends on the launcher state when checking + // whether to handle resume, but that can come in before startHome() changes + // the state, so force-refresh here to ensure the taskbar is updated + rv.mSizeStrategy.getTaskbarController().refreshResumedState(); + } }); } // Indicate success once the system has indicated that the transition has started diff --git a/quickstep/tests/src/com/android/quickstep/AbstractTaplTestsTaskbar.java b/quickstep/tests/src/com/android/quickstep/AbstractTaplTestsTaskbar.java index 9c0b2bf312..4ca3563f68 100644 --- a/quickstep/tests/src/com/android/quickstep/AbstractTaplTestsTaskbar.java +++ b/quickstep/tests/src/com/android/quickstep/AbstractTaplTestsTaskbar.java @@ -23,6 +23,7 @@ import android.content.Context; import android.content.Intent; import com.android.launcher3.tapl.LauncherInstrumentation; +import com.android.launcher3.tapl.Overview; import com.android.launcher3.tapl.Taskbar; import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.ui.TaplTestsLauncher3; @@ -57,7 +58,10 @@ public class AbstractTaplTestsTaskbar extends AbstractQuickStepTest { "com.android.launcher3.testcomponent.BaseTestingActivity"); mLauncherLayout = TestUtil.setLauncherDefaultLayout(mTargetContext, layoutBuilder); TaplTestsLauncher3.initialize(this); - + Overview overview = mLauncher.getWorkspace().switchToOverview(); + if (overview.hasTasks()) { + overview.dismissAllTasks(); + } startAppFast(CALCULATOR_APP_PACKAGE); mLauncher.enableBlockTimeout(true); mLauncher.showTaskbarIfHidden(); @@ -65,7 +69,6 @@ public class AbstractTaplTestsTaskbar extends AbstractQuickStepTest { @After public void tearDown() throws Exception { - setTaskbarMode(mLauncher, mTaskbarWasInTransientMode); mLauncher.enableBlockTimeout(false); if (mLauncherLayout != null) { mLauncherLayout.close(); diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsPersistentTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsPersistentTaskbar.java index ee0eeb2d73..1b5313bad0 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsPersistentTaskbar.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsPersistentTaskbar.java @@ -29,13 +29,6 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class TaplTestsPersistentTaskbar extends AbstractTaplTestsTaskbar { - @Override - public void setUp() throws Exception { - mTaskbarWasInTransientMode = isTaskbarInTransientMode(mTargetContext); - setTaskbarMode(mLauncher, false); - super.setUp(); - } - @Test @TaskbarModeSwitch(mode = PERSISTENT) public void testHideShowTaskbar() { diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java index 021e118937..40be4806ec 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java @@ -20,7 +20,6 @@ import static com.android.quickstep.TaplTestsTaskbar.TaskbarMode.TRANSIENT; import androidx.test.filters.LargeTest; -import com.android.launcher3.tapl.LauncherInstrumentation; import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import org.junit.Test; @@ -58,14 +57,19 @@ public class TaplTestsTaskbar extends AbstractTaplTestsTaskbar { super.setUp(); } + @Override + public void tearDown() throws Exception { + setTaskbarMode(mLauncher, mTaskbarWasInTransientMode); + super.tearDown(); + } + @Test public void testLaunchApp() { getTaskbar().getAppIcon(TEST_APP_NAME).launch(TEST_APP_PACKAGE); // We are using parameterized test runner to share code between different test cases with // taskbar variants. But, sometimes we only need to assert things for particular Taskbar // variants. - if (isTaskbarTestModeTransient() && mLauncher.getNavigationModel() - != LauncherInstrumentation.NavigationModel.THREE_BUTTON) { + if (isTaskbarTestModeTransient()) { mLauncher.getLaunchedAppState().assertTaskbarHidden(); } } diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java index 6b61f1884e..b58fe29a96 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java @@ -32,13 +32,6 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class TaplTestsTransientTaskbar extends AbstractTaplTestsTaskbar { - @Override - public void setUp() throws Exception { - mTaskbarWasInTransientMode = isTaskbarInTransientMode(mTargetContext); - setTaskbarMode(mLauncher, true); - super.setUp(); - } - @Test @TaskbarModeSwitch(mode = TRANSIENT) public void testShowTaskbarUnstashHintOnHover() { diff --git a/src/com/android/launcher3/allapps/WorkProfileManager.java b/src/com/android/launcher3/allapps/WorkProfileManager.java index bf36e02dad..a671c6efec 100644 --- a/src/com/android/launcher3/allapps/WorkProfileManager.java +++ b/src/com/android/launcher3/allapps/WorkProfileManager.java @@ -97,7 +97,11 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP StatsLogManager statsLogManager) { mUserManager = userManager; mAllApps = allApps; - if (FeatureFlags.ENABLE_APP_CLONING_CHANGES_IN_LAUNCHER.get()) { + boolean cloningChanges = FeatureFlags.ENABLE_APP_CLONING_CHANGES_IN_LAUNCHER.get(); + if (TestProtocol.sDebugTracing) { + Log.d(WORK_TAB_MISSING, "matcher flag: " + cloningChanges); + } + if (cloningChanges) { mMatcher = ofWorkProfileUser(userManager); } else { mMatcher = mAllApps.mPersonalMatcher.negate(); diff --git a/src/com/android/launcher3/model/PackageUpdatedTask.java b/src/com/android/launcher3/model/PackageUpdatedTask.java index d4a5e1b9d9..8c938f4124 100644 --- a/src/com/android/launcher3/model/PackageUpdatedTask.java +++ b/src/com/android/launcher3/model/PackageUpdatedTask.java @@ -95,7 +95,7 @@ public class PackageUpdatedTask extends BaseModelUpdateTask { mPackages = packages; if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.WORK_TAB_MISSING, "PackageUpdatedTask mOp: " + mOp + - " packageCount: " + mPackages.length); + " packageCount: " + mPackages.length + " user: " + user); DEBUG = true; } } diff --git a/src/com/android/launcher3/statemanager/StateManager.java b/src/com/android/launcher3/statemanager/StateManager.java index 89d89d6eca..198dad3c89 100644 --- a/src/com/android/launcher3/statemanager/StateManager.java +++ b/src/com/android/launcher3/statemanager/StateManager.java @@ -229,8 +229,10 @@ public class StateManager> { listener.onAnimationEnd(null); } return; - } else if (!mConfig.userControlled && animated && mConfig.targetState == state) { - // We are running the same animation as requested + } else if ((!mConfig.userControlled && animated && mConfig.targetState == state) + || mState.shouldPreserveDataStateOnReapply()) { + // We are running the same animation as requested, and/or target state should not be + // reset -- allow the current animation to complete instead of canceling it. if (listener != null) { mConfig.currentAnimation.addListener(listener); } diff --git a/src/com/android/launcher3/util/ItemInfoMatcher.java b/src/com/android/launcher3/util/ItemInfoMatcher.java index b6af3140fa..8a27381a0b 100644 --- a/src/com/android/launcher3/util/ItemInfoMatcher.java +++ b/src/com/android/launcher3/util/ItemInfoMatcher.java @@ -18,6 +18,7 @@ package com.android.launcher3.util; import android.content.ComponentName; import android.os.UserHandle; +import android.util.Log; import androidx.annotation.NonNull; @@ -25,6 +26,7 @@ import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.model.data.FolderInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.shortcuts.ShortcutKey; +import com.android.launcher3.testing.shared.TestProtocol; import java.util.Collection; import java.util.HashSet; @@ -42,7 +44,14 @@ public abstract class ItemInfoMatcher { private static final ComponentName EMPTY_COMPONENT = new ComponentName("", ""); public static Predicate ofUser(UserHandle user) { - return info -> info != null && info.user.equals(user); + return info -> { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.WORK_TAB_MISSING, "userHandle: " + user + + ", itemUserHandle: " + info.user + + " package: " + info.getTargetPackage()); + } + return info != null && info.user.equals(user); + }; } public static Predicate ofComponents(