Remove NotificationBlockingHelper
Test: manual, atest Change-Id: I807ff02212a5a4c9cffd5d19f79a70f5a980e2bb
This commit is contained in:
@@ -80,7 +80,6 @@ import com.android.systemui.statusbar.notification.NotificationFilter;
|
||||
import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy;
|
||||
import com.android.systemui.statusbar.notification.collection.legacy.VisualStabilityManager;
|
||||
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationBlockingHelperManager;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
|
||||
import com.android.systemui.statusbar.phone.AutoHideController;
|
||||
import com.android.systemui.statusbar.phone.DozeParameters;
|
||||
@@ -280,7 +279,6 @@ public class Dependency {
|
||||
@Inject Lazy<VisualStabilityManager> mVisualStabilityManager;
|
||||
@Inject Lazy<NotificationGutsManager> mNotificationGutsManager;
|
||||
@Inject Lazy<NotificationMediaManager> mNotificationMediaManager;
|
||||
@Inject Lazy<NotificationBlockingHelperManager> mNotificationBlockingHelperManager;
|
||||
@Inject Lazy<NotificationRemoteInputManager> mNotificationRemoteInputManager;
|
||||
@Inject Lazy<SmartReplyConstants> mSmartReplyConstants;
|
||||
@Inject Lazy<NotificationListener> mNotificationListener;
|
||||
@@ -473,8 +471,6 @@ public class Dependency {
|
||||
mNotificationGroupAlertTransferHelper::get);
|
||||
mProviders.put(NotificationMediaManager.class, mNotificationMediaManager::get);
|
||||
mProviders.put(NotificationGutsManager.class, mNotificationGutsManager::get);
|
||||
mProviders.put(NotificationBlockingHelperManager.class,
|
||||
mNotificationBlockingHelperManager::get);
|
||||
mProviders.put(NotificationRemoteInputManager.class,
|
||||
mNotificationRemoteInputManager::get);
|
||||
mProviders.put(SmartReplyConstants.class, mSmartReplyConstants::get);
|
||||
|
||||
@@ -23,7 +23,6 @@ import android.content.pm.ShortcutManager;
|
||||
import android.os.Handler;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.UiEventLogger;
|
||||
import com.android.internal.statusbar.IStatusBarService;
|
||||
import com.android.systemui.R;
|
||||
@@ -68,7 +67,6 @@ import com.android.systemui.statusbar.notification.logging.NotificationLogger;
|
||||
import com.android.systemui.statusbar.notification.logging.NotificationPanelLogger;
|
||||
import com.android.systemui.statusbar.notification.logging.NotificationPanelLoggerImpl;
|
||||
import com.android.systemui.statusbar.notification.row.ChannelEditorDialogController;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationBlockingHelperManager;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
|
||||
import com.android.systemui.statusbar.notification.row.OnUserInteractionCallback;
|
||||
import com.android.systemui.statusbar.notification.row.PriorityOnboardingDialogController;
|
||||
@@ -198,20 +196,6 @@ public interface NotificationsModule {
|
||||
return new NotificationPanelLoggerImpl();
|
||||
}
|
||||
|
||||
/** Provides an instance of {@link NotificationBlockingHelperManager} */
|
||||
@SysUISingleton
|
||||
@Provides
|
||||
static NotificationBlockingHelperManager provideNotificationBlockingHelperManager(
|
||||
Context context,
|
||||
NotificationGutsManager notificationGutsManager,
|
||||
NotificationEntryManager notificationEntryManager,
|
||||
MetricsLogger metricsLogger,
|
||||
GroupMembershipManager groupMembershipManager) {
|
||||
return new NotificationBlockingHelperManager(
|
||||
context, notificationGutsManager, notificationEntryManager, metricsLogger,
|
||||
groupMembershipManager);
|
||||
}
|
||||
|
||||
/** Provides an instance of {@link GroupMembershipManager} */
|
||||
@SysUISingleton
|
||||
@Provides
|
||||
|
||||
@@ -500,10 +500,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
||||
* or is in a whitelist).
|
||||
*/
|
||||
public boolean getIsNonblockable() {
|
||||
boolean isNonblockable = Dependency.get(NotificationBlockingHelperManager.class)
|
||||
.isNonblockable(mEntry.getSbn().getPackageName(),
|
||||
mEntry.getChannel().getId());
|
||||
|
||||
// If the SystemNotifAsyncTask hasn't finished running or retrieved a value, we'll try once
|
||||
// again, but in-place on the main thread this time. This should rarely ever get called.
|
||||
if (mEntry != null && mEntry.mIsSystemNotification == null) {
|
||||
@@ -514,13 +510,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
||||
mEntry.mIsSystemNotification = isSystemNotification(mContext, mEntry.getSbn());
|
||||
}
|
||||
|
||||
isNonblockable |= mEntry.getChannel().isImportanceLockedByOEM();
|
||||
isNonblockable |= mEntry.getChannel().isImportanceLockedByCriticalDeviceFunction();
|
||||
boolean isNonblockable = mEntry.getChannel().isImportanceLockedByOEM()
|
||||
|| mEntry.getChannel().isImportanceLockedByCriticalDeviceFunction();
|
||||
|
||||
if (!isNonblockable && mEntry != null && mEntry.mIsSystemNotification != null) {
|
||||
if (mEntry.mIsSystemNotification) {
|
||||
if (mEntry.getChannel() != null
|
||||
&& !mEntry.getChannel().isBlockable()) {
|
||||
if (mEntry.getChannel() != null && !mEntry.getChannel().isBlockable()) {
|
||||
isNonblockable = true;
|
||||
}
|
||||
}
|
||||
@@ -1398,26 +1393,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismisses the notification with the option of showing the blocking helper in-place if we have
|
||||
* a negative user sentiment.
|
||||
* Dismisses the notification.
|
||||
*
|
||||
* @param fromAccessibility whether this dismiss is coming from an accessibility action
|
||||
* @return whether a blocking helper is shown in this row
|
||||
*/
|
||||
public boolean performDismissWithBlockingHelper(boolean fromAccessibility) {
|
||||
NotificationBlockingHelperManager manager =
|
||||
Dependency.get(NotificationBlockingHelperManager.class);
|
||||
boolean isBlockingHelperShown = manager.perhapsShowBlockingHelper(this, mMenuRow);
|
||||
|
||||
Dependency.get(MetricsLogger.class).count(NotificationCounters.NOTIFICATION_DISMISSED, 1);
|
||||
|
||||
// Continue with dismiss since we don't want the blocking helper to be directly associated
|
||||
// with a certain notification.
|
||||
performDismiss(fromAccessibility);
|
||||
return isBlockingHelperShown;
|
||||
}
|
||||
|
||||
public void performDismiss(boolean fromAccessibility) {
|
||||
Dependency.get(MetricsLogger.class).count(NotificationCounters.NOTIFICATION_DISMISSED, 1);
|
||||
dismiss(fromAccessibility);
|
||||
if (mEntry.isClearable()) {
|
||||
if (mOnUserInteractionCallback != null) {
|
||||
@@ -2983,7 +2964,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
||||
}
|
||||
switch (action) {
|
||||
case AccessibilityNodeInfo.ACTION_DISMISS:
|
||||
performDismissWithBlockingHelper(true /* fromAccessibility */);
|
||||
performDismiss(true /* fromAccessibility */);
|
||||
return true;
|
||||
case AccessibilityNodeInfo.ACTION_COLLAPSE:
|
||||
case AccessibilityNodeInfo.ACTION_EXPAND:
|
||||
|
||||
@@ -295,10 +295,6 @@ public class NotificationGuts extends FrameLayout {
|
||||
*/
|
||||
private void closeControls(int x, int y, boolean save, boolean force) {
|
||||
// First try to dismiss any blocking helper.
|
||||
boolean wasBlockingHelperDismissed =
|
||||
Dependency.get(NotificationBlockingHelperManager.class)
|
||||
.dismissCurrentBlockingHelper();
|
||||
|
||||
if (getWindowToken() == null) {
|
||||
if (mClosedListener != null) {
|
||||
mClosedListener.onGutsClosed(this);
|
||||
@@ -307,10 +303,9 @@ public class NotificationGuts extends FrameLayout {
|
||||
}
|
||||
|
||||
if (mGutsContent == null
|
||||
|| !mGutsContent.handleCloseControls(save, force)
|
||||
|| wasBlockingHelperDismissed) {
|
||||
|| !mGutsContent.handleCloseControls(save, force)) {
|
||||
// We only want to do a circular reveal if we're not showing the blocking helper.
|
||||
animateClose(x, y, !wasBlockingHelperDismissed /* shouldDoCircularReveal */);
|
||||
animateClose(x, y, true /* shouldDoCircularReveal */);
|
||||
|
||||
setExposed(false, mNeedsFalsingProtection);
|
||||
if (mClosedListener != null) {
|
||||
|
||||
@@ -96,7 +96,6 @@ import com.android.systemui.statusbar.notification.row.ActivatableNotificationVi
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableView;
|
||||
import com.android.systemui.statusbar.notification.row.ForegroundServiceDungeonView;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationBlockingHelperManager;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationGuts;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationSnooze;
|
||||
@@ -156,7 +155,6 @@ public class NotificationStackScrollLayoutController {
|
||||
private final LayoutInflater mLayoutInflater;
|
||||
private final NotificationRemoteInputManager mRemoteInputManager;
|
||||
private final VisualStabilityManager mVisualStabilityManager;
|
||||
private final NotificationBlockingHelperManager mNotificationBlockingHelperManager;
|
||||
private final ShadeController mShadeController;
|
||||
private final KeyguardMediaController mKeyguardMediaController;
|
||||
private final SysuiStatusBarStateController mStatusBarStateController;
|
||||
@@ -394,8 +392,6 @@ public class NotificationStackScrollLayoutController {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isBlockingHelperShown = false;
|
||||
|
||||
mView.removeDraggedView(view);
|
||||
mView.updateContinuousShadowDrawing();
|
||||
|
||||
@@ -405,13 +401,10 @@ public class NotificationStackScrollLayoutController {
|
||||
mHeadsUpManager.addSwipedOutNotification(
|
||||
row.getEntry().getSbn().getKey());
|
||||
}
|
||||
isBlockingHelperShown =
|
||||
row.performDismissWithBlockingHelper(false /* fromAccessibility */);
|
||||
row.performDismiss(false /* fromAccessibility */);
|
||||
}
|
||||
|
||||
if (!isBlockingHelperShown) {
|
||||
mView.addSwipedOutView(view);
|
||||
}
|
||||
mView.addSwipedOutView(view);
|
||||
mFalsingManager.onNotificationDismissed();
|
||||
if (mFalsingManager.shouldEnforceBouncer()) {
|
||||
mStatusBar.executeRunnableDismissingKeyguard(
|
||||
@@ -582,7 +575,6 @@ public class NotificationStackScrollLayoutController {
|
||||
LayoutInflater layoutInflater,
|
||||
NotificationRemoteInputManager remoteInputManager,
|
||||
VisualStabilityManager visualStabilityManager,
|
||||
NotificationBlockingHelperManager notificationBlockingHelperManager,
|
||||
ShadeController shadeController) {
|
||||
mAllowLongPress = allowLongPress;
|
||||
mNotificationGutsManager = notificationGutsManager;
|
||||
@@ -628,7 +620,6 @@ public class NotificationStackScrollLayoutController {
|
||||
mLayoutInflater = layoutInflater;
|
||||
mRemoteInputManager = remoteInputManager;
|
||||
mVisualStabilityManager = visualStabilityManager;
|
||||
mNotificationBlockingHelperManager = notificationBlockingHelperManager;
|
||||
mShadeController = shadeController;
|
||||
}
|
||||
|
||||
@@ -691,10 +682,6 @@ public class NotificationStackScrollLayoutController {
|
||||
mView.addOnExpandedHeightChangedListener(mNotificationRoundnessManager::setExpanded);
|
||||
|
||||
mVisualStabilityManager.setVisibilityLocationProvider(this::isInVisibleLocation);
|
||||
// Blocking helper manager wants to know the expanded state, update as well.
|
||||
mView.addOnExpandedHeightChangedListener((height, unused) ->
|
||||
mNotificationBlockingHelperManager.setNotificationShadeExpanded(height)
|
||||
);
|
||||
|
||||
mTunerService.addTunable(
|
||||
(key, newValue) -> {
|
||||
|
||||
@@ -41,7 +41,6 @@ import com.android.systemui.dump.DumpManager;
|
||||
import com.android.systemui.plugins.FalsingManager;
|
||||
import com.android.systemui.settings.UserTracker;
|
||||
import com.android.systemui.statusbar.SmartReplyController;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationBlockingHelperManager;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@@ -110,7 +109,6 @@ public abstract class SysuiTestCase {
|
||||
// KeyguardUpdateMonitor to be created (injected).
|
||||
// TODO(b/1531701009) Clean up NotificationContentView creation to prevent this
|
||||
mDependency.injectMockDependency(SmartReplyController.class);
|
||||
mDependency.injectMockDependency(NotificationBlockingHelperManager.class);
|
||||
}
|
||||
|
||||
@After
|
||||
|
||||
@@ -54,7 +54,6 @@ import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnit;
|
||||
import org.mockito.junit.MockitoRule;
|
||||
|
||||
@@ -71,7 +70,6 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
|
||||
boolean mHeadsUpAnimatingAway = false;
|
||||
|
||||
@Rule public MockitoRule mockito = MockitoJUnit.rule();
|
||||
@Mock private NotificationBlockingHelperManager mBlockingHelperManager;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
@@ -83,9 +81,6 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
|
||||
mGroupRow = mNotificationTestHelper.createGroup();
|
||||
mGroupRow.setHeadsUpAnimatingAwayListener(
|
||||
animatingAway -> mHeadsUpAnimatingAway = animatingAway);
|
||||
mDependency.injectTestDependency(
|
||||
NotificationBlockingHelperManager.class,
|
||||
mBlockingHelperManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -256,30 +251,6 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
|
||||
Assert.assertEquals(false, mHeadsUpAnimatingAway);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPerformDismissWithBlockingHelper_falseWhenBlockingHelperIsntShown() {
|
||||
when(mBlockingHelperManager.perhapsShowBlockingHelper(
|
||||
eq(mGroupRow), any(NotificationMenuRowPlugin.class))).thenReturn(false);
|
||||
|
||||
assertFalse(
|
||||
mGroupRow.performDismissWithBlockingHelper(false /* fromAccessibility */));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPerformDismissWithBlockingHelper_doesntPerformOnGroupSummary() {
|
||||
ExpandableNotificationRow childRow = mGroupRow.getChildrenContainer().getViewAtPosition(0);
|
||||
when(mBlockingHelperManager.perhapsShowBlockingHelper(eq(childRow), any(NotificationMenuRowPlugin.class)))
|
||||
.thenReturn(true);
|
||||
|
||||
assertTrue(
|
||||
childRow.performDismissWithBlockingHelper(false /* fromAccessibility */));
|
||||
|
||||
verify(mBlockingHelperManager, times(1))
|
||||
.perhapsShowBlockingHelper(eq(childRow), any(NotificationMenuRowPlugin.class));
|
||||
verify(mBlockingHelperManager, times(0))
|
||||
.perhapsShowBlockingHelper(eq(mGroupRow), any(NotificationMenuRowPlugin.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsBlockingHelperShowing_isCorrectlyUpdated() {
|
||||
mGroupRow.setBlockingHelperShowing(true);
|
||||
|
||||
@@ -58,10 +58,8 @@ import com.android.systemui.statusbar.StatusBarState;
|
||||
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
||||
import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy;
|
||||
import com.android.systemui.statusbar.notification.collection.legacy.VisualStabilityManager;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||
import com.android.systemui.statusbar.notification.row.FooterView;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationBlockingHelperManager;
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.KeyguardBypassEnabledProvider;
|
||||
import com.android.systemui.statusbar.phone.ShadeController;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
@@ -91,7 +89,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
||||
@Rule public MockitoRule mockito = MockitoJUnit.rule();
|
||||
@Mock private StatusBar mBar;
|
||||
@Mock private SysuiStatusBarStateController mBarState;
|
||||
@Mock private NotificationBlockingHelperManager mBlockingHelperManager;
|
||||
@Mock private NotificationGroupManagerLegacy mGroupMembershipManger;
|
||||
@Mock private NotificationGroupManagerLegacy mGroupExpansionManager;
|
||||
@Mock private ExpandHelper mExpandHelper;
|
||||
@@ -120,9 +117,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
||||
1, UserHandle.USER_CURRENT);
|
||||
|
||||
// Inject dependencies before initializing the layout
|
||||
mDependency.injectTestDependency(
|
||||
NotificationBlockingHelperManager.class,
|
||||
mBlockingHelperManager);
|
||||
mDependency.injectTestDependency(SysuiStatusBarStateController.class, mBarState);
|
||||
mDependency.injectMockDependency(ShadeController.class);
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.reset;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -65,7 +64,6 @@ import com.android.systemui.statusbar.notification.collection.legacy.VisualStabi
|
||||
import com.android.systemui.statusbar.notification.collection.render.SectionHeaderController;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||
import com.android.systemui.statusbar.notification.row.ForegroundServiceDungeonView;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationBlockingHelperManager;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController.NotificationPanelEvent;
|
||||
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
|
||||
@@ -87,8 +85,6 @@ import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
* Tests for {@link NotificationStackScrollLayoutController}.
|
||||
*/
|
||||
@@ -132,7 +128,6 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
|
||||
@Mock private NotificationRemoteInputManager mRemoteInputManager;
|
||||
@Mock private RemoteInputController mRemoteInputController;
|
||||
@Mock private VisualStabilityManager mVisualStabilityManager;
|
||||
@Mock private NotificationBlockingHelperManager mNotificationBlockingHelperManager;
|
||||
@Mock private ShadeController mShadeController;
|
||||
|
||||
@Captor
|
||||
@@ -184,7 +179,6 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
|
||||
mLayoutInflater,
|
||||
mRemoteInputManager,
|
||||
mVisualStabilityManager,
|
||||
mNotificationBlockingHelperManager,
|
||||
mShadeController
|
||||
);
|
||||
|
||||
@@ -378,25 +372,6 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
|
||||
any(ForegroundServiceDungeonView.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetExpandedHeight_blockingHelperManagerReceivedCallbacks() {
|
||||
|
||||
ArgumentCaptor<BiConsumer<Float, Float>>
|
||||
onExpandedHeightChangeListenerCaptor = ArgumentCaptor.forClass(
|
||||
BiConsumer.class);
|
||||
|
||||
mController.attach(mNotificationStackScrollLayout);
|
||||
|
||||
verify(mNotificationStackScrollLayout, times(2)).addOnExpandedHeightChangedListener(
|
||||
onExpandedHeightChangeListenerCaptor.capture());
|
||||
|
||||
for (BiConsumer<Float, Float> listener :
|
||||
onExpandedHeightChangeListenerCaptor.getAllValues()) {
|
||||
listener.accept(1f, 2f);
|
||||
}
|
||||
verify(mNotificationBlockingHelperManager).setNotificationShadeExpanded(1f);
|
||||
}
|
||||
|
||||
private LogMaker logMatcher(int category, int type) {
|
||||
return argThat(new LogMatcher(category, type));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user