Loading res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,8 @@ <string name="safemode_shortcut_error">Downloaded app disabled in Safe mode</string> <!-- SafeMode widget error string --> <string name="safemode_widget_error">Widgets disabled in Safe mode</string> <!-- Message shown when a shortcut is not available. It could have been temporarily disabled and may start working again after some time. --> <string name="shortcut_not_available">Shortcut isn\'t available</string> <!-- Widgets --> <!-- Message to tell the user to press and hold on a widget to add it [CHAR_LIMIT=50] --> Loading src/com/android/launcher3/Launcher.java +2 −0 Original line number Diff line number Diff line Loading @@ -2655,6 +2655,8 @@ public class Launcher extends Activity int error = R.string.activity_not_available; if ((shortcut.isDisabled & ShortcutInfo.FLAG_DISABLED_SAFEMODE) != 0) { error = R.string.safemode_shortcut_error; } else if ((shortcut.isDisabled & ShortcutInfo.FLAG_DISABLED_BY_PUBLISHER) != 0) { error = R.string.shortcut_not_available; } Toast.makeText(this, error, Toast.LENGTH_SHORT).show(); return; Loading src/com/android/launcher3/LauncherModel.java +5 −3 Original line number Diff line number Diff line Loading @@ -2821,11 +2821,13 @@ public class LauncherModel extends BroadcastReceiver // Now add the new shortcuts to the map. for (ShortcutInfoCompat shortcut : shortcuts) { if (shortcut.isEnabled()) { ComponentKey targetComponent = new ComponentKey(shortcut.getActivity(), shortcut.getUserHandle()); mBgDeepShortcutMap.addToList(targetComponent, shortcut.getId()); } } } public void bindDeepShortcuts() { final MultiHashMap<ComponentKey, String> shortcutMapCopy = new MultiHashMap<>(); Loading src/com/android/launcher3/ShortcutInfo.java +15 −4 Original line number Diff line number Diff line Loading @@ -100,22 +100,28 @@ public class ShortcutInfo extends ItemInfo { /** * Indicates that the icon is disabled due to safe mode restrictions. */ public static final int FLAG_DISABLED_SAFEMODE = 1; public static final int FLAG_DISABLED_SAFEMODE = 1 << 0; /** * Indicates that the icon is disabled as the app is not available. */ public static final int FLAG_DISABLED_NOT_AVAILABLE = 2; public static final int FLAG_DISABLED_NOT_AVAILABLE = 1 << 1; /** * Indicates that the icon is disabled as the app is suspended */ public static final int FLAG_DISABLED_SUSPENDED = 4; public static final int FLAG_DISABLED_SUSPENDED = 1 << 2; /** * Indicates that the icon is disabled as the user is in quiet mode. */ public static final int FLAG_DISABLED_QUIET_USER = 8; public static final int FLAG_DISABLED_QUIET_USER = 1 << 3; /** * Indicates that the icon is disabled as the publisher has disabled the actual shortcut. */ public static final int FLAG_DISABLED_BY_PUBLISHER = 1 << 4; /** * Could be disabled, if the the app is installed but unavailable (eg. in safe mode or when Loading Loading @@ -293,6 +299,11 @@ public class ShortcutInfo extends ItemInfo { } contentDescription = UserManagerCompat.getInstance(context) .getBadgedLabelForUser(label, user); if (shortcutInfo.isEnabled()) { isDisabled &= ~FLAG_DISABLED_BY_PUBLISHER; } else { isDisabled |= FLAG_DISABLED_BY_PUBLISHER; } LauncherAppState launcherAppState = LauncherAppState.getInstance(); Drawable unbadgedIcon = launcherAppState.getShortcutManager() Loading src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java +4 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,10 @@ public class ShortcutInfoCompat { return mShortcutInfo.isDeclaredInManifest(); } public boolean isEnabled() { return mShortcutInfo.isEnabled(); } public int getRank() { return mShortcutInfo.getRank(); } Loading Loading
res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,8 @@ <string name="safemode_shortcut_error">Downloaded app disabled in Safe mode</string> <!-- SafeMode widget error string --> <string name="safemode_widget_error">Widgets disabled in Safe mode</string> <!-- Message shown when a shortcut is not available. It could have been temporarily disabled and may start working again after some time. --> <string name="shortcut_not_available">Shortcut isn\'t available</string> <!-- Widgets --> <!-- Message to tell the user to press and hold on a widget to add it [CHAR_LIMIT=50] --> Loading
src/com/android/launcher3/Launcher.java +2 −0 Original line number Diff line number Diff line Loading @@ -2655,6 +2655,8 @@ public class Launcher extends Activity int error = R.string.activity_not_available; if ((shortcut.isDisabled & ShortcutInfo.FLAG_DISABLED_SAFEMODE) != 0) { error = R.string.safemode_shortcut_error; } else if ((shortcut.isDisabled & ShortcutInfo.FLAG_DISABLED_BY_PUBLISHER) != 0) { error = R.string.shortcut_not_available; } Toast.makeText(this, error, Toast.LENGTH_SHORT).show(); return; Loading
src/com/android/launcher3/LauncherModel.java +5 −3 Original line number Diff line number Diff line Loading @@ -2821,11 +2821,13 @@ public class LauncherModel extends BroadcastReceiver // Now add the new shortcuts to the map. for (ShortcutInfoCompat shortcut : shortcuts) { if (shortcut.isEnabled()) { ComponentKey targetComponent = new ComponentKey(shortcut.getActivity(), shortcut.getUserHandle()); mBgDeepShortcutMap.addToList(targetComponent, shortcut.getId()); } } } public void bindDeepShortcuts() { final MultiHashMap<ComponentKey, String> shortcutMapCopy = new MultiHashMap<>(); Loading
src/com/android/launcher3/ShortcutInfo.java +15 −4 Original line number Diff line number Diff line Loading @@ -100,22 +100,28 @@ public class ShortcutInfo extends ItemInfo { /** * Indicates that the icon is disabled due to safe mode restrictions. */ public static final int FLAG_DISABLED_SAFEMODE = 1; public static final int FLAG_DISABLED_SAFEMODE = 1 << 0; /** * Indicates that the icon is disabled as the app is not available. */ public static final int FLAG_DISABLED_NOT_AVAILABLE = 2; public static final int FLAG_DISABLED_NOT_AVAILABLE = 1 << 1; /** * Indicates that the icon is disabled as the app is suspended */ public static final int FLAG_DISABLED_SUSPENDED = 4; public static final int FLAG_DISABLED_SUSPENDED = 1 << 2; /** * Indicates that the icon is disabled as the user is in quiet mode. */ public static final int FLAG_DISABLED_QUIET_USER = 8; public static final int FLAG_DISABLED_QUIET_USER = 1 << 3; /** * Indicates that the icon is disabled as the publisher has disabled the actual shortcut. */ public static final int FLAG_DISABLED_BY_PUBLISHER = 1 << 4; /** * Could be disabled, if the the app is installed but unavailable (eg. in safe mode or when Loading Loading @@ -293,6 +299,11 @@ public class ShortcutInfo extends ItemInfo { } contentDescription = UserManagerCompat.getInstance(context) .getBadgedLabelForUser(label, user); if (shortcutInfo.isEnabled()) { isDisabled &= ~FLAG_DISABLED_BY_PUBLISHER; } else { isDisabled |= FLAG_DISABLED_BY_PUBLISHER; } LauncherAppState launcherAppState = LauncherAppState.getInstance(); Drawable unbadgedIcon = launcherAppState.getShortcutManager() Loading
src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java +4 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,10 @@ public class ShortcutInfoCompat { return mShortcutInfo.isDeclaredInManifest(); } public boolean isEnabled() { return mShortcutInfo.isEnabled(); } public int getRank() { return mShortcutInfo.getRank(); } Loading