summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/ItemInfo.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher2/ItemInfo.java')
-rw-r--r--src/com/android/launcher2/ItemInfo.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/com/android/launcher2/ItemInfo.java b/src/com/android/launcher2/ItemInfo.java
index 11a6c0d00..d34b87e39 100644
--- a/src/com/android/launcher2/ItemInfo.java
+++ b/src/com/android/launcher2/ItemInfo.java
@@ -16,13 +16,14 @@
package com.android.launcher2;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
import android.content.ContentValues;
+import android.content.Intent;
import android.graphics.Bitmap;
import android.util.Log;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
/**
* Represents an item in the launcher.
*/
@@ -109,6 +110,21 @@ class ItemInfo {
container = info.container;
}
+ /** Returns the package name that the intent will resolve to, or an empty string if
+ * none exists. */
+ static String getPackageName(Intent intent) {
+ if (intent != null) {
+ String packageName = intent.getPackage();
+ if (packageName == null) {
+ packageName = intent.getComponent().getPackageName();
+ }
+ if (packageName != null) {
+ return packageName;
+ }
+ }
+ return "";
+ }
+
/**
* Write the fields of this item to the DB
*