10589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato/*
20589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato * Copyright (C) 2008 The Android Open Source Project
30589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato *
40589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato * Licensed under the Apache License, Version 2.0 (the "License");
50589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato * you may not use this file except in compliance with the License.
60589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato * You may obtain a copy of the License at
70589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato *
80589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato *      http://www.apache.org/licenses/LICENSE-2.0
90589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato *
100589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato * Unless required by applicable law or agreed to in writing, software
110589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato * distributed under the License is distributed on an "AS IS" BASIS,
120589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
130589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato * See the License for the specific language governing permissions and
140589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato * limitations under the License.
150589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato */
160589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato
17325dc23624160689e59fbac708cf6f222b20d025Daniel Sandlerpackage com.android.launcher3;
180589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato
19bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickhamimport android.annotation.TargetApi;
201e2f465f46ded990ea30516cdb7f0fcf3280411fMichael Jurkaimport android.content.Context;
210589f0f66ce498512c6ee47482c649d88294c9d0Joe Onoratoimport android.content.Intent;
22bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickhamimport android.os.Build;
23bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickhamimport android.text.TextUtils;
240589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato
254fbc3828c5ae1e8c5789ede974447fa365f3c5a1Sunny Goyalimport com.android.launcher3.LauncherSettings.Favorites;
2618bf8e2ffde3444d53aaa9654da02cdedd0b7cd1Sunny Goyalimport com.android.launcher3.compat.UserManagerCompat;
27bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickhamimport com.android.launcher3.shortcuts.ShortcutInfoCompat;
2832f3dda80240e707ad4467b6b65fb589f539c58eSunny Goyalimport com.android.launcher3.util.ContentWriter;
291e2f465f46ded990ea30516cdb7f0fcf3280411fMichael Jurka
300589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato/**
310589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato * Represents a launchable icon on the workspaces and in folders.
320589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato */
333fe4a146cf774261ab3552dd8ab392439c771e54Sunny Goyalpublic class ShortcutInfo extends ItemInfoWithIcon {
340589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato
35349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal    public static final int DEFAULT = 0;
36aeff7ea43409d817490fbb8c22b8d4b9725bb54fChris Wren
37349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal    /**
38349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal     * The shortcut was restored from a backup and it not ready to be used. This is automatically
39349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal     * set during backup/restore
40349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal     */
41349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal    public static final int FLAG_RESTORED_ICON = 1;
42aeff7ea43409d817490fbb8c22b8d4b9725bb54fChris Wren
43349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal    /**
44349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal     * The icon was added as an auto-install app, and is not ready to be used. This flag can't
45349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal     * be present along with {@link #FLAG_RESTORED_ICON}, and is set during default layout
46349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal     * parsing.
47349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal     */
48bb3b02f562bef4de063099c085d3199a77d06cfdSunny Goyal    public static final int FLAG_AUTOINTALL_ICON = 2; //0B10;
49aeff7ea43409d817490fbb8c22b8d4b9725bb54fChris Wren
50349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal    /**
510c2f0700a55080318a4c21457408abb8af26740dSunny Goyal     * The icon is being installed. If {@link #FLAG_RESTORED_ICON} or {@link #FLAG_AUTOINTALL_ICON}
52349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal     * is set, then the icon is either being installed or is in a broken state.
53349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal     */
54bb3b02f562bef4de063099c085d3199a77d06cfdSunny Goyal    public static final int FLAG_INSTALL_SESSION_ACTIVE = 4; // 0B100;
55aeff7ea43409d817490fbb8c22b8d4b9725bb54fChris Wren
560589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato    /**
579448536b113afa6ceefce26604a1b44618d1d4f2Sunny Goyal     * Indicates that the widget restore has started.
589448536b113afa6ceefce26604a1b44618d1d4f2Sunny Goyal     */
59bb3b02f562bef4de063099c085d3199a77d06cfdSunny Goyal    public static final int FLAG_RESTORE_STARTED = 8; //0B1000;
60bb3b02f562bef4de063099c085d3199a77d06cfdSunny Goyal
61bb3b02f562bef4de063099c085d3199a77d06cfdSunny Goyal    /**
62bb3b02f562bef4de063099c085d3199a77d06cfdSunny Goyal     * Indicates if it represents a common type mentioned in {@link CommonAppTypeParser}.
63bb3b02f562bef4de063099c085d3199a77d06cfdSunny Goyal     * Upto 15 different types supported.
64bb3b02f562bef4de063099c085d3199a77d06cfdSunny Goyal     */
65a32bf9b1816efc154dea6ab8de1a41aba80eedb3Sunny Goyal    @Deprecated
66bb3b02f562bef4de063099c085d3199a77d06cfdSunny Goyal    public static final int FLAG_RESTORED_APP_TYPE = 0B0011110000;
679448536b113afa6ceefce26604a1b44618d1d4f2Sunny Goyal
689448536b113afa6ceefce26604a1b44618d1d4f2Sunny Goyal    /**
690589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato     * The intent used to start the application.
700589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato     */
71fedca43d396d6fd7c46fbb2f37dfa7cfe3b31834Vadim Tryshev    public Intent intent;
720589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato
730589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato    /**
740589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato     * If isShortcut=true and customIcon=false, this contains a reference to the
750589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato     * shortcut icon as an application's resource.
760589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato     */
774e5cc64eaf1f63d866d51ce0a6bbafb3d4085c21Sunny Goyal    public Intent.ShortcutIconResource iconResource;
780589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato
790589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato    /**
801a745e8f18e54aff152ff51743ae7595adde6927Sunny Goyal     * Indicates that the icon is disabled due to safe mode restrictions.
811a745e8f18e54aff152ff51743ae7595adde6927Sunny Goyal     */
8270a7c9b70003ae87e2b2968bc6ceded0fe0f0e8bSunny Goyal    public static final int FLAG_DISABLED_SAFEMODE = 1 << 0;
831a745e8f18e54aff152ff51743ae7595adde6927Sunny Goyal
841a745e8f18e54aff152ff51743ae7595adde6927Sunny Goyal    /**
851a745e8f18e54aff152ff51743ae7595adde6927Sunny Goyal     * Indicates that the icon is disabled as the app is not available.
861a745e8f18e54aff152ff51743ae7595adde6927Sunny Goyal     */
8770a7c9b70003ae87e2b2968bc6ceded0fe0f0e8bSunny Goyal    public static final int FLAG_DISABLED_NOT_AVAILABLE = 1 << 1;
881a745e8f18e54aff152ff51743ae7595adde6927Sunny Goyal
891a745e8f18e54aff152ff51743ae7595adde6927Sunny Goyal    /**
9044cba696386b44f9115cad13ec9ecf67a0ac9119Kenny Guy     * Indicates that the icon is disabled as the app is suspended
9144cba696386b44f9115cad13ec9ecf67a0ac9119Kenny Guy     */
9270a7c9b70003ae87e2b2968bc6ceded0fe0f0e8bSunny Goyal    public static final int FLAG_DISABLED_SUSPENDED = 1 << 2;
9344cba696386b44f9115cad13ec9ecf67a0ac9119Kenny Guy
9444cba696386b44f9115cad13ec9ecf67a0ac9119Kenny Guy    /**
95ff05f4375dd47242d7e4864287e0d5af8ac8ba8fKenny Guy     * Indicates that the icon is disabled as the user is in quiet mode.
96ff05f4375dd47242d7e4864287e0d5af8ac8ba8fKenny Guy     */
9770a7c9b70003ae87e2b2968bc6ceded0fe0f0e8bSunny Goyal    public static final int FLAG_DISABLED_QUIET_USER = 1 << 3;
9870a7c9b70003ae87e2b2968bc6ceded0fe0f0e8bSunny Goyal
9970a7c9b70003ae87e2b2968bc6ceded0fe0f0e8bSunny Goyal    /**
10070a7c9b70003ae87e2b2968bc6ceded0fe0f0e8bSunny Goyal     * Indicates that the icon is disabled as the publisher has disabled the actual shortcut.
10170a7c9b70003ae87e2b2968bc6ceded0fe0f0e8bSunny Goyal     */
10270a7c9b70003ae87e2b2968bc6ceded0fe0f0e8bSunny Goyal    public static final int FLAG_DISABLED_BY_PUBLISHER = 1 << 4;
103ff05f4375dd47242d7e4864287e0d5af8ac8ba8fKenny Guy
104ff05f4375dd47242d7e4864287e0d5af8ac8ba8fKenny Guy    /**
105d3b87ef1963fb96177ca85bcd6a25879e27e419cSunny Goyal     * Indicates that the icon is disabled as the user partition is currently locked.
106d3b87ef1963fb96177ca85bcd6a25879e27e419cSunny Goyal     */
107d3b87ef1963fb96177ca85bcd6a25879e27e419cSunny Goyal    public static final int FLAG_DISABLED_LOCKED_USER = 1 << 5;
108d3b87ef1963fb96177ca85bcd6a25879e27e419cSunny Goyal
109d3b87ef1963fb96177ca85bcd6a25879e27e419cSunny Goyal    /**
110c5c60ad3592f53549c9ffaa58e9a87b0480080e8Sunny Goyal     * Could be disabled, if the the app is installed but unavailable (eg. in safe mode or when
111c5c60ad3592f53549c9ffaa58e9a87b0480080e8Sunny Goyal     * sd-card is not available).
112c5c60ad3592f53549c9ffaa58e9a87b0480080e8Sunny Goyal     */
113f0ba8b7ca1dc8fd53451d3d16e9f4fc306cddcd4Sunny Goyal    public int isDisabled = DEFAULT;
114c5c60ad3592f53549c9ffaa58e9a87b0480080e8Sunny Goyal
1154efffc5ba69fdf44be1bf2b540e24cd2bd85d18cTony Wickham    /**
1164efffc5ba69fdf44be1bf2b540e24cd2bd85d18cTony Wickham     * A message to display when the user tries to start a disabled shortcut.
1174efffc5ba69fdf44be1bf2b540e24cd2bd85d18cTony Wickham     * This is currently only used for deep shortcuts.
1184efffc5ba69fdf44be1bf2b540e24cd2bd85d18cTony Wickham     */
1194efffc5ba69fdf44be1bf2b540e24cd2bd85d18cTony Wickham    CharSequence disabledMessage;
1204efffc5ba69fdf44be1bf2b540e24cd2bd85d18cTony Wickham
121f0ba8b7ca1dc8fd53451d3d16e9f4fc306cddcd4Sunny Goyal    public int status;
12240c5ed303909c4df71037be3429aa1423e59585fChris Wren
123e755d469d40b95e763a9dcb67d0e4f511d1948ddSunny Goyal    /**
124e755d469d40b95e763a9dcb67d0e4f511d1948ddSunny Goyal     * The installation progress [0-100] of the package that this shortcut represents.
125e755d469d40b95e763a9dcb67d0e4f511d1948ddSunny Goyal     */
126349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal    private int mInstallProgress;
127e755d469d40b95e763a9dcb67d0e4f511d1948ddSunny Goyal
128d139b0aa7d03f676dc7869dc5b39fd9f24ff0a1dSunny Goyal    public ShortcutInfo() {
1290589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato        itemType = LauncherSettings.BaseLauncherColumns.ITEM_TYPE_SHORTCUT;
1300589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato    }
131997a92348a6d6e061737399321393449c16cd4d8Winson Chung
13210923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal    public ShortcutInfo(ShortcutInfo info) {
133c9d95c5897fc5ebbf53903d4ab18ad13d196f643Michael Jurka        super(info);
13410923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal        title = info.title;
1350589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato        intent = new Intent(info.intent);
13610923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal        iconResource = info.iconResource;
137349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal        status = info.status;
13810923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal        mInstallProgress = info.mInstallProgress;
13910923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal        isDisabled = info.isDisabled;
1400589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato    }
1410589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato
1420589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato    /** TODO: Remove this.  It's only called by ApplicationInfo.makeShortcut. */
143eadbfc564d84aaf1d800da3d0d6edf6312f89648Michael Jurka    public ShortcutInfo(AppInfo info) {
144c9d95c5897fc5ebbf53903d4ab18ad13d196f643Michael Jurka        super(info);
14582b016cb56540fe26213e817dd0dd668099c8e20Winson Chung        title = Utilities.trim(info.title);
1460589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato        intent = new Intent(info.intent);
14744cba696386b44f9115cad13ec9ecf67a0ac9119Kenny Guy        isDisabled = info.isDisabled;
14810923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal    }
14910923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal
15010923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal    /**
15110923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal     * Creates a {@link ShortcutInfo} from a {@link ShortcutInfoCompat}.
15210923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal     */
15310923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal    @TargetApi(Build.VERSION_CODES.N)
15410923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal    public ShortcutInfo(ShortcutInfoCompat shortcutInfo, Context context) {
15510923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal        user = shortcutInfo.getUserHandle();
15610923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal        itemType = LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
15710923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal        updateFromDeepShortcutInfo(shortcutInfo, context);
15810923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal    }
15910923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal
1600589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato    @Override
161658058b960ef029fc70f0f3e131057a6ba0d10e2Sunny Goyal    public void onAddToDatabase(ContentWriter writer) {
16232f3dda80240e707ad4467b6b65fb589f539c58eSunny Goyal        super.onAddToDatabase(writer);
16332f3dda80240e707ad4467b6b65fb589f539c58eSunny Goyal        writer.put(LauncherSettings.BaseLauncherColumns.TITLE, title)
1643fe4a146cf774261ab3552dd8ab392439c771e54Sunny Goyal                .put(LauncherSettings.BaseLauncherColumns.INTENT, getIntent())
16532f3dda80240e707ad4467b6b65fb589f539c58eSunny Goyal                .put(LauncherSettings.Favorites.RESTORED, status);
16632f3dda80240e707ad4467b6b65fb589f539c58eSunny Goyal
16732f3dda80240e707ad4467b6b65fb589f539c58eSunny Goyal        if (!usingLowResIcon) {
1681cd01b023acc123b771765b7297d8aaedac224e0Sunny Goyal            writer.putIcon(iconBitmap, user);
169eb4b79935e9f75dda72e4953f45e616e252d7b03Sunny Goyal        }
170eb4b79935e9f75dda72e4953f45e616e252d7b03Sunny Goyal        if (iconResource != null) {
17132f3dda80240e707ad4467b6b65fb589f539c58eSunny Goyal            writer.put(LauncherSettings.BaseLauncherColumns.ICON_PACKAGE, iconResource.packageName)
17232f3dda80240e707ad4467b6b65fb589f539c58eSunny Goyal                    .put(LauncherSettings.BaseLauncherColumns.ICON_RESOURCE,
17332f3dda80240e707ad4467b6b65fb589f539c58eSunny Goyal                            iconResource.resourceName);
1740589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato        }
1750589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato    }
1760589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato
1773fe4a146cf774261ab3552dd8ab392439c771e54Sunny Goyal    @Override
1783fe4a146cf774261ab3552dd8ab392439c771e54Sunny Goyal    public Intent getIntent() {
179e6e7200791c28472c9335a187a85dbeda1a77d24Sunny Goyal        return intent;
180aeff7ea43409d817490fbb8c22b8d4b9725bb54fChris Wren    }
181aeff7ea43409d817490fbb8c22b8d4b9725bb54fChris Wren
182349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal    public boolean hasStatusFlag(int flag) {
183349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal        return (status & flag) != 0;
184aeff7ea43409d817490fbb8c22b8d4b9725bb54fChris Wren    }
18540c5ed303909c4df71037be3429aa1423e59585fChris Wren
186e755d469d40b95e763a9dcb67d0e4f511d1948ddSunny Goyal
187349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal    public final boolean isPromise() {
188349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal        return hasStatusFlag(FLAG_RESTORED_ICON | FLAG_AUTOINTALL_ICON);
18940c5ed303909c4df71037be3429aa1423e59585fChris Wren    }
19040c5ed303909c4df71037be3429aa1423e59585fChris Wren
191349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal    public int getInstallProgress() {
192349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal        return mInstallProgress;
19340c5ed303909c4df71037be3429aa1423e59585fChris Wren    }
194e755d469d40b95e763a9dcb67d0e4f511d1948ddSunny Goyal
195349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal    public void setInstallProgress(int progress) {
196349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal        mInstallProgress = progress;
197349426234e8c5a0e5bcf2c8d94dbb9844b5f724aSunny Goyal        status |= FLAG_INSTALL_SESSION_ACTIVE;
198e755d469d40b95e763a9dcb67d0e4f511d1948ddSunny Goyal    }
19934b6527cefd36fbd5da78464ce9771e379158552Sunny Goyal
2009994b2b171ab78d1d93e8a25086d6853f766e80fSunny Goyal    public void updateFromDeepShortcutInfo(ShortcutInfoCompat shortcutInfo, Context context) {
201d3b87ef1963fb96177ca85bcd6a25879e27e419cSunny Goyal        // {@link ShortcutInfoCompat#getActivity} can change during an update. Recreate the intent
20224bb66a1c5a435ab0c55b4a97e788bdc2595bf84Sunny Goyal        intent = shortcutInfo.makeIntent();
203bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickham        title = shortcutInfo.getShortLabel();
204bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickham
205bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickham        CharSequence label = shortcutInfo.getLongLabel();
206bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickham        if (TextUtils.isEmpty(label)) {
207bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickham            label = shortcutInfo.getShortLabel();
208bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickham        }
209b93f34a8be4450d2b6cb47a73f43c84c194bdb95Winson        contentDescription = UserManagerCompat.getInstance(context)
210bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickham                .getBadgedLabelForUser(label, user);
21170a7c9b70003ae87e2b2968bc6ceded0fe0f0e8bSunny Goyal        if (shortcutInfo.isEnabled()) {
21270a7c9b70003ae87e2b2968bc6ceded0fe0f0e8bSunny Goyal            isDisabled &= ~FLAG_DISABLED_BY_PUBLISHER;
21370a7c9b70003ae87e2b2968bc6ceded0fe0f0e8bSunny Goyal        } else {
21470a7c9b70003ae87e2b2968bc6ceded0fe0f0e8bSunny Goyal            isDisabled |= FLAG_DISABLED_BY_PUBLISHER;
21570a7c9b70003ae87e2b2968bc6ceded0fe0f0e8bSunny Goyal        }
2164efffc5ba69fdf44be1bf2b540e24cd2bd85d18cTony Wickham        disabledMessage = shortcutInfo.getDisabledMessage();
21710923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal    }
21810923b30a22b4ec8d10cf8536bddf3f176e6c26fSunny Goyal
219bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickham    /** Returns the ShortcutInfo id associated with the deep shortcut. */
220bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickham    public String getDeepShortcutId() {
221bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickham        return itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT ?
2223fe4a146cf774261ab3552dd8ab392439c771e54Sunny Goyal                getIntent().getStringExtra(ShortcutInfoCompat.EXTRA_SHORTCUT_ID) : null;
223bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickham    }
224bfbf7f9f4a0b300613f0ff27a4eb592d88c08325Tony Wickham
22544cba696386b44f9115cad13ec9ecf67a0ac9119Kenny Guy    @Override
22644cba696386b44f9115cad13ec9ecf67a0ac9119Kenny Guy    public boolean isDisabled() {
22744cba696386b44f9115cad13ec9ecf67a0ac9119Kenny Guy        return isDisabled != 0;
22844cba696386b44f9115cad13ec9ecf67a0ac9119Kenny Guy    }
2290589f0f66ce498512c6ee47482c649d88294c9d0Joe Onorato}
230