Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +14 −4 Original line number Original line Diff line number Diff line Loading @@ -175,6 +175,10 @@ public final class NotificationEntry extends ListEntry { public boolean mRemoteEditImeAnimatingAway; public boolean mRemoteEditImeAnimatingAway; public boolean mRemoteEditImeVisible; public boolean mRemoteEditImeVisible; private boolean mExpandAnimationRunning; private boolean mExpandAnimationRunning; /** * Flag to determine if the entry is blockable by DnD filters */ private boolean mBlockable; /** /** * @param sbn the StatusBarNotification from system server * @param sbn the StatusBarNotification from system server Loading Loading @@ -253,6 +257,7 @@ public final class NotificationEntry extends ListEntry { } } mRanking = ranking.withAudiblyAlertedInfo(mRanking); mRanking = ranking.withAudiblyAlertedInfo(mRanking); updateIsBlockable(); } } /* /* Loading Loading @@ -781,15 +786,20 @@ public final class NotificationEntry extends ListEntry { * or is not in an allowList). * or is not in an allowList). */ */ public boolean isBlockable() { public boolean isBlockable() { return mBlockable; } private void updateIsBlockable() { if (getChannel() == null) { if (getChannel() == null) { return false; mBlockable = false; return; } } if (getChannel().isImportanceLockedByCriticalDeviceFunction() if (getChannel().isImportanceLockedByCriticalDeviceFunction() && !getChannel().isBlockable()) { && !getChannel().isBlockable()) { return false; mBlockable = false; return; } } mBlockable = true; return true; } } private boolean shouldSuppressVisualEffect(int effect) { private boolean shouldSuppressVisualEffect(int effect) { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryTest.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -108,6 +108,7 @@ public class NotificationEntryTest extends SysuiTestCase { @Test @Test public void testBlockableEntryWhenCritical() { public void testBlockableEntryWhenCritical() { doReturn(true).when(mChannel).isBlockable(); doReturn(true).when(mChannel).isBlockable(); mEntry.setRanking(mEntry.getRanking()); assertTrue(mEntry.isBlockable()); assertTrue(mEntry.isBlockable()); } } Loading @@ -117,6 +118,7 @@ public class NotificationEntryTest extends SysuiTestCase { public void testBlockableEntryWhenCriticalAndChannelNotBlockable() { public void testBlockableEntryWhenCriticalAndChannelNotBlockable() { doReturn(true).when(mChannel).isBlockable(); doReturn(true).when(mChannel).isBlockable(); doReturn(true).when(mChannel).isImportanceLockedByCriticalDeviceFunction(); doReturn(true).when(mChannel).isImportanceLockedByCriticalDeviceFunction(); mEntry.setRanking(mEntry.getRanking()); assertTrue(mEntry.isBlockable()); assertTrue(mEntry.isBlockable()); } } Loading @@ -125,6 +127,7 @@ public class NotificationEntryTest extends SysuiTestCase { public void testNonBlockableEntryWhenCriticalAndChannelNotBlockable() { public void testNonBlockableEntryWhenCriticalAndChannelNotBlockable() { doReturn(false).when(mChannel).isBlockable(); doReturn(false).when(mChannel).isBlockable(); doReturn(true).when(mChannel).isImportanceLockedByCriticalDeviceFunction(); doReturn(true).when(mChannel).isImportanceLockedByCriticalDeviceFunction(); mEntry.setRanking(mEntry.getRanking()); assertFalse(mEntry.isBlockable()); assertFalse(mEntry.isBlockable()); } } Loading Loading @@ -164,6 +167,9 @@ public class NotificationEntryTest extends SysuiTestCase { doReturn(true).when(mChannel).isImportanceLockedByCriticalDeviceFunction(); doReturn(true).when(mChannel).isImportanceLockedByCriticalDeviceFunction(); doReturn(false).when(mChannel).isBlockable(); doReturn(false).when(mChannel).isBlockable(); mEntry.setRanking(mEntry.getRanking()); assertFalse(mEntry.isBlockable()); assertTrue(mEntry.isExemptFromDndVisualSuppression()); assertTrue(mEntry.isExemptFromDndVisualSuppression()); assertFalse(mEntry.shouldSuppressAmbient()); assertFalse(mEntry.shouldSuppressAmbient()); } } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +14 −4 Original line number Original line Diff line number Diff line Loading @@ -175,6 +175,10 @@ public final class NotificationEntry extends ListEntry { public boolean mRemoteEditImeAnimatingAway; public boolean mRemoteEditImeAnimatingAway; public boolean mRemoteEditImeVisible; public boolean mRemoteEditImeVisible; private boolean mExpandAnimationRunning; private boolean mExpandAnimationRunning; /** * Flag to determine if the entry is blockable by DnD filters */ private boolean mBlockable; /** /** * @param sbn the StatusBarNotification from system server * @param sbn the StatusBarNotification from system server Loading Loading @@ -253,6 +257,7 @@ public final class NotificationEntry extends ListEntry { } } mRanking = ranking.withAudiblyAlertedInfo(mRanking); mRanking = ranking.withAudiblyAlertedInfo(mRanking); updateIsBlockable(); } } /* /* Loading Loading @@ -781,15 +786,20 @@ public final class NotificationEntry extends ListEntry { * or is not in an allowList). * or is not in an allowList). */ */ public boolean isBlockable() { public boolean isBlockable() { return mBlockable; } private void updateIsBlockable() { if (getChannel() == null) { if (getChannel() == null) { return false; mBlockable = false; return; } } if (getChannel().isImportanceLockedByCriticalDeviceFunction() if (getChannel().isImportanceLockedByCriticalDeviceFunction() && !getChannel().isBlockable()) { && !getChannel().isBlockable()) { return false; mBlockable = false; return; } } mBlockable = true; return true; } } private boolean shouldSuppressVisualEffect(int effect) { private boolean shouldSuppressVisualEffect(int effect) { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryTest.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -108,6 +108,7 @@ public class NotificationEntryTest extends SysuiTestCase { @Test @Test public void testBlockableEntryWhenCritical() { public void testBlockableEntryWhenCritical() { doReturn(true).when(mChannel).isBlockable(); doReturn(true).when(mChannel).isBlockable(); mEntry.setRanking(mEntry.getRanking()); assertTrue(mEntry.isBlockable()); assertTrue(mEntry.isBlockable()); } } Loading @@ -117,6 +118,7 @@ public class NotificationEntryTest extends SysuiTestCase { public void testBlockableEntryWhenCriticalAndChannelNotBlockable() { public void testBlockableEntryWhenCriticalAndChannelNotBlockable() { doReturn(true).when(mChannel).isBlockable(); doReturn(true).when(mChannel).isBlockable(); doReturn(true).when(mChannel).isImportanceLockedByCriticalDeviceFunction(); doReturn(true).when(mChannel).isImportanceLockedByCriticalDeviceFunction(); mEntry.setRanking(mEntry.getRanking()); assertTrue(mEntry.isBlockable()); assertTrue(mEntry.isBlockable()); } } Loading @@ -125,6 +127,7 @@ public class NotificationEntryTest extends SysuiTestCase { public void testNonBlockableEntryWhenCriticalAndChannelNotBlockable() { public void testNonBlockableEntryWhenCriticalAndChannelNotBlockable() { doReturn(false).when(mChannel).isBlockable(); doReturn(false).when(mChannel).isBlockable(); doReturn(true).when(mChannel).isImportanceLockedByCriticalDeviceFunction(); doReturn(true).when(mChannel).isImportanceLockedByCriticalDeviceFunction(); mEntry.setRanking(mEntry.getRanking()); assertFalse(mEntry.isBlockable()); assertFalse(mEntry.isBlockable()); } } Loading Loading @@ -164,6 +167,9 @@ public class NotificationEntryTest extends SysuiTestCase { doReturn(true).when(mChannel).isImportanceLockedByCriticalDeviceFunction(); doReturn(true).when(mChannel).isImportanceLockedByCriticalDeviceFunction(); doReturn(false).when(mChannel).isBlockable(); doReturn(false).when(mChannel).isBlockable(); mEntry.setRanking(mEntry.getRanking()); assertFalse(mEntry.isBlockable()); assertTrue(mEntry.isExemptFromDndVisualSuppression()); assertTrue(mEntry.isExemptFromDndVisualSuppression()); assertFalse(mEntry.shouldSuppressAmbient()); assertFalse(mEntry.shouldSuppressAmbient()); } } Loading