Adding quiet mode support for shortcuts

> LauncherApps returns empty list when the user is locked. Not relying on
LauncherApps in this case
> When the user is locked, removing all dynamic shortcuts
> Loading shortcuts from DB when the user is locked
> Verifying the shortcuts again when the user is available

Bug: 30411561
Change-Id: Ib6eb372c5b009cadb86a8f6e781f3f3cbf787ceb
This commit is contained in:
Sunny Goyal committed 2016-07-29 16:10:31 -07:00
1 parent c42087e5c0
commit d3b87ef196
14 files changed
+372 -238

No files matched your search

+7 -2
View File
@@ -117,12 +117,16 @@ public class ShortcutInfo extends ItemInfo {
*/
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;
/**
* Indicates that the icon is disabled as the user partition is currently locked.
*/
public static final int FLAG_DISABLED_LOCKED_USER = 1 << 5;
/**
* Could be disabled, if the the app is installed but unavailable (eg. in safe mode or when
* sd-card is not available).
@@ -206,7 +210,6 @@ public class ShortcutInfo extends ItemInfo {
public ShortcutInfo(ShortcutInfoCompat shortcutInfo, Context context) {
user = shortcutInfo.getUserHandle();
itemType = LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
intent = shortcutInfo.makeIntent(context);
flags = 0;
updateFromDeepShortcutInfo(shortcutInfo, context);
}
@@ -291,6 +294,8 @@ public class ShortcutInfo extends ItemInfo {
}
public void updateFromDeepShortcutInfo(ShortcutInfoCompat shortcutInfo, Context context) {
// {@link ShortcutInfoCompat#getActivity} can change during an update. Recreate the intent
intent = shortcutInfo.makeIntent(context);
title = shortcutInfo.getShortLabel();
CharSequence label = shortcutInfo.getLongLabel();