Merge "Ensure getNotificationKeysForItem() returns empty on unsupported items." into ub-launcher3-master
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 72dff66..d2008a6 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -2042,14 +2042,18 @@
      */
     public Animator setStateWithAnimation(State toState, boolean animated,
             AnimationLayerSet layerViews) {
-        // Create the animation to the new state
-        AnimatorSet workspaceAnim =  mStateTransitionAnimation.getAnimationToState(mState,
-                toState, animated, layerViews);
+        final State fromState = mState;
 
-        boolean shouldNotifyWidgetChange = !mState.shouldUpdateWidget
-                && toState.shouldUpdateWidget;
         // Update the current state
         mState = toState;
+
+        // Create the animation to the new state
+        AnimatorSet workspaceAnim =  mStateTransitionAnimation.getAnimationToState(fromState,
+                toState, animated, layerViews);
+
+        boolean shouldNotifyWidgetChange = !fromState.shouldUpdateWidget
+                && toState.shouldUpdateWidget;
+
         updateAccessibilityFlags();
 
         if (shouldNotifyWidgetChange) {