Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abeff85d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove NotificationBlockingHelper"

parents e13b47cf e87e3fd2
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -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);
+0 −16
Original line number Diff line number Diff line
@@ -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
+6 −25
Original line number Diff line number Diff line
@@ -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:
+2 −7
Original line number Diff line number Diff line
@@ -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) {
+2 −15
Original line number Diff line number Diff line
@@ -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);
                    }
                    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) -> {
Loading