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:
Tony Wickham
2017-01-20 08:15:28 -08:00
parent c711e6006f
commit 010d255018
14 changed files with 655 additions and 35 deletions

View File

@@ -53,9 +53,11 @@ import com.android.launcher3.graphics.TintedDrawableSpan;
import com.android.launcher3.keyboard.FocusedItemDecorator;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.PackageUserKey;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* The all apps view container.
@@ -472,4 +474,16 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
navBarBg.setVisibility(View.VISIBLE);
}
}
public void updateIconBadges(Set<PackageUserKey> updatedBadges) {
final PackageUserKey packageUserKey = new PackageUserKey(null, null);
for (AlphabeticalAppsList.AdapterItem app : mApps.getAdapterItems()) {
if (app.appInfo != null) {
packageUserKey.updateFromItemInfo(app.appInfo);
if (updatedBadges.contains(packageUserKey)) {
mAdapter.notifyItemChanged(app.position);
}
}
}
}
}