mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Add NotificationListener to launcher.
- NotificationListener extends NotificationListenerService, and is added to the manifest. - Added PopupDataProvider, which contains logic for storing and interacting with data that goes into the long-press popup menu (shortcuts and notifications). A follow-up CL will rename DeepShortcutsContainer to a generic PopupContainerWithArrow. - If Launcher has notification access, NotificationListener will get callbacks when notifications are posted and removed; upon receiving these callbacks, NotificationListener passes them to PopupDataProvider via a NotificationsChangedListener interface. - Upon receiving the changed notifications, PopupDataProvider maps them to the corresponding package/user and tells launcher to update relevant icons on the workspace and all apps. This is guarded by FeatureFlags.BADGE_ICONS. Bug: 32410600 Change-Id: I59aeb31a7f92399c9c4b831ab551e51e13f44f5c
This commit is contained in:
@@ -78,6 +78,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.launcher3.util.LongArrayMap;
|
||||
import com.android.launcher3.util.MultiStateAlphaController;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
import com.android.launcher3.util.VerticalFlingDetector;
|
||||
import com.android.launcher3.util.WallpaperOffsetInterpolator;
|
||||
@@ -86,6 +87,7 @@ import com.android.launcher3.widget.PendingAddWidgetInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* The workspace is a wide area with a wallpaper and a finite number of pages.
|
||||
@@ -3957,6 +3959,23 @@ public class Workspace extends PagedView
|
||||
});
|
||||
}
|
||||
|
||||
public void updateIconBadges(final Set<PackageUserKey> updatedBadges) {
|
||||
final PackageUserKey packageUserKey = new PackageUserKey(null, null);
|
||||
mapOverItems(MAP_RECURSE, new ItemOperator() {
|
||||
@Override
|
||||
public boolean evaluate(ItemInfo info, View v) {
|
||||
if (info instanceof ShortcutInfo && v instanceof BubbleTextView) {
|
||||
packageUserKey.updateFromItemInfo(info);
|
||||
if (updatedBadges.contains(packageUserKey)) {
|
||||
((BubbleTextView) v).applyBadgeState(info);
|
||||
}
|
||||
}
|
||||
// process all the shortcuts
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void removeAbandonedPromise(String packageName, UserHandle user) {
|
||||
HashSet<String> packages = new HashSet<>(1);
|
||||
packages.add(packageName);
|
||||
|
||||
Reference in New Issue
Block a user