Disabling auto-advance when we are not on the workspace. (3413510)

Change-Id: I3793d4221b4ec91ed1fbf35a9e5ff0237e7e8542
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index faf9bc6..7e69681 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2919,6 +2919,10 @@
         // Change the state *after* we've called all the transition code
         mState = State.ALL_APPS;
 
+        // Pause the auto-advance of widgets until we are out of AllApps
+        mUserPresent = false;
+        updateRunning();
+
         // send an accessibility event to announce the context change
         getWindow().getDecorView().sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
     }
@@ -2944,6 +2948,10 @@
         // Change the state *after* we've called all the transition code
         mState = State.WORKSPACE;
 
+        // Resume the auto-advance of widgets
+        mUserPresent = true;
+        updateRunning();
+
         // send an accessibility event to announce the context change
         getWindow().getDecorView().sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
     }
@@ -3044,6 +3052,10 @@
         }
         // Change the state *after* we've called all the transition code
         mState = State.CUSTOMIZE;
+
+        // Pause the auto-advance of widgets until we are out of Customization drawer
+        mUserPresent = false;
+        updateRunning();
     }
 
     // Hide the customization drawer (only exists in x-large configuration)