summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/ShortcutInfo.java
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2014-06-24 18:24:23 -0400
committerChris Wren <cwren@android.com>2014-06-27 15:17:56 -0400
commit40c5ed303909c4df71037be3429aa1423e59585f (patch)
treeef0d2211280e8539bbd91ec1389ae64525cc450c /src/com/android/launcher3/ShortcutInfo.java
parent9041a98280252abfa1a81065c103ee9a70943af5 (diff)
downloadandroid_packages_apps_Trebuchet-40c5ed303909c4df71037be3429aa1423e59585f.tar.gz
android_packages_apps_Trebuchet-40c5ed303909c4df71037be3429aa1423e59585f.tar.bz2
android_packages_apps_Trebuchet-40c5ed303909c4df71037be3429aa1423e59585f.zip
Offer to delete broken promise icons.
Track state of promise in the info, not the view. Fix bugs around moving promises to folders. Fix bugs around filterign and removing promises. Bug: 12764789 Change-Id: If5e8b6d315e463154b5bafe8aef7ef4f9889bb95
Diffstat (limited to 'src/com/android/launcher3/ShortcutInfo.java')
-rw-r--r--src/com/android/launcher3/ShortcutInfo.java32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/com/android/launcher3/ShortcutInfo.java b/src/com/android/launcher3/ShortcutInfo.java
index f40cf9fa1..a84a90354 100644
--- a/src/com/android/launcher3/ShortcutInfo.java
+++ b/src/com/android/launcher3/ShortcutInfo.java
@@ -36,22 +36,22 @@ import java.util.Arrays;
*/
public class ShortcutInfo extends ItemInfo {
- /** This package is not installed, and there is no other information available. */
+ /** {@link #mState} meaning this package is not installed, and there is no other information. */
public static final int PACKAGE_STATE_UNKNOWN = -2;
- /** This package is not installed, because installation failed. */
+ /** {@link #mState} meaning this package is not installed, because installation failed. */
public static final int PACKAGE_STATE_ERROR = -1;
- /** This package is installed. This is the typical case */
+ /** {@link #mState} meaning this package is installed. This is the typical case. */
public static final int PACKAGE_STATE_DEFAULT = 0;
- /** This package is not installed, but some external entity has promised to install it. */
+ /** {@link #mState} meaning some external entity has promised to install this package. */
public static final int PACKAGE_STATE_ENQUEUED = 1;
- /** This package is not installed, but some external entity is downloading it. */
+ /** {@link #mState} meaning but some external entity is downloading this package. */
public static final int PACKAGE_STATE_DOWNLOADING = 2;
- /** This package is not installed, but some external entity is installing it. */
+ /** {@link #mState} meaning some external entity is installing this package. */
public static final int PACKAGE_STATE_INSTALLING = 3;
/**
@@ -82,6 +82,11 @@ public class ShortcutInfo extends ItemInfo {
*/
private Bitmap mIcon;
+ /**
+ * The installation state of the package that this shortcut represents.
+ */
+ protected int mState;
+
long firstInstallTime;
int flags = 0;
@@ -110,6 +115,7 @@ public class ShortcutInfo extends ItemInfo {
if (restoredIntent != null) {
intent = restoredIntent;
restoredIntent = null;
+ mState = PACKAGE_STATE_DEFAULT;
}
}
@@ -218,5 +224,19 @@ public class ShortcutInfo extends ItemInfo {
&& pkgName != null
&& pkgName.equals(restoredIntent.getComponent().getPackageName());
}
+
+ public boolean isAbandoned() {
+ return isPromise()
+ && (mState == ShortcutInfo.PACKAGE_STATE_ERROR
+ || mState == ShortcutInfo.PACKAGE_STATE_UNKNOWN);
+ }
+
+ public int getState() {
+ return mState;
+ }
+
+ public void setState(int state) {
+ mState = state;
+ }
}