Merge "Revert "Revert Cls stopping now-master running on googlefood"" into ub-now-master
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b7f4505..3bf6c8d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -285,13 +285,10 @@
     <!-- Button for abandoned promise dialog, to search in the market for the missing package. -->
     <string name="abandoned_search">Search</string>
     <!-- Title for abandoned promise dialog. -->
-    <string name="abandoned_promises_title">This Package is not Installed</string>
-    <!-- Explanation for abandoned promise dialog. -->
-    <plurals name="abandoned_promises_explanation">
-        <item quantity="one">The package for this icon is not installed.  You many remove it, or
-            attempt to search for the package and install it manually.</item>
-        <item quantity="other">The package for this icon is not installed.  You many remove all
-            similarly broken icons, remove only this icon, or attempt to search for the package and
-            install it manually.</item>
-    </plurals>
+    <string name="abandoned_promises_title">This app is not installed</string>
+    <!-- Explanation for abandoned promise dialog. "The first 'it' refers to the shortcut icon.
+    The second "it" refers to the app. -->
+    <string name="abandoned_promise_explanation">The app for this icon isn\'t installed.
+        You can remove it, or search for the app and install it manually.
+    </string>
 </resources>
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index f8c38ec..93a7807 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2545,12 +2545,9 @@
 
         // Check for abandoned promise
         if (shortcut.isAbandoned() && v instanceof BubbleTextView) {
-            final ArrayList<BubbleTextView> abandoned =
-                    mWorkspace.getAbandonedPromises(new ArrayList<BubbleTextView>());
             AlertDialog.Builder builder = new AlertDialog.Builder(this);
             builder.setTitle(R.string.abandoned_promises_title);
-            builder.setMessage(getResources().getQuantityString(
-                    R.plurals.abandoned_promises_explanation, abandoned.size()));
+            builder.setMessage(R.string.abandoned_promise_explanation);
             builder.setPositiveButton(R.string.abandoned_search,
                     new DialogInterface.OnClickListener() {
                         public void onClick(DialogInterface dialog, int id) {
@@ -2558,16 +2555,6 @@
                         }
                     }
             );
-            if (abandoned.size() > 1) {
-                builder.setNegativeButton(R.string.abandoned_clean_all,
-                        new DialogInterface.OnClickListener() {
-                            public void onClick(DialogInterface dialog, int id) {
-                                final UserHandleCompat user = UserHandleCompat.myUserHandle();
-                                mWorkspace.removeAbandonedPromises(abandoned, user);
-                            }
-                        }
-                );
-            }
             builder.setNeutralButton(R.string.abandoned_clean_this,
                     new DialogInterface.OnClickListener() {
                         public void onClick(DialogInterface dialog, int id) {
diff --git a/src/com/android/launcher3/LauncherClings.java b/src/com/android/launcher3/LauncherClings.java
index 1176aa5..00586bd 100644
--- a/src/com/android/launcher3/LauncherClings.java
+++ b/src/com/android/launcher3/LauncherClings.java
@@ -29,6 +29,7 @@
 import android.graphics.Rect;
 import android.os.Bundle;
 import android.os.UserManager;
+import android.provider.Settings;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -48,6 +49,9 @@
     private static final int SHOW_CLING_DURATION = 250;
     private static final int DISMISS_CLING_DURATION = 200;
 
+    // New Secure Setting in L
+    private static final String SKIP_FIRST_USE_HINTS = "skip_first_use_hints";
+
     private Launcher mLauncher;
     private LayoutInflater mInflater;
     private HideFromAccessibilityHelper mHideFromAccessibilityHelper
@@ -107,6 +111,10 @@
                 return false;
             }
         }
+        if (Settings.Secure.getInt(mLauncher.getContentResolver(), SKIP_FIRST_USE_HINTS, 0)
+                == 1) {
+            return false;
+        }
         return true;
     }
 
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 550b203..48795af 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -4858,38 +4858,16 @@
         });
     }
 
-    ArrayList<BubbleTextView> getAbandonedPromises(final ArrayList<BubbleTextView> abandoned) {
-        mapOverShortcuts(Workspace.MAP_RECURSE, new Workspace.ShortcutOperator() {
-            @Override
-            public boolean evaluate(ItemInfo info, View view, View parent) {
-                if (info instanceof ShortcutInfo
-                        && ((ShortcutInfo) info).isAbandoned()
-                        && view instanceof BubbleTextView) {
-                    abandoned.add((BubbleTextView) view);
-                }
-                return false;
-            }
-        });
-        return abandoned;
-    }
-    public void removeAbandonedPromise(BubbleTextView view, UserHandleCompat user) {
-        ArrayList<BubbleTextView> views = new ArrayList<BubbleTextView>(1);
-        views.add(view);
-        removeAbandonedPromises(views, user);
-    }
-
-    public void removeAbandonedPromises(ArrayList<BubbleTextView> views, UserHandleCompat user) {
-        HashSet<ComponentName> cns = new HashSet<ComponentName>(views.size());
-        for (final BubbleTextView bubble : views) {
-            if (bubble.getTag() != null && bubble.getTag() instanceof ShortcutInfo) {
-                final ShortcutInfo shortcut = (ShortcutInfo) bubble.getTag();
-                if (shortcut.isAbandoned()) {
-                    cns.add(shortcut.getRestoredIntent().getComponent());
-                    LauncherModel.deleteItemFromDatabase(mLauncher, shortcut);
-                }
+    public void removeAbandonedPromise(BubbleTextView abandonedIcon, UserHandleCompat user) {
+        if (abandonedIcon.getTag() != null && abandonedIcon.getTag() instanceof ShortcutInfo) {
+            final ShortcutInfo shortcut = (ShortcutInfo) abandonedIcon.getTag();
+            if (shortcut.isAbandoned()) {
+                HashSet<ComponentName> cns = new HashSet<ComponentName>(1);
+                cns.add(shortcut.getRestoredIntent().getComponent());
+                LauncherModel.deleteItemFromDatabase(mLauncher, shortcut);
+                removeItemsByComponentName(cns, user);
             }
         }
-        removeItemsByComponentName(cns, user);
     }
 
     public void updatePackageState(final String pkgName, final int state) {