summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Utilities.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-05-19 16:03:28 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-05-21 13:34:07 -0700
commit5c97f51fd9443e461a360ff7852aa223c05d667f (patch)
tree1190bccb371f1c5e1792375270a657e6364c896c /src/com/android/launcher3/Utilities.java
parent324d78358c88d30eac587f4e1d679f9b5bf8d2f3 (diff)
downloadandroid_packages_apps_Trebuchet-5c97f51fd9443e461a360ff7852aa223c05d667f.tar.gz
android_packages_apps_Trebuchet-5c97f51fd9443e461a360ff7852aa223c05d667f.tar.bz2
android_packages_apps_Trebuchet-5c97f51fd9443e461a360ff7852aa223c05d667f.zip
Icons are not updated to TYPE_APPLICATION during restore
> Use low res only for app shortcuts > Running icon migration after restore > Running icon migration again for all users > Deduping shortcuts added from widget tray Bug: 20945600 Change-Id: I3bb47545fdd9832510069026fbae8966d2311cc1
Diffstat (limited to 'src/com/android/launcher3/Utilities.java')
-rw-r--r--src/com/android/launcher3/Utilities.java23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 1f8a6f2a5..9f47e138d 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -45,12 +45,15 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.PaintDrawable;
import android.os.Build;
import android.os.Process;
+import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
import android.util.SparseArray;
import android.view.View;
import android.widget.Toast;
+import junit.framework.Assert;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -58,8 +61,6 @@ import java.util.Comparator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import junit.framework.Assert;
-
/**
* Various utilities shared amongst the Launcher's classes.
*/
@@ -650,4 +651,22 @@ public final class Utilities {
Assert.assertTrue(LauncherModel.sWorkerThread.getThreadId() == Process.myTid());
}
}
+
+ /**
+ * Returns true if the intent is a valid launch intent for a launcher activity of an app.
+ * This is used to identify shortcuts which are different from the ones exposed by the
+ * applications' manifest file.
+ *
+ * @param launchIntent The intent that will be launched when the shortcut is clicked.
+ */
+ public static boolean isLauncherAppTarget(Intent launchIntent) {
+ return launchIntent != null
+ && Intent.ACTION_MAIN.equals(launchIntent.getAction())
+ && launchIntent.getComponent() != null
+ && launchIntent.getCategories() != null
+ && launchIntent.getCategories().size() == 1
+ && launchIntent.hasCategory(Intent.CATEGORY_LAUNCHER)
+ && launchIntent.getExtras() == null
+ && TextUtils.isEmpty(launchIntent.getDataString());
+ }
}