summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/AppInfo.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/AppInfo.java')
-rw-r--r--src/com/android/launcher3/AppInfo.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/com/android/launcher3/AppInfo.java b/src/com/android/launcher3/AppInfo.java
index 6d1350a59..d14b0e086 100644
--- a/src/com/android/launcher3/AppInfo.java
+++ b/src/com/android/launcher3/AppInfo.java
@@ -62,6 +62,7 @@ public class AppInfo extends ItemInfo {
static final int DOWNLOADED_FLAG = 1;
static final int UPDATED_SYSTEM_APP_FLAG = 2;
+ static final int REMOTE_APP_FLAG = 4;
int flags = 0;
@@ -92,6 +93,15 @@ public class AppInfo extends ItemInfo {
this.user = user;
}
+ public AppInfo(Intent intent, String title, UserHandleCompat user) {
+ this.componentName = intent.getComponent();
+ this.container = ItemInfo.NO_ID;
+
+ this.intent = intent;
+ this.title = title;
+ this.user = user;
+ }
+
public static int initFlags(LauncherActivityInfoCompat info) {
int appFlags = info.getApplicationInfo().flags;
int flags = 0;
@@ -128,6 +138,23 @@ public class AppInfo extends ItemInfo {
iconBitmap = info.iconBitmap;
}
+ /**
+ * Check if this app has a specific flag.
+ * @param flag flag to check.
+ * @return true if the flag is present, false otherwise.
+ */
+ public boolean hasFlag(int flag) {
+ return (flags & flag) != 0;
+ }
+
+ /**
+ * Set a flag for this app
+ * @param flag flag to apply.
+ */
+ public void setFlag(int flag) {
+ flags |= flag;
+ }
+
@Override
public String toString() {
return "ApplicationInfo(title=" + title.toString() + " id=" + this.id
@@ -159,4 +186,18 @@ public class AppInfo extends ItemInfo {
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED)
.putExtra(EXTRA_PROFILE, serialNumber);
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (o != null && o instanceof AppInfo) {
+ return componentName.equals(((AppInfo) o).componentName);
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return componentName.hashCode();
+ }
}