Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListEntry.java +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ public abstract class ListEntry { private final ListAttachState mPreviousAttachState = ListAttachState.create(); private final ListAttachState mAttachState = ListAttachState.create(); ListEntry(String key, long creationTime) { protected ListEntry(String key, long creationTime) { mKey = key; mCreationTime = creationTime; } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilder.java +23 −3 Original line number Diff line number Diff line Loading @@ -78,6 +78,8 @@ public class ShadeListBuilder implements Dumpable { private final SystemClock mSystemClock; private final ShadeListBuilderLogger mLogger; private final NotificationInteractionTracker mInteractionTracker; // used exclusivly by ShadeListBuilder#notifySectionEntriesUpdated private final ArrayList<ListEntry> mTempSectionMembers = new ArrayList<>(); private List<ListEntry> mNotifList = new ArrayList<>(); private List<ListEntry> mNewNotifList = new ArrayList<>(); Loading Loading @@ -356,7 +358,7 @@ public class ShadeListBuilder implements Dumpable { // section by our list of custom comparators dispatchOnBeforeSort(mReadOnlyNotifList); mPipelineState.incrementTo(STATE_SORTING); sortList(); sortListAndNotifySections(); // Step 7: Lock in our group structure and log anything that's changed since the last run mPipelineState.incrementTo(STATE_FINALIZING); Loading @@ -382,6 +384,22 @@ public class ShadeListBuilder implements Dumpable { mIterationCount++; } private void notifySectionEntriesUpdated() { NotifSection currentSection = null; mTempSectionMembers.clear(); for (int i = 0; i < mNotifList.size(); i++) { ListEntry currentEntry = mNotifList.get(i); if (currentSection != currentEntry.getSection()) { if (currentSection != null) { currentSection.getSectioner().onEntriesUpdated(mTempSectionMembers); mTempSectionMembers.clear(); } currentSection = currentEntry.getSection(); } mTempSectionMembers.add(currentEntry); } } /** * Points mNotifList to the list stored in mNewNotifList. * Reuses the (emptied) mNotifList as mNewNotifList. Loading Loading @@ -713,7 +731,7 @@ public class ShadeListBuilder implements Dumpable { } } private void sortList() { private void sortListAndNotifySections() { // Assign sections to top-level elements and sort their children for (ListEntry entry : mNotifList) { NotifSection section = applySections(entry); Loading @@ -728,6 +746,9 @@ public class ShadeListBuilder implements Dumpable { // Finally, sort all top-level elements mNotifList.sort(mTopLevelComparator); // notify sections since the list is sorted now notifySectionEntriesUpdated(); } private void freeEmptyGroups() { Loading Loading @@ -937,7 +958,6 @@ public class ShadeListBuilder implements Dumpable { } entry.getAttachState().setSection(finalSection); return finalSection; } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinator.java +22 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.notification.collection.coordinator; import android.annotation.NonNull; import android.annotation.Nullable; import com.android.systemui.dagger.SysUISingleton; Loading @@ -27,9 +28,12 @@ import com.android.systemui.statusbar.notification.collection.listbuilder.plugga import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifSectioner; import com.android.systemui.statusbar.notification.collection.provider.HighPriorityProvider; import com.android.systemui.statusbar.notification.collection.render.NodeController; import com.android.systemui.statusbar.notification.collection.render.SectionHeaderController; import com.android.systemui.statusbar.notification.dagger.AlertingHeader; import com.android.systemui.statusbar.notification.dagger.SilentHeader; import java.util.List; import javax.inject.Inject; /** Loading @@ -44,7 +48,8 @@ public class RankingCoordinator implements Coordinator { public static final boolean SHOW_ALL_SECTIONS = false; private final StatusBarStateController mStatusBarStateController; private final HighPriorityProvider mHighPriorityProvider; private final NodeController mSilentHeaderController; private final NodeController mSilentNodeController; private final SectionHeaderController mSilentHeaderController; private final NodeController mAlertingHeaderController; @Inject Loading @@ -52,10 +57,12 @@ public class RankingCoordinator implements Coordinator { StatusBarStateController statusBarStateController, HighPriorityProvider highPriorityProvider, @AlertingHeader NodeController alertingHeaderController, @SilentHeader NodeController silentHeaderController) { @SilentHeader SectionHeaderController silentHeaderController, @SilentHeader NodeController silentNodeController) { mStatusBarStateController = statusBarStateController; mHighPriorityProvider = highPriorityProvider; mAlertingHeaderController = alertingHeaderController; mSilentNodeController = silentNodeController; mSilentHeaderController = silentHeaderController; } Loading Loading @@ -101,7 +108,19 @@ public class RankingCoordinator implements Coordinator { @Nullable @Override public NodeController getHeaderNodeController() { return mSilentHeaderController; return mSilentNodeController; } @Nullable @Override public void onEntriesUpdated(@NonNull List<ListEntry> entries) { for (int i = 0; i < entries.size(); i++) { if (entries.get(i).getRepresentativeEntry().getSbn().isClearable()) { mSilentHeaderController.setClearSectionEnabled(true); return; } } mSilentHeaderController.setClearSectionEnabled(false); } }; Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/listbuilder/pluggable/NotifSectioner.java +8 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import com.android.systemui.statusbar.notification.collection.ShadeListBuilder; import com.android.systemui.statusbar.notification.collection.render.NodeController; import com.android.systemui.statusbar.notification.collection.render.NodeSpec; import java.util.List; /** * Pluggable for participating in notif sectioning. See {@link ShadeListBuilder#setSections}. */ Loading @@ -46,4 +48,10 @@ public abstract class NotifSectioner extends Pluggable<NotifSectioner> { public @Nullable NodeController getHeaderNodeController() { return null; } /** * Notify of children of this section being updated * @param entries of this section that are borrowed (must clone to store) */ public void onEntriesUpdated(List<ListEntry> entries) {} } packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/SectionHeaderController.kt +10 −2 Original line number Diff line number Diff line Loading @@ -33,7 +33,8 @@ import javax.inject.Inject interface SectionHeaderController { fun reinflateView(parent: ViewGroup) val headerView: SectionHeaderView? fun setOnClearAllClickListener(listener: View.OnClickListener) fun setClearSectionEnabled(enabled: Boolean) fun setOnClearSectionClickListener(listener: View.OnClickListener) } @SectionHeaderScope Loading @@ -46,6 +47,7 @@ internal class SectionHeaderNodeControllerImpl @Inject constructor( ) : NodeController, SectionHeaderController { private var _view: SectionHeaderView? = null private var clearAllButtonEnabled = false private var clearAllClickListener: View.OnClickListener? = null private val onHeaderClickListener = View.OnClickListener { activityStarter.startActivity( Loading Loading @@ -76,12 +78,18 @@ internal class SectionHeaderNodeControllerImpl @Inject constructor( parent.addView(inflated, oldPos) } _view = inflated _view?.setClearSectionButtonEnabled(clearAllButtonEnabled) } override val headerView: SectionHeaderView? get() = _view override fun setOnClearAllClickListener(listener: View.OnClickListener) { override fun setClearSectionEnabled(enabled: Boolean) { clearAllButtonEnabled = enabled _view?.setClearSectionButtonEnabled(enabled) } override fun setOnClearSectionClickListener(listener: View.OnClickListener) { clearAllClickListener = listener _view?.setOnClearAllClickListener(listener) } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListEntry.java +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ public abstract class ListEntry { private final ListAttachState mPreviousAttachState = ListAttachState.create(); private final ListAttachState mAttachState = ListAttachState.create(); ListEntry(String key, long creationTime) { protected ListEntry(String key, long creationTime) { mKey = key; mCreationTime = creationTime; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilder.java +23 −3 Original line number Diff line number Diff line Loading @@ -78,6 +78,8 @@ public class ShadeListBuilder implements Dumpable { private final SystemClock mSystemClock; private final ShadeListBuilderLogger mLogger; private final NotificationInteractionTracker mInteractionTracker; // used exclusivly by ShadeListBuilder#notifySectionEntriesUpdated private final ArrayList<ListEntry> mTempSectionMembers = new ArrayList<>(); private List<ListEntry> mNotifList = new ArrayList<>(); private List<ListEntry> mNewNotifList = new ArrayList<>(); Loading Loading @@ -356,7 +358,7 @@ public class ShadeListBuilder implements Dumpable { // section by our list of custom comparators dispatchOnBeforeSort(mReadOnlyNotifList); mPipelineState.incrementTo(STATE_SORTING); sortList(); sortListAndNotifySections(); // Step 7: Lock in our group structure and log anything that's changed since the last run mPipelineState.incrementTo(STATE_FINALIZING); Loading @@ -382,6 +384,22 @@ public class ShadeListBuilder implements Dumpable { mIterationCount++; } private void notifySectionEntriesUpdated() { NotifSection currentSection = null; mTempSectionMembers.clear(); for (int i = 0; i < mNotifList.size(); i++) { ListEntry currentEntry = mNotifList.get(i); if (currentSection != currentEntry.getSection()) { if (currentSection != null) { currentSection.getSectioner().onEntriesUpdated(mTempSectionMembers); mTempSectionMembers.clear(); } currentSection = currentEntry.getSection(); } mTempSectionMembers.add(currentEntry); } } /** * Points mNotifList to the list stored in mNewNotifList. * Reuses the (emptied) mNotifList as mNewNotifList. Loading Loading @@ -713,7 +731,7 @@ public class ShadeListBuilder implements Dumpable { } } private void sortList() { private void sortListAndNotifySections() { // Assign sections to top-level elements and sort their children for (ListEntry entry : mNotifList) { NotifSection section = applySections(entry); Loading @@ -728,6 +746,9 @@ public class ShadeListBuilder implements Dumpable { // Finally, sort all top-level elements mNotifList.sort(mTopLevelComparator); // notify sections since the list is sorted now notifySectionEntriesUpdated(); } private void freeEmptyGroups() { Loading Loading @@ -937,7 +958,6 @@ public class ShadeListBuilder implements Dumpable { } entry.getAttachState().setSection(finalSection); return finalSection; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinator.java +22 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.notification.collection.coordinator; import android.annotation.NonNull; import android.annotation.Nullable; import com.android.systemui.dagger.SysUISingleton; Loading @@ -27,9 +28,12 @@ import com.android.systemui.statusbar.notification.collection.listbuilder.plugga import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifSectioner; import com.android.systemui.statusbar.notification.collection.provider.HighPriorityProvider; import com.android.systemui.statusbar.notification.collection.render.NodeController; import com.android.systemui.statusbar.notification.collection.render.SectionHeaderController; import com.android.systemui.statusbar.notification.dagger.AlertingHeader; import com.android.systemui.statusbar.notification.dagger.SilentHeader; import java.util.List; import javax.inject.Inject; /** Loading @@ -44,7 +48,8 @@ public class RankingCoordinator implements Coordinator { public static final boolean SHOW_ALL_SECTIONS = false; private final StatusBarStateController mStatusBarStateController; private final HighPriorityProvider mHighPriorityProvider; private final NodeController mSilentHeaderController; private final NodeController mSilentNodeController; private final SectionHeaderController mSilentHeaderController; private final NodeController mAlertingHeaderController; @Inject Loading @@ -52,10 +57,12 @@ public class RankingCoordinator implements Coordinator { StatusBarStateController statusBarStateController, HighPriorityProvider highPriorityProvider, @AlertingHeader NodeController alertingHeaderController, @SilentHeader NodeController silentHeaderController) { @SilentHeader SectionHeaderController silentHeaderController, @SilentHeader NodeController silentNodeController) { mStatusBarStateController = statusBarStateController; mHighPriorityProvider = highPriorityProvider; mAlertingHeaderController = alertingHeaderController; mSilentNodeController = silentNodeController; mSilentHeaderController = silentHeaderController; } Loading Loading @@ -101,7 +108,19 @@ public class RankingCoordinator implements Coordinator { @Nullable @Override public NodeController getHeaderNodeController() { return mSilentHeaderController; return mSilentNodeController; } @Nullable @Override public void onEntriesUpdated(@NonNull List<ListEntry> entries) { for (int i = 0; i < entries.size(); i++) { if (entries.get(i).getRepresentativeEntry().getSbn().isClearable()) { mSilentHeaderController.setClearSectionEnabled(true); return; } } mSilentHeaderController.setClearSectionEnabled(false); } }; Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/listbuilder/pluggable/NotifSectioner.java +8 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import com.android.systemui.statusbar.notification.collection.ShadeListBuilder; import com.android.systemui.statusbar.notification.collection.render.NodeController; import com.android.systemui.statusbar.notification.collection.render.NodeSpec; import java.util.List; /** * Pluggable for participating in notif sectioning. See {@link ShadeListBuilder#setSections}. */ Loading @@ -46,4 +48,10 @@ public abstract class NotifSectioner extends Pluggable<NotifSectioner> { public @Nullable NodeController getHeaderNodeController() { return null; } /** * Notify of children of this section being updated * @param entries of this section that are borrowed (must clone to store) */ public void onEntriesUpdated(List<ListEntry> entries) {} }
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/SectionHeaderController.kt +10 −2 Original line number Diff line number Diff line Loading @@ -33,7 +33,8 @@ import javax.inject.Inject interface SectionHeaderController { fun reinflateView(parent: ViewGroup) val headerView: SectionHeaderView? fun setOnClearAllClickListener(listener: View.OnClickListener) fun setClearSectionEnabled(enabled: Boolean) fun setOnClearSectionClickListener(listener: View.OnClickListener) } @SectionHeaderScope Loading @@ -46,6 +47,7 @@ internal class SectionHeaderNodeControllerImpl @Inject constructor( ) : NodeController, SectionHeaderController { private var _view: SectionHeaderView? = null private var clearAllButtonEnabled = false private var clearAllClickListener: View.OnClickListener? = null private val onHeaderClickListener = View.OnClickListener { activityStarter.startActivity( Loading Loading @@ -76,12 +78,18 @@ internal class SectionHeaderNodeControllerImpl @Inject constructor( parent.addView(inflated, oldPos) } _view = inflated _view?.setClearSectionButtonEnabled(clearAllButtonEnabled) } override val headerView: SectionHeaderView? get() = _view override fun setOnClearAllClickListener(listener: View.OnClickListener) { override fun setClearSectionEnabled(enabled: Boolean) { clearAllButtonEnabled = enabled _view?.setClearSectionButtonEnabled(enabled) } override fun setOnClearSectionClickListener(listener: View.OnClickListener) { clearAllClickListener = listener _view?.setOnClearAllClickListener(listener) } Loading