summaryrefslogtreecommitdiffstats
path: root/src_shortcuts_overrides
diff options
context:
space:
mode:
authorPinyao Ting <pinyaoting@google.com>2019-07-30 11:50:54 -0700
committerPinyao Ting <pinyaoting@google.com>2019-07-31 23:56:54 +0000
commitbf608722b933b5f72b58101cdc0f54e51f315d59 (patch)
treea0ad99cbc08ed4704cb12a516c9df37e95e732a6 /src_shortcuts_overrides
parentbfff1c80dfe6101202623fd2e7080dae0c7d8179 (diff)
downloadandroid_packages_apps_Trebuchet-bf608722b933b5f72b58101cdc0f54e51f315d59.tar.gz
android_packages_apps_Trebuchet-bf608722b933b5f72b58101cdc0f54e51f315d59.tar.bz2
android_packages_apps_Trebuchet-bf608722b933b5f72b58101cdc0f54e51f315d59.zip
Ensure each dot contains only relevant notification to the shortcut
and displays system shortcut when long click on deep shortcut. In this CR we 1) for each shortcut, we filters the notifications to ensure we only get notifications with identical shortcutId. 2) allow system shortcut to be displayed when user long click on a DeepShortcut Bug: 132336512 Change-Id: Idc9eaed55e900ed4027a43ee9c3fd7dc6f4480b2 Merged-In: Idc9eaed55e900ed4027a43ee9c3fd7dc6f4480b2
Diffstat (limited to 'src_shortcuts_overrides')
-rw-r--r--src_shortcuts_overrides/com/android/launcher3/shortcuts/DeepShortcutManager.java29
1 files changed, 7 insertions, 22 deletions
diff --git a/src_shortcuts_overrides/com/android/launcher3/shortcuts/DeepShortcutManager.java b/src_shortcuts_overrides/com/android/launcher3/shortcuts/DeepShortcutManager.java
index f42bafe5e..aec2badf2 100644
--- a/src_shortcuts_overrides/com/android/launcher3/shortcuts/DeepShortcutManager.java
+++ b/src_shortcuts_overrides/com/android/launcher3/shortcuts/DeepShortcutManager.java
@@ -30,7 +30,6 @@ import android.util.Log;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.WorkspaceItemInfo;
-import com.android.launcher3.notification.NotificationKeyData;
import java.util.ArrayList;
import java.util.Collections;
@@ -65,16 +64,16 @@ public class DeepShortcutManager {
}
public static boolean supportsShortcuts(ItemInfo info) {
+ return isActive(info) && (isApp(info) || isPinnedShortcut(info));
+ }
+
+ public static boolean supportsDeepShortcuts(ItemInfo info) {
return isActive(info) && isApp(info);
}
- public static boolean supportsNotificationDots(
- ItemInfo info, List<NotificationKeyData> notifications) {
- if (!isActive(info)) {
- return false;
- }
- return isApp(info) || (isPinnedShortcut(info)
- && shouldShowNotificationDotForPinnedShortcut(info, notifications));
+ public static String getShortcutIdIfApplicable(ItemInfo info) {
+ return isActive(info) && isPinnedShortcut(info) ?
+ ShortcutKey.fromItemInfo(info).getId() : null;
}
private static boolean isApp(ItemInfo info) {
@@ -87,20 +86,6 @@ public class DeepShortcutManager {
&& info instanceof WorkspaceItemInfo;
}
- private static boolean shouldShowNotificationDotForPinnedShortcut(
- ItemInfo info, List<NotificationKeyData> notifications) {
- String shortcutId = ((WorkspaceItemInfo) info).getDeepShortcutId();
- if (shortcutId == null) {
- return false;
- }
- for (NotificationKeyData notification : notifications) {
- if (shortcutId.equals(notification.shortcutId)) {
- return true;
- }
- }
- return false;
- }
-
public boolean wasLastCallSuccess() {
return mWasLastCallSuccess;
}