Loading core/java/android/app/people/ConversationChannel.java +28 −14 Original line number Diff line number Diff line Loading @@ -36,8 +36,8 @@ public final class ConversationChannel implements Parcelable { private ShortcutInfo mShortcutInfo; private int mUid; private NotificationChannel mParentNotificationChannel; private NotificationChannelGroup mParentNotificationChannelGroup; private NotificationChannel mNotificationChannel; private NotificationChannelGroup mNotificationChannelGroup; private long mLastEventTimestamp; private boolean mHasActiveNotifications; private boolean mHasBirthdayToday; Loading @@ -61,8 +61,8 @@ public final class ConversationChannel implements Parcelable { boolean hasActiveNotifications) { mShortcutInfo = shortcutInfo; mUid = uid; mParentNotificationChannel = parentNotificationChannel; mParentNotificationChannelGroup = parentNotificationChannelGroup; mNotificationChannel = parentNotificationChannel; mNotificationChannelGroup = parentNotificationChannelGroup; mLastEventTimestamp = lastEventTimestamp; mHasActiveNotifications = hasActiveNotifications; } Loading @@ -74,8 +74,8 @@ public final class ConversationChannel implements Parcelable { List<ConversationStatus> statuses) { mShortcutInfo = shortcutInfo; mUid = uid; mParentNotificationChannel = parentNotificationChannel; mParentNotificationChannelGroup = parentNotificationChannelGroup; mNotificationChannel = parentNotificationChannel; mNotificationChannelGroup = parentNotificationChannelGroup; mLastEventTimestamp = lastEventTimestamp; mHasActiveNotifications = hasActiveNotifications; mHasBirthdayToday = hasBirthdayToday; Loading @@ -85,8 +85,8 @@ public final class ConversationChannel implements Parcelable { public ConversationChannel(Parcel in) { mShortcutInfo = in.readParcelable(ShortcutInfo.class.getClassLoader()); mUid = in.readInt(); mParentNotificationChannel = in.readParcelable(NotificationChannel.class.getClassLoader()); mParentNotificationChannelGroup = mNotificationChannel = in.readParcelable(NotificationChannel.class.getClassLoader()); mNotificationChannelGroup = in.readParcelable(NotificationChannelGroup.class.getClassLoader()); mLastEventTimestamp = in.readLong(); mHasActiveNotifications = in.readBoolean(); Loading @@ -104,8 +104,8 @@ public final class ConversationChannel implements Parcelable { public void writeToParcel(Parcel dest, int flags) { dest.writeParcelable(mShortcutInfo, flags); dest.writeInt(mUid); dest.writeParcelable(mParentNotificationChannel, flags); dest.writeParcelable(mParentNotificationChannelGroup, flags); dest.writeParcelable(mNotificationChannel, flags); dest.writeParcelable(mNotificationChannelGroup, flags); dest.writeLong(mLastEventTimestamp); dest.writeBoolean(mHasActiveNotifications); dest.writeBoolean(mHasBirthdayToday); Loading @@ -120,12 +120,12 @@ public final class ConversationChannel implements Parcelable { return mUid; } public NotificationChannel getParentNotificationChannel() { return mParentNotificationChannel; public NotificationChannel getNotificationChannel() { return mNotificationChannel; } public NotificationChannelGroup getParentNotificationChannelGroup() { return mParentNotificationChannelGroup; public NotificationChannelGroup getNotificationChannelGroup() { return mNotificationChannelGroup; } public long getLastEventTimestamp() { Loading @@ -149,4 +149,18 @@ public final class ConversationChannel implements Parcelable { public @Nullable List<ConversationStatus> getStatuses() { return mStatuses; } @Override public String toString() { return "ConversationChannel{" + "mShortcutInfo=" + mShortcutInfo + ", mUid=" + mUid + ", mNotificationChannel=" + mNotificationChannel + ", mNotificationChannelGroup=" + mNotificationChannelGroup + ", mLastEventTimestamp=" + mLastEventTimestamp + ", mHasActiveNotifications=" + mHasActiveNotifications + ", mHasBirthdayToday=" + mHasBirthdayToday + ", mStatuses=" + mStatuses + '}'; } } core/java/android/app/people/PeopleSpaceTile.java +4 −4 Original line number Diff line number Diff line Loading @@ -307,10 +307,10 @@ public class PeopleSpaceTile implements Parcelable { mContactUri = getContactUri(info); mStatuses = channel.getStatuses(); mLastInteractionTimestamp = channel.getLastEventTimestamp(); mIsImportantConversation = channel.getParentNotificationChannel() != null && channel.getParentNotificationChannel().isImportantConversation(); mCanBypassDnd = channel.getParentNotificationChannel() != null && channel.getParentNotificationChannel().canBypassDnd(); mIsImportantConversation = channel.getNotificationChannel() != null && channel.getNotificationChannel().isImportantConversation(); mCanBypassDnd = channel.getNotificationChannel() != null && channel.getNotificationChannel().canBypassDnd(); mNotificationPolicyState = SHOW_CONVERSATIONS; } Loading packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -675,7 +675,7 @@ public class PeopleSpaceWidgetManager { updatedTile.setUserIcon(icon); } if (DEBUG) Log.d(TAG, "Statuses: " + conversation.getStatuses().toString()); NotificationChannel channel = conversation.getParentNotificationChannel(); NotificationChannel channel = conversation.getNotificationChannel(); if (channel != null) { if (DEBUG) Log.d(TAG, "Important:" + channel.isImportantConversation()); updatedTile.setIsImportantConversation(channel.isImportantConversation()); Loading services/people/java/com/android/server/people/data/DataManager.java +28 −10 Original line number Diff line number Diff line Loading @@ -254,6 +254,18 @@ public class DataManager { return null; } ConversationInfo getConversationInfo(String packageName, int userId, String shortcutId) { UserData userData = getUnlockedUserData(userId); if (userData != null) { PackageData packageData = userData.getPackageData(packageName); // App may have been uninstalled. if (packageData != null) { return packageData.getConversationInfo(shortcutId); } } return null; } @Nullable private ConversationChannel getConversationChannel(String packageName, int userId, String shortcutId, ConversationInfo conversationInfo) { Loading @@ -277,7 +289,7 @@ public class DataManager { int uid = mPackageManagerInternal.getPackageUid(packageName, 0, userId); NotificationChannel parentChannel = mNotificationManagerInternal.getNotificationChannel(packageName, uid, conversationInfo.getParentNotificationChannelId()); conversationInfo.getNotificationChannelId()); NotificationChannelGroup parentChannelGroup = null; if (parentChannel != null) { parentChannelGroup = Loading @@ -302,7 +314,7 @@ public class DataManager { String shortcutId = conversationInfo.getShortcutId(); ConversationChannel channel = getConversationChannel(packageData.getPackageName(), packageData.getUserId(), shortcutId, conversationInfo); if (channel == null || channel.getParentNotificationChannel() == null) { if (channel == null || channel.getNotificationChannel() == null) { return; } conversationChannels.add(channel); Loading Loading @@ -791,8 +803,8 @@ public class DataManager { private boolean isCachedRecentConversation(ConversationInfo conversationInfo) { return conversationInfo.isShortcutCachedForNotification() && conversationInfo.getNotificationChannelId() == null && conversationInfo.getParentNotificationChannelId() != null && Objects.equals(conversationInfo.getNotificationChannelId(), conversationInfo.getParentNotificationChannelId()) && conversationInfo.getLastEventTimestamp() > 0L; } Loading Loading @@ -910,7 +922,7 @@ public class DataManager { } @VisibleForTesting NotificationListenerService getNotificationListenerServiceForTesting(@UserIdInt int userId) { NotificationListener getNotificationListenerServiceForTesting(@UserIdInt int userId) { return mNotificationListeners.get(userId); } Loading Loading @@ -1132,7 +1144,7 @@ public class DataManager { } @Override public void onNotificationPosted(StatusBarNotification sbn) { public void onNotificationPosted(StatusBarNotification sbn, RankingMap map) { if (sbn.getUser().getIdentifier() != mUserId) { return; } Loading @@ -1145,16 +1157,22 @@ public class DataManager { }); if (packageData != null) { Ranking rank = new Ranking(); map.getRanking(sbn.getKey(), rank); ConversationInfo conversationInfo = packageData.getConversationInfo(shortcutId); if (conversationInfo == null) { return; } if (DEBUG) Log.d(TAG, "Last event from notification: " + sbn.getPostTime()); ConversationInfo updated = new ConversationInfo.Builder(conversationInfo) ConversationInfo.Builder updated = new ConversationInfo.Builder(conversationInfo) .setLastEventTimestamp(sbn.getPostTime()) .setParentNotificationChannelId(sbn.getNotification().getChannelId()) .build(); packageData.getConversationStore().addOrUpdate(updated); .setNotificationChannelId(rank.getChannel().getId()); if (!TextUtils.isEmpty(rank.getChannel().getParentChannelId())) { updated.setParentNotificationChannelId(rank.getChannel().getParentChannelId()); } else { updated.setParentNotificationChannelId(sbn.getNotification().getChannelId()); } packageData.getConversationStore().addOrUpdate(updated.build()); EventHistoryImpl eventHistory = packageData.getEventStore().getOrCreateEventHistory( EventStore.CATEGORY_SHORTCUT_BASED, shortcutId); Loading services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java +149 −68 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
core/java/android/app/people/ConversationChannel.java +28 −14 Original line number Diff line number Diff line Loading @@ -36,8 +36,8 @@ public final class ConversationChannel implements Parcelable { private ShortcutInfo mShortcutInfo; private int mUid; private NotificationChannel mParentNotificationChannel; private NotificationChannelGroup mParentNotificationChannelGroup; private NotificationChannel mNotificationChannel; private NotificationChannelGroup mNotificationChannelGroup; private long mLastEventTimestamp; private boolean mHasActiveNotifications; private boolean mHasBirthdayToday; Loading @@ -61,8 +61,8 @@ public final class ConversationChannel implements Parcelable { boolean hasActiveNotifications) { mShortcutInfo = shortcutInfo; mUid = uid; mParentNotificationChannel = parentNotificationChannel; mParentNotificationChannelGroup = parentNotificationChannelGroup; mNotificationChannel = parentNotificationChannel; mNotificationChannelGroup = parentNotificationChannelGroup; mLastEventTimestamp = lastEventTimestamp; mHasActiveNotifications = hasActiveNotifications; } Loading @@ -74,8 +74,8 @@ public final class ConversationChannel implements Parcelable { List<ConversationStatus> statuses) { mShortcutInfo = shortcutInfo; mUid = uid; mParentNotificationChannel = parentNotificationChannel; mParentNotificationChannelGroup = parentNotificationChannelGroup; mNotificationChannel = parentNotificationChannel; mNotificationChannelGroup = parentNotificationChannelGroup; mLastEventTimestamp = lastEventTimestamp; mHasActiveNotifications = hasActiveNotifications; mHasBirthdayToday = hasBirthdayToday; Loading @@ -85,8 +85,8 @@ public final class ConversationChannel implements Parcelable { public ConversationChannel(Parcel in) { mShortcutInfo = in.readParcelable(ShortcutInfo.class.getClassLoader()); mUid = in.readInt(); mParentNotificationChannel = in.readParcelable(NotificationChannel.class.getClassLoader()); mParentNotificationChannelGroup = mNotificationChannel = in.readParcelable(NotificationChannel.class.getClassLoader()); mNotificationChannelGroup = in.readParcelable(NotificationChannelGroup.class.getClassLoader()); mLastEventTimestamp = in.readLong(); mHasActiveNotifications = in.readBoolean(); Loading @@ -104,8 +104,8 @@ public final class ConversationChannel implements Parcelable { public void writeToParcel(Parcel dest, int flags) { dest.writeParcelable(mShortcutInfo, flags); dest.writeInt(mUid); dest.writeParcelable(mParentNotificationChannel, flags); dest.writeParcelable(mParentNotificationChannelGroup, flags); dest.writeParcelable(mNotificationChannel, flags); dest.writeParcelable(mNotificationChannelGroup, flags); dest.writeLong(mLastEventTimestamp); dest.writeBoolean(mHasActiveNotifications); dest.writeBoolean(mHasBirthdayToday); Loading @@ -120,12 +120,12 @@ public final class ConversationChannel implements Parcelable { return mUid; } public NotificationChannel getParentNotificationChannel() { return mParentNotificationChannel; public NotificationChannel getNotificationChannel() { return mNotificationChannel; } public NotificationChannelGroup getParentNotificationChannelGroup() { return mParentNotificationChannelGroup; public NotificationChannelGroup getNotificationChannelGroup() { return mNotificationChannelGroup; } public long getLastEventTimestamp() { Loading @@ -149,4 +149,18 @@ public final class ConversationChannel implements Parcelable { public @Nullable List<ConversationStatus> getStatuses() { return mStatuses; } @Override public String toString() { return "ConversationChannel{" + "mShortcutInfo=" + mShortcutInfo + ", mUid=" + mUid + ", mNotificationChannel=" + mNotificationChannel + ", mNotificationChannelGroup=" + mNotificationChannelGroup + ", mLastEventTimestamp=" + mLastEventTimestamp + ", mHasActiveNotifications=" + mHasActiveNotifications + ", mHasBirthdayToday=" + mHasBirthdayToday + ", mStatuses=" + mStatuses + '}'; } }
core/java/android/app/people/PeopleSpaceTile.java +4 −4 Original line number Diff line number Diff line Loading @@ -307,10 +307,10 @@ public class PeopleSpaceTile implements Parcelable { mContactUri = getContactUri(info); mStatuses = channel.getStatuses(); mLastInteractionTimestamp = channel.getLastEventTimestamp(); mIsImportantConversation = channel.getParentNotificationChannel() != null && channel.getParentNotificationChannel().isImportantConversation(); mCanBypassDnd = channel.getParentNotificationChannel() != null && channel.getParentNotificationChannel().canBypassDnd(); mIsImportantConversation = channel.getNotificationChannel() != null && channel.getNotificationChannel().isImportantConversation(); mCanBypassDnd = channel.getNotificationChannel() != null && channel.getNotificationChannel().canBypassDnd(); mNotificationPolicyState = SHOW_CONVERSATIONS; } Loading
packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -675,7 +675,7 @@ public class PeopleSpaceWidgetManager { updatedTile.setUserIcon(icon); } if (DEBUG) Log.d(TAG, "Statuses: " + conversation.getStatuses().toString()); NotificationChannel channel = conversation.getParentNotificationChannel(); NotificationChannel channel = conversation.getNotificationChannel(); if (channel != null) { if (DEBUG) Log.d(TAG, "Important:" + channel.isImportantConversation()); updatedTile.setIsImportantConversation(channel.isImportantConversation()); Loading
services/people/java/com/android/server/people/data/DataManager.java +28 −10 Original line number Diff line number Diff line Loading @@ -254,6 +254,18 @@ public class DataManager { return null; } ConversationInfo getConversationInfo(String packageName, int userId, String shortcutId) { UserData userData = getUnlockedUserData(userId); if (userData != null) { PackageData packageData = userData.getPackageData(packageName); // App may have been uninstalled. if (packageData != null) { return packageData.getConversationInfo(shortcutId); } } return null; } @Nullable private ConversationChannel getConversationChannel(String packageName, int userId, String shortcutId, ConversationInfo conversationInfo) { Loading @@ -277,7 +289,7 @@ public class DataManager { int uid = mPackageManagerInternal.getPackageUid(packageName, 0, userId); NotificationChannel parentChannel = mNotificationManagerInternal.getNotificationChannel(packageName, uid, conversationInfo.getParentNotificationChannelId()); conversationInfo.getNotificationChannelId()); NotificationChannelGroup parentChannelGroup = null; if (parentChannel != null) { parentChannelGroup = Loading @@ -302,7 +314,7 @@ public class DataManager { String shortcutId = conversationInfo.getShortcutId(); ConversationChannel channel = getConversationChannel(packageData.getPackageName(), packageData.getUserId(), shortcutId, conversationInfo); if (channel == null || channel.getParentNotificationChannel() == null) { if (channel == null || channel.getNotificationChannel() == null) { return; } conversationChannels.add(channel); Loading Loading @@ -791,8 +803,8 @@ public class DataManager { private boolean isCachedRecentConversation(ConversationInfo conversationInfo) { return conversationInfo.isShortcutCachedForNotification() && conversationInfo.getNotificationChannelId() == null && conversationInfo.getParentNotificationChannelId() != null && Objects.equals(conversationInfo.getNotificationChannelId(), conversationInfo.getParentNotificationChannelId()) && conversationInfo.getLastEventTimestamp() > 0L; } Loading Loading @@ -910,7 +922,7 @@ public class DataManager { } @VisibleForTesting NotificationListenerService getNotificationListenerServiceForTesting(@UserIdInt int userId) { NotificationListener getNotificationListenerServiceForTesting(@UserIdInt int userId) { return mNotificationListeners.get(userId); } Loading Loading @@ -1132,7 +1144,7 @@ public class DataManager { } @Override public void onNotificationPosted(StatusBarNotification sbn) { public void onNotificationPosted(StatusBarNotification sbn, RankingMap map) { if (sbn.getUser().getIdentifier() != mUserId) { return; } Loading @@ -1145,16 +1157,22 @@ public class DataManager { }); if (packageData != null) { Ranking rank = new Ranking(); map.getRanking(sbn.getKey(), rank); ConversationInfo conversationInfo = packageData.getConversationInfo(shortcutId); if (conversationInfo == null) { return; } if (DEBUG) Log.d(TAG, "Last event from notification: " + sbn.getPostTime()); ConversationInfo updated = new ConversationInfo.Builder(conversationInfo) ConversationInfo.Builder updated = new ConversationInfo.Builder(conversationInfo) .setLastEventTimestamp(sbn.getPostTime()) .setParentNotificationChannelId(sbn.getNotification().getChannelId()) .build(); packageData.getConversationStore().addOrUpdate(updated); .setNotificationChannelId(rank.getChannel().getId()); if (!TextUtils.isEmpty(rank.getChannel().getParentChannelId())) { updated.setParentNotificationChannelId(rank.getChannel().getParentChannelId()); } else { updated.setParentNotificationChannelId(sbn.getNotification().getChannelId()); } packageData.getConversationStore().addOrUpdate(updated.build()); EventHistoryImpl eventHistory = packageData.getEventStore().getOrCreateEventHistory( EventStore.CATEGORY_SHORTCUT_BASED, shortcutId); Loading
services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java +149 −68 File changed.Preview size limit exceeded, changes collapsed. Show changes