Loading packages/SystemUI/src/com/android/systemui/flags/Flags.kt +6 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,12 @@ object Flags { default = true ) /** Only notify group expansion listeners when a change happens. */ // TODO(b/292213543): Tracking Bug @JvmField val NOTIFICATION_GROUP_EXPANSION_CHANGE = releasedFlag("notification_group_expansion_change") // TODO(b/301955929) @JvmField val NOTIF_LS_BACKGROUND_THREAD = Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerImpl.java +13 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import androidx.annotation.NonNull; import com.android.systemui.Dumpable; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; import com.android.systemui.statusbar.notification.collection.GroupEntry; import com.android.systemui.statusbar.notification.collection.ListEntry; import com.android.systemui.statusbar.notification.collection.NotifPipeline; Loading Loading @@ -51,11 +53,14 @@ public class GroupExpansionManagerImpl implements GroupExpansionManager, Dumpabl */ private final Set<NotificationEntry> mExpandedGroups = new HashSet<>(); private final FeatureFlags mFeatureFlags; @Inject public GroupExpansionManagerImpl(DumpManager dumpManager, GroupMembershipManager groupMembershipManager) { GroupMembershipManager groupMembershipManager, FeatureFlags featureFlags) { mDumpManager = dumpManager; mGroupMembershipManager = groupMembershipManager; mFeatureFlags = featureFlags; } /** Loading @@ -81,9 +86,11 @@ public class GroupExpansionManagerImpl implements GroupExpansionManager, Dumpabl }; public void attach(NotifPipeline pipeline) { if (mFeatureFlags.isEnabled(Flags.NOTIFICATION_GROUP_EXPANSION_CHANGE)) { mDumpManager.registerDumpable(this); pipeline.addOnBeforeRenderListListener(mNotifTracker); } } @Override public void registerGroupExpansionChangeListener(OnGroupExpansionChangeListener listener) { Loading @@ -98,7 +105,8 @@ public class GroupExpansionManagerImpl implements GroupExpansionManager, Dumpabl @Override public void setGroupExpanded(NotificationEntry entry, boolean expanded) { NotificationEntry groupSummary = mGroupMembershipManager.getGroupSummary(entry); if (entry.getParent() == null) { if (mFeatureFlags.isEnabled(Flags.NOTIFICATION_GROUP_EXPANSION_CHANGE) && entry.getParent() == null) { if (expanded) { throw new IllegalArgumentException("Cannot expand group that is not attached"); } else { Loading @@ -116,7 +124,7 @@ public class GroupExpansionManagerImpl implements GroupExpansionManager, Dumpabl } // Only notify listeners if something changed. if (changed) { if (!mFeatureFlags.isEnabled(Flags.NOTIFICATION_GROUP_EXPANSION_CHANGE) || changed) { sendOnGroupExpandedChange(entry, expanded); } } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/GroupMembershipManagerImpl.java +22 −8 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.flags.FeatureFlagsClassic; import com.android.systemui.flags.Flags; import com.android.systemui.statusbar.notification.collection.GroupEntry; import com.android.systemui.statusbar.notification.collection.ListEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntry; Loading @@ -36,17 +38,25 @@ import javax.inject.Inject; */ @SysUISingleton public class GroupMembershipManagerImpl implements GroupMembershipManager { FeatureFlagsClassic mFeatureFlags; @Inject public GroupMembershipManagerImpl() {} public GroupMembershipManagerImpl(FeatureFlagsClassic featureFlags) { mFeatureFlags = featureFlags; } @Override public boolean isGroupSummary(@NonNull NotificationEntry entry) { if (mFeatureFlags.isEnabled(Flags.NOTIFICATION_GROUP_EXPANSION_CHANGE)) { if (entry.getParent() == null) { // The entry is not attached, so it doesn't count. return false; } // If entry is a summary, its parent is a GroupEntry with summary = entry. return entry.getParent().getSummary() == entry; } else { return getGroupSummary(entry) == entry; } } @Nullable Loading @@ -60,8 +70,12 @@ public class GroupMembershipManagerImpl implements GroupMembershipManager { @Override public boolean isChildInGroup(@NonNull NotificationEntry entry) { if (mFeatureFlags.isEnabled(Flags.NOTIFICATION_GROUP_EXPANSION_CHANGE)) { // An entry is a child if it's not a summary or top level entry, but it is attached. return !isGroupSummary(entry) && !isTopLevelEntry(entry) && entry.getParent() != null; } else { return !isTopLevelEntry(entry); } } @Override Loading packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/collection/EntryUtil.kt→packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/EntryUtil.kt +0 −0 File moved. View file packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/collection/GroupEntryBuilder.java→packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/GroupEntryBuilder.java +0 −7 Original line number Diff line number Diff line Loading @@ -52,38 +52,32 @@ public class GroupEntryBuilder { return ge; } /** Sets the group key. */ public GroupEntryBuilder setKey(String key) { mKey = key; return this; } /** Sets the creation time. */ public GroupEntryBuilder setCreationTime(long creationTime) { mCreationTime = creationTime; return this; } /** Sets the parent entry of the group. */ public GroupEntryBuilder setParent(@Nullable GroupEntry entry) { mParent = entry; return this; } /** Sets the section the group belongs to. */ public GroupEntryBuilder setSection(@Nullable NotifSection section) { mNotifSection = section; return this; } /** Sets the group summary. */ public GroupEntryBuilder setSummary( NotificationEntry summary) { mSummary = summary; return this; } /** Sets the group children. */ public GroupEntryBuilder setChildren(List<NotificationEntry> children) { mChildren.clear(); mChildren.addAll(children); Loading @@ -96,7 +90,6 @@ public class GroupEntryBuilder { return this; } /** Get the group's internal children list. */ public static List<NotificationEntry> getRawChildren(GroupEntry groupEntry) { return groupEntry.getRawChildren(); } Loading Loading
packages/SystemUI/src/com/android/systemui/flags/Flags.kt +6 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,12 @@ object Flags { default = true ) /** Only notify group expansion listeners when a change happens. */ // TODO(b/292213543): Tracking Bug @JvmField val NOTIFICATION_GROUP_EXPANSION_CHANGE = releasedFlag("notification_group_expansion_change") // TODO(b/301955929) @JvmField val NOTIF_LS_BACKGROUND_THREAD = Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerImpl.java +13 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import androidx.annotation.NonNull; import com.android.systemui.Dumpable; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; import com.android.systemui.statusbar.notification.collection.GroupEntry; import com.android.systemui.statusbar.notification.collection.ListEntry; import com.android.systemui.statusbar.notification.collection.NotifPipeline; Loading Loading @@ -51,11 +53,14 @@ public class GroupExpansionManagerImpl implements GroupExpansionManager, Dumpabl */ private final Set<NotificationEntry> mExpandedGroups = new HashSet<>(); private final FeatureFlags mFeatureFlags; @Inject public GroupExpansionManagerImpl(DumpManager dumpManager, GroupMembershipManager groupMembershipManager) { GroupMembershipManager groupMembershipManager, FeatureFlags featureFlags) { mDumpManager = dumpManager; mGroupMembershipManager = groupMembershipManager; mFeatureFlags = featureFlags; } /** Loading @@ -81,9 +86,11 @@ public class GroupExpansionManagerImpl implements GroupExpansionManager, Dumpabl }; public void attach(NotifPipeline pipeline) { if (mFeatureFlags.isEnabled(Flags.NOTIFICATION_GROUP_EXPANSION_CHANGE)) { mDumpManager.registerDumpable(this); pipeline.addOnBeforeRenderListListener(mNotifTracker); } } @Override public void registerGroupExpansionChangeListener(OnGroupExpansionChangeListener listener) { Loading @@ -98,7 +105,8 @@ public class GroupExpansionManagerImpl implements GroupExpansionManager, Dumpabl @Override public void setGroupExpanded(NotificationEntry entry, boolean expanded) { NotificationEntry groupSummary = mGroupMembershipManager.getGroupSummary(entry); if (entry.getParent() == null) { if (mFeatureFlags.isEnabled(Flags.NOTIFICATION_GROUP_EXPANSION_CHANGE) && entry.getParent() == null) { if (expanded) { throw new IllegalArgumentException("Cannot expand group that is not attached"); } else { Loading @@ -116,7 +124,7 @@ public class GroupExpansionManagerImpl implements GroupExpansionManager, Dumpabl } // Only notify listeners if something changed. if (changed) { if (!mFeatureFlags.isEnabled(Flags.NOTIFICATION_GROUP_EXPANSION_CHANGE) || changed) { sendOnGroupExpandedChange(entry, expanded); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/GroupMembershipManagerImpl.java +22 −8 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.flags.FeatureFlagsClassic; import com.android.systemui.flags.Flags; import com.android.systemui.statusbar.notification.collection.GroupEntry; import com.android.systemui.statusbar.notification.collection.ListEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntry; Loading @@ -36,17 +38,25 @@ import javax.inject.Inject; */ @SysUISingleton public class GroupMembershipManagerImpl implements GroupMembershipManager { FeatureFlagsClassic mFeatureFlags; @Inject public GroupMembershipManagerImpl() {} public GroupMembershipManagerImpl(FeatureFlagsClassic featureFlags) { mFeatureFlags = featureFlags; } @Override public boolean isGroupSummary(@NonNull NotificationEntry entry) { if (mFeatureFlags.isEnabled(Flags.NOTIFICATION_GROUP_EXPANSION_CHANGE)) { if (entry.getParent() == null) { // The entry is not attached, so it doesn't count. return false; } // If entry is a summary, its parent is a GroupEntry with summary = entry. return entry.getParent().getSummary() == entry; } else { return getGroupSummary(entry) == entry; } } @Nullable Loading @@ -60,8 +70,12 @@ public class GroupMembershipManagerImpl implements GroupMembershipManager { @Override public boolean isChildInGroup(@NonNull NotificationEntry entry) { if (mFeatureFlags.isEnabled(Flags.NOTIFICATION_GROUP_EXPANSION_CHANGE)) { // An entry is a child if it's not a summary or top level entry, but it is attached. return !isGroupSummary(entry) && !isTopLevelEntry(entry) && entry.getParent() != null; } else { return !isTopLevelEntry(entry); } } @Override Loading
packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/collection/EntryUtil.kt→packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/EntryUtil.kt +0 −0 File moved. View file
packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/collection/GroupEntryBuilder.java→packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/GroupEntryBuilder.java +0 −7 Original line number Diff line number Diff line Loading @@ -52,38 +52,32 @@ public class GroupEntryBuilder { return ge; } /** Sets the group key. */ public GroupEntryBuilder setKey(String key) { mKey = key; return this; } /** Sets the creation time. */ public GroupEntryBuilder setCreationTime(long creationTime) { mCreationTime = creationTime; return this; } /** Sets the parent entry of the group. */ public GroupEntryBuilder setParent(@Nullable GroupEntry entry) { mParent = entry; return this; } /** Sets the section the group belongs to. */ public GroupEntryBuilder setSection(@Nullable NotifSection section) { mNotifSection = section; return this; } /** Sets the group summary. */ public GroupEntryBuilder setSummary( NotificationEntry summary) { mSummary = summary; return this; } /** Sets the group children. */ public GroupEntryBuilder setChildren(List<NotificationEntry> children) { mChildren.clear(); mChildren.addAll(children); Loading @@ -96,7 +90,6 @@ public class GroupEntryBuilder { return this; } /** Get the group's internal children list. */ public static List<NotificationEntry> getRawChildren(GroupEntry groupEntry) { return groupEntry.getRawChildren(); } Loading