Merge "New pipeline: Separate stability rules for group pruning from group changing" into tm-dev am: baafc8b1ea am: e720bca72e am: 65f8d05b7b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18030065 Change-Id: I32304ea892528ac97348b6d79e26a20ff043f013 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -749,7 +749,7 @@ public class ShadeListBuilder implements Dumpable {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (group.wasAttachedInPreviousPass()
|
if (group.wasAttachedInPreviousPass()
|
||||||
&& !getStabilityManager().isGroupChangeAllowed(group.getSummary())) {
|
&& !getStabilityManager().isGroupPruneAllowed(group)) {
|
||||||
checkState(!children.isEmpty(), "empty group should have been pruned");
|
checkState(!children.isEmpty(), "empty group should have been pruned");
|
||||||
// This group was previously attached and group changes aren't
|
// This group was previously attached and group changes aren't
|
||||||
// allowed; keep it around until group changes are allowed again.
|
// allowed; keep it around until group changes are allowed again.
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import com.android.systemui.dagger.SysUISingleton;
|
|||||||
import com.android.systemui.dump.DumpManager;
|
import com.android.systemui.dump.DumpManager;
|
||||||
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
|
import com.android.systemui.statusbar.notification.collection.GroupEntry;
|
||||||
import com.android.systemui.statusbar.notification.collection.ListEntry;
|
import com.android.systemui.statusbar.notification.collection.ListEntry;
|
||||||
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
|
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
|
||||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
||||||
@@ -138,6 +139,13 @@ public class VisualStabilityCoordinator implements Coordinator, Dumpable,
|
|||||||
return isGroupChangeAllowedForEntry;
|
return isGroupChangeAllowedForEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGroupPruneAllowed(@NonNull GroupEntry entry) {
|
||||||
|
final boolean isGroupPruneAllowedForEntry = mReorderingAllowed;
|
||||||
|
mIsSuppressingGroupChange |= !isGroupPruneAllowedForEntry;
|
||||||
|
return isGroupPruneAllowedForEntry;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSectionChangeAllowed(@NonNull NotificationEntry entry) {
|
public boolean isSectionChangeAllowed(@NonNull NotificationEntry entry) {
|
||||||
final boolean isSectionChangeAllowedForEntry =
|
final boolean isSectionChangeAllowedForEntry =
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.android.systemui.statusbar.notification.collection.listbuilder.pluggable
|
package com.android.systemui.statusbar.notification.collection.listbuilder.pluggable
|
||||||
|
|
||||||
|
import com.android.systemui.statusbar.notification.collection.GroupEntry
|
||||||
import com.android.systemui.statusbar.notification.collection.ListEntry
|
import com.android.systemui.statusbar.notification.collection.ListEntry
|
||||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry
|
import com.android.systemui.statusbar.notification.collection.NotificationEntry
|
||||||
|
|
||||||
@@ -51,6 +52,14 @@ abstract class NotifStabilityManager protected constructor(name: String) :
|
|||||||
*/
|
*/
|
||||||
abstract fun isGroupChangeAllowed(entry: NotificationEntry): Boolean
|
abstract fun isGroupChangeAllowed(entry: NotificationEntry): Boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this notification group can be pruned for not having enough children.
|
||||||
|
* Per iteration of the notification pipeline, locally stores this information until the next
|
||||||
|
* run of the pipeline. When this method returns false, it's expected that a group prune for
|
||||||
|
* this entry is being suppressed.
|
||||||
|
*/
|
||||||
|
abstract fun isGroupPruneAllowed(entry: GroupEntry): Boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this notification entry can currently change sections.
|
* Returns whether this notification entry can currently change sections.
|
||||||
* Per iteration of the notification pipeline, locally stores this information until the next
|
* Per iteration of the notification pipeline, locally stores this information until the next
|
||||||
@@ -89,6 +98,7 @@ object DefaultNotifStabilityManager : NotifStabilityManager("DefaultNotifStabili
|
|||||||
override fun isPipelineRunAllowed(): Boolean = true
|
override fun isPipelineRunAllowed(): Boolean = true
|
||||||
override fun onBeginRun() {}
|
override fun onBeginRun() {}
|
||||||
override fun isGroupChangeAllowed(entry: NotificationEntry): Boolean = true
|
override fun isGroupChangeAllowed(entry: NotificationEntry): Boolean = true
|
||||||
|
override fun isGroupPruneAllowed(entry: GroupEntry): Boolean = true
|
||||||
override fun isSectionChangeAllowed(entry: NotificationEntry): Boolean = true
|
override fun isSectionChangeAllowed(entry: NotificationEntry): Boolean = true
|
||||||
override fun isEntryReorderingAllowed(entry: ListEntry): Boolean = true
|
override fun isEntryReorderingAllowed(entry: ListEntry): Boolean = true
|
||||||
override fun isEveryChangeAllowed(): Boolean = true
|
override fun isEveryChangeAllowed(): Boolean = true
|
||||||
|
|||||||
@@ -1439,14 +1439,16 @@ public class ShadeListBuilderTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// WHEN a new child is added and the old one gets filtered while group changes are disabled.
|
// WHEN a new child is added and the old one gets filtered while group changes are disabled.
|
||||||
mStabilityManager.setAllowGroupChanges(false);
|
mStabilityManager.setAllowGroupChanges(false);
|
||||||
|
mStabilityManager.setAllowGroupPruning(false);
|
||||||
mFinalizeFilter.mIndicesToFilter.add(1);
|
mFinalizeFilter.mIndicesToFilter.add(1);
|
||||||
addGroupChild(2, PACKAGE_1, GROUP_1);
|
addGroupChild(2, PACKAGE_1, GROUP_1);
|
||||||
|
|
||||||
dispatchBuild();
|
dispatchBuild();
|
||||||
|
|
||||||
// THEN the new child should be shown without a group
|
// THEN the new child should be shown without a group
|
||||||
|
// (Note that this is the same as the expected result if there were no stability rules.)
|
||||||
verifyBuiltList(
|
verifyBuiltList(
|
||||||
notif(2) // previously promoted child
|
notif(2) // new child
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2250,6 +2252,7 @@ public class ShadeListBuilderTest extends SysuiTestCase {
|
|||||||
private static class TestableStabilityManager extends NotifStabilityManager {
|
private static class TestableStabilityManager extends NotifStabilityManager {
|
||||||
boolean mAllowPipelineRun = true;
|
boolean mAllowPipelineRun = true;
|
||||||
boolean mAllowGroupChanges = true;
|
boolean mAllowGroupChanges = true;
|
||||||
|
boolean mAllowGroupPruning = true;
|
||||||
boolean mAllowSectionChanges = true;
|
boolean mAllowSectionChanges = true;
|
||||||
boolean mAllowEntryReodering = true;
|
boolean mAllowEntryReodering = true;
|
||||||
|
|
||||||
@@ -2262,6 +2265,11 @@ public class ShadeListBuilderTest extends SysuiTestCase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TestableStabilityManager setAllowGroupPruning(boolean allowGroupPruning) {
|
||||||
|
mAllowGroupPruning = allowGroupPruning;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
TestableStabilityManager setAllowSectionChanges(boolean allowSectionChanges) {
|
TestableStabilityManager setAllowSectionChanges(boolean allowSectionChanges) {
|
||||||
mAllowSectionChanges = allowSectionChanges;
|
mAllowSectionChanges = allowSectionChanges;
|
||||||
return this;
|
return this;
|
||||||
@@ -2291,6 +2299,11 @@ public class ShadeListBuilderTest extends SysuiTestCase {
|
|||||||
return mAllowGroupChanges;
|
return mAllowGroupChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGroupPruneAllowed(@NonNull GroupEntry entry) {
|
||||||
|
return mAllowGroupPruning;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSectionChangeAllowed(@NonNull NotificationEntry entry) {
|
public boolean isSectionChangeAllowed(@NonNull NotificationEntry entry) {
|
||||||
return mAllowSectionChanges;
|
return mAllowSectionChanges;
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ import com.android.systemui.SysuiTestCase;
|
|||||||
import com.android.systemui.dump.DumpManager;
|
import com.android.systemui.dump.DumpManager;
|
||||||
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
|
import com.android.systemui.statusbar.notification.collection.GroupEntry;
|
||||||
|
import com.android.systemui.statusbar.notification.collection.GroupEntryBuilder;
|
||||||
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
|
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
|
||||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
||||||
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder;
|
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder;
|
||||||
@@ -83,6 +85,7 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase {
|
|||||||
private NotifPanelEvents.Listener mNotifPanelEventsCallback;
|
private NotifPanelEvents.Listener mNotifPanelEventsCallback;
|
||||||
private NotifStabilityManager mNotifStabilityManager;
|
private NotifStabilityManager mNotifStabilityManager;
|
||||||
private NotificationEntry mEntry;
|
private NotificationEntry mEntry;
|
||||||
|
private GroupEntry mGroupEntry;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
@@ -117,6 +120,10 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase {
|
|||||||
.setPkg("testPkg1")
|
.setPkg("testPkg1")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
mGroupEntry = new GroupEntryBuilder()
|
||||||
|
.setSummary(mEntry)
|
||||||
|
.build();
|
||||||
|
|
||||||
when(mHeadsUpManager.isAlerting(mEntry.getKey())).thenReturn(false);
|
when(mHeadsUpManager.isAlerting(mEntry.getKey())).thenReturn(false);
|
||||||
|
|
||||||
// Whenever we invalidate, the pipeline runs again, so we invalidate the state
|
// Whenever we invalidate, the pipeline runs again, so we invalidate the state
|
||||||
@@ -135,6 +142,7 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// THEN group changes are allowed
|
// THEN group changes are allowed
|
||||||
assertTrue(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
assertTrue(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
||||||
|
assertTrue(mNotifStabilityManager.isGroupPruneAllowed(mGroupEntry));
|
||||||
|
|
||||||
// THEN section changes are allowed
|
// THEN section changes are allowed
|
||||||
assertTrue(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
assertTrue(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
||||||
@@ -149,6 +157,7 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// THEN group changes are allowed
|
// THEN group changes are allowed
|
||||||
assertTrue(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
assertTrue(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
||||||
|
assertTrue(mNotifStabilityManager.isGroupPruneAllowed(mGroupEntry));
|
||||||
|
|
||||||
// THEN section changes are allowed
|
// THEN section changes are allowed
|
||||||
assertTrue(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
assertTrue(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
||||||
@@ -163,6 +172,7 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// THEN group changes are NOT allowed
|
// THEN group changes are NOT allowed
|
||||||
assertFalse(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
assertFalse(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
||||||
|
assertFalse(mNotifStabilityManager.isGroupPruneAllowed(mGroupEntry));
|
||||||
|
|
||||||
// THEN section changes are NOT allowed
|
// THEN section changes are NOT allowed
|
||||||
assertFalse(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
assertFalse(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
||||||
@@ -176,6 +186,7 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// THEN group changes are NOT allowed
|
// THEN group changes are NOT allowed
|
||||||
assertFalse(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
assertFalse(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
||||||
|
assertFalse(mNotifStabilityManager.isGroupPruneAllowed(mGroupEntry));
|
||||||
|
|
||||||
// THEN section changes are NOT allowed
|
// THEN section changes are NOT allowed
|
||||||
assertFalse(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
assertFalse(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
||||||
@@ -190,6 +201,7 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// THEN group changes are NOT allowed
|
// THEN group changes are NOT allowed
|
||||||
assertFalse(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
assertFalse(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
||||||
|
assertFalse(mNotifStabilityManager.isGroupPruneAllowed(mGroupEntry));
|
||||||
|
|
||||||
// THEN section changes are NOT allowed
|
// THEN section changes are NOT allowed
|
||||||
assertFalse(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
assertFalse(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
||||||
@@ -208,6 +220,7 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// THEN group changes aren't allowed
|
// THEN group changes aren't allowed
|
||||||
assertFalse(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
assertFalse(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
||||||
|
assertFalse(mNotifStabilityManager.isGroupPruneAllowed(mGroupEntry));
|
||||||
|
|
||||||
// THEN section changes are allowed for this notification but not other notifications
|
// THEN section changes are allowed for this notification but not other notifications
|
||||||
assertTrue(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
assertTrue(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
||||||
@@ -321,6 +334,7 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase {
|
|||||||
setPanelExpanded(true);
|
setPanelExpanded(true);
|
||||||
|
|
||||||
assertFalse(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
assertFalse(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
||||||
|
assertFalse(mNotifStabilityManager.isGroupPruneAllowed(mGroupEntry));
|
||||||
|
|
||||||
// WHEN the panel isn't expanded anymore
|
// WHEN the panel isn't expanded anymore
|
||||||
setPanelExpanded(false);
|
setPanelExpanded(false);
|
||||||
@@ -422,6 +436,7 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase {
|
|||||||
setPanelExpanded(true);
|
setPanelExpanded(true);
|
||||||
setPulsing(true);
|
setPulsing(true);
|
||||||
assertFalse(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
assertFalse(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
||||||
|
assertFalse(mNotifStabilityManager.isGroupPruneAllowed(mGroupEntry));
|
||||||
assertFalse(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
assertFalse(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
||||||
|
|
||||||
// GIVEN mEntry is a HUN
|
// GIVEN mEntry is a HUN
|
||||||
@@ -431,6 +446,8 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase {
|
|||||||
assertTrue(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
assertTrue(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
|
||||||
assertTrue(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
assertTrue(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
|
||||||
|
|
||||||
|
// BUT pruning the group for which this is the summary would still NOT be allowed.
|
||||||
|
assertFalse(mNotifStabilityManager.isGroupPruneAllowed(mGroupEntry));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setActivityLaunching(boolean activityLaunching) {
|
private void setActivityLaunching(boolean activityLaunching) {
|
||||||
|
|||||||
Reference in New Issue
Block a user