Merge "Updating the scrim and landscpae ui" into ub-launcher3-master
diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml
index 02b4379..d531a46 100644
--- a/quickstep/AndroidManifest.xml
+++ b/quickstep/AndroidManifest.xml
@@ -36,8 +36,13 @@
         android:restoreAnyVersion="true"
         android:supportsRtl="true" >
 
-        <service android:name="com.android.quickstep.TouchInteractionService"
-            android:exported="true" />
+        <service
+            android:name="com.android.quickstep.TouchInteractionService"
+            android:permission="android.permission.STATUS_BAR_SERVICE" >
+            <intent-filter>
+                <action android:name="android.intent.action.QUICKSTEP_SERVICE" />
+            </intent-filter>
+        </service>
 
         <!-- STOPSHIP: Change exported to false once all the integration is complete.
         It is set to true so that the activity can be started from command line -->
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index 2f8687d..d5813f3 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -162,13 +162,26 @@
     }
 
     public void goToState(LauncherState state, boolean animated, long delay, long overrideDuration,
-            Runnable onCompleteRunnable) {
-        if (mLauncher.isInState(state) && mConfig.mCurrentAnimation == null) {
-            // Run any queued runnable
-            if (onCompleteRunnable != null) {
-                onCompleteRunnable.run();
+            final Runnable onCompleteRunnable) {
+        if (mLauncher.isInState(state)) {
+            if (mConfig.mCurrentAnimation == null) {
+                // Run any queued runnable
+                if (onCompleteRunnable != null) {
+                    onCompleteRunnable.run();
+                }
+                return;
+            } else if (!mConfig.userControlled && animated) {
+                // We are running the same animation as requested
+                if (onCompleteRunnable != null) {
+                    mConfig.mCurrentAnimation.addListener(new AnimationSuccessListener() {
+                        @Override
+                        public void onAnimationSuccess(Animator animator) {
+                            onCompleteRunnable.run();
+                        }
+                    });
+                }
+                return;
             }
-            return;
         }
 
         // Cancel the current animation