Clear the promise flag once the restore animation is run
and no more restore related tasks are pending

issue: 17214102

Change-Id: I54c486ff001d74b4961f85947f41848cf92243a3
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 869b0ac..d83f81d 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -415,8 +415,10 @@
                 }
 
                 preloadDrawable.setLevel(progressLevel);
-                if (state == ShortcutInfo.PACKAGE_STATE_DEFAULT) {
-                    preloadDrawable.maybePerformFinishedAnimation();
+                if ((state == ShortcutInfo.PACKAGE_STATE_DEFAULT) && info.wasPromise) {
+                    // Clear the promise flag as it is no longer different than a normal shortcut,
+                    // once the animation has been run.
+                    info.wasPromise = !preloadDrawable.maybePerformFinishedAnimation();
                 }
 
             }
diff --git a/src/com/android/launcher3/PreloadIconDrawable.java b/src/com/android/launcher3/PreloadIconDrawable.java
index 2972c4f..1b2d5a4 100644
--- a/src/com/android/launcher3/PreloadIconDrawable.java
+++ b/src/com/android/launcher3/PreloadIconDrawable.java
@@ -189,10 +189,11 @@
 
     /**
      * Runs the finish animation if it is has not been run after last level change.
+     * @return true if the animation was run.
      */
-    public void maybePerformFinishedAnimation() {
+    public boolean maybePerformFinishedAnimation() {
         if (mAnimationProgress > ANIMATION_PROGRESS_STOPPED) {
-            return;
+            return false;
         }
         if (mAnimator != null) {
             mAnimator.cancel();
@@ -201,6 +202,7 @@
         mAnimator = ObjectAnimator.ofFloat(this, "animationProgress",
                 ANIMATION_PROGRESS_STARTED, ANIMATION_PROGRESS_COMPLETED);
         mAnimator.start();
+        return true;
     }
 
     public void setAnimationProgress(float progress) {