diff options
Diffstat (limited to 'src/com/android/launcher3/ShortcutInfo.java')
-rw-r--r-- | src/com/android/launcher3/ShortcutInfo.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/com/android/launcher3/ShortcutInfo.java b/src/com/android/launcher3/ShortcutInfo.java index f0d9367af..adf008bf4 100644 --- a/src/com/android/launcher3/ShortcutInfo.java +++ b/src/com/android/launcher3/ShortcutInfo.java @@ -17,6 +17,7 @@ package com.android.launcher3; import android.annotation.TargetApi; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.os.Build; @@ -59,6 +60,11 @@ public class ShortcutInfo extends ItemInfoWithIcon { public static final int FLAG_RESTORE_STARTED = 8; //0B1000; /** + * Web UI supported. + */ + public static final int FLAG_SUPPORTS_WEB_UI = 16; //0B10000; + + /** * Indicates if it represents a common type mentioned in {@link CommonAppTypeParser}. * Upto 15 different types supported. */ @@ -188,6 +194,10 @@ public class ShortcutInfo extends ItemInfoWithIcon { return hasStatusFlag(FLAG_RESTORED_ICON | FLAG_AUTOINSTALL_ICON); } + public boolean hasPromiseIconUi() { + return isPromise() && !hasStatusFlag(FLAG_SUPPORTS_WEB_UI); + } + public int getInstallProgress() { return mInstallProgress; } @@ -226,4 +236,18 @@ public class ShortcutInfo extends ItemInfoWithIcon { public boolean isDisabled() { return isDisabled != 0; } + + @Override + public ComponentName getTargetComponent() { + ComponentName cn = super.getTargetComponent(); + if (cn == null && (itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT + || hasStatusFlag(FLAG_SUPPORTS_WEB_UI))) { + // Legacy shortcuts and promise icons with web UI may not have a componentName but just + // a packageName. In that case create a dummy componentName instead of adding additional + // check everywhere. + String pkg = intent.getPackage(); + return pkg == null ? null : new ComponentName(pkg, IconCache.EMPTY_CLASS_NAME); + } + return cn; + } } |