Merge "Enable unpausing apps from the workspace." into sc-dev
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index 8c3d453..4ba0ee0 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -271,9 +271,7 @@
             });
         } else if (tag instanceof WorkspaceItemInfo) {
             WorkspaceItemInfo info = (WorkspaceItemInfo) tag;
-            if (info.isDisabled()) {
-                ItemClickHandler.handleDisabledItemClicked(info, this);
-            } else {
+            if (!(info.isDisabled() && ItemClickHandler.handleDisabledItemClicked(info, this))) {
                 Intent intent = new Intent(info.getIntent())
                         .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 try {
diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java
index b5dcd3a..b53f96e 100644
--- a/src/com/android/launcher3/touch/ItemClickHandler.java
+++ b/src/com/android/launcher3/touch/ItemClickHandler.java
@@ -196,8 +196,10 @@
 
     /**
      * Handles clicking on a disabled shortcut
+     *
+     * @return true iff the disabled item click has been handled.
      */
-    public static void handleDisabledItemClicked(WorkspaceItemInfo shortcut, Context context) {
+    public static boolean handleDisabledItemClicked(WorkspaceItemInfo shortcut, Context context) {
         final int disabledFlags = shortcut.runtimeStatusFlags
                 & WorkspaceItemInfo.FLAG_DISABLED_MASK;
         if ((disabledFlags
@@ -205,11 +207,12 @@
                 & ~FLAG_DISABLED_QUIET_USER) == 0) {
             // If the app is only disabled because of the above flags, launch activity anyway.
             // Framework will tell the user why the app is suspended.
+            return false;
         } else {
             if (!TextUtils.isEmpty(shortcut.disabledMessage)) {
                 // Use a message specific to this shortcut, if it has one.
                 Toast.makeText(context, shortcut.disabledMessage, Toast.LENGTH_SHORT).show();
-                return;
+                return true;
             }
             // Otherwise just use a generic error message.
             int error = R.string.activity_not_available;
@@ -220,6 +223,7 @@
                 error = R.string.shortcut_not_available;
             }
             Toast.makeText(context, error, Toast.LENGTH_SHORT).show();
+            return true;
         }
     }
 
@@ -229,8 +233,7 @@
      * @param v The view that was clicked. Must be a tagged with a {@link WorkspaceItemInfo}.
      */
     public static void onClickAppShortcut(View v, WorkspaceItemInfo shortcut, Launcher launcher) {
-        if (shortcut.isDisabled()) {
-            handleDisabledItemClicked(shortcut, launcher);
+        if (shortcut.isDisabled() && handleDisabledItemClicked(shortcut, launcher)) {
             return;
         }