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
diff --git a/src/com/android/launcher3/util/PackageUserKey.java b/src/com/android/launcher3/util/PackageUserKey.java
new file mode 100644
index 0000000..d08b0e9
--- /dev/null
+++ b/src/com/android/launcher3/util/PackageUserKey.java
@@ -0,0 +1,51 @@
+package com.android.launcher3.util;
+
+import android.os.UserHandle;
+import android.service.notification.StatusBarNotification;
+
+import com.android.launcher3.ItemInfo;
+
+import java.util.Arrays;
+
+/** Creates a hash key based on package name and user. */
+public class PackageUserKey {
+
+    private String mPackageName;
+    private UserHandle mUser;
+    private int mHashCode;
+
+    public static PackageUserKey fromItemInfo(ItemInfo info) {
+        return new PackageUserKey(info.getTargetComponent().getPackageName(), info.user);
+    }
+
+    public static PackageUserKey fromNotification(StatusBarNotification notification) {
+        return new PackageUserKey(notification.getPackageName(), notification.getUser());
+    }
+
+    public PackageUserKey(String packageName, UserHandle user) {
+        update(packageName, user);
+    }
+
+    private void update(String packageName, UserHandle user) {
+        mPackageName = packageName;
+        mUser = user;
+        mHashCode = Arrays.hashCode(new Object[] {packageName, user});
+    }
+
+    /** This should only be called to avoid new object creations in a loop. */
+    public void updateFromItemInfo(ItemInfo info) {
+        update(info.getTargetComponent().getPackageName(), info.user);
+    }
+
+    @Override
+    public int hashCode() {
+        return mHashCode;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof PackageUserKey)) return false;
+        PackageUserKey otherKey = (PackageUserKey) obj;
+        return mPackageName.equals(otherKey.mPackageName) && mUser.equals(otherKey.mUser);
+    }
+}