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

Commit 423a7a23 authored by Richard MacGregor's avatar Richard MacGregor Committed by Android (Google) Code Review
Browse files

Merge "Don't show bubble flyout during screenshare" into main

parents 629a0861 bb65b02c
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -683,6 +683,17 @@ public class BubbleController implements ConfigurationChangeListener,
        mDataRepository.removeBubblesForUser(removedUserId, parentUserId);
    }

    /** Called when sensitive notification state has changed */
    public void onSensitiveNotificationProtectionStateChanged(
            boolean sensitiveNotificationProtectionActive) {
        if (mStackView != null) {
            mStackView.onSensitiveNotificationProtectionStateChanged(
                    sensitiveNotificationProtectionActive);
            ProtoLog.d(WM_SHELL_BUBBLES, "onSensitiveNotificationProtectionStateChanged=%b",
                    sensitiveNotificationProtectionActive);
        }
    }

    /** Whether bubbles are showing in the bubble bar. */
    public boolean isShowingAsBubbleBar() {
        return canShowAsBubbleBar() && mBubbleStateListener != null;
@@ -2583,6 +2594,14 @@ public class BubbleController implements ConfigurationChangeListener,
            mMainExecutor.execute(
                    () -> BubbleController.this.onNotificationPanelExpandedChanged(expanded));
        }

        @Override
        public void onSensitiveNotificationProtectionStateChanged(
                boolean sensitiveNotificationProtectionActive) {
            mMainExecutor.execute(
                    () -> BubbleController.this.onSensitiveNotificationProtectionStateChanged(
                            sensitiveNotificationProtectionActive));
        }
    }

    /**
+11 −0
Original line number Diff line number Diff line
@@ -291,6 +291,11 @@ public class BubbleStackView extends FrameLayout
     */
    private boolean mRemovingLastBubbleWhileExpanded = false;

    /**
     * Whether sensitive notification protection should disable flyout
     */
    private boolean mSensitiveNotificationProtectionActive = false;

    /** Animator for animating the expanded view's alpha (including the TaskView inside it). */
    private final ValueAnimator mExpandedViewAlphaAnimator = ValueAnimator.ofFloat(0f, 1f);

@@ -2199,6 +2204,11 @@ public class BubbleStackView extends FrameLayout
        }
    }

    void onSensitiveNotificationProtectionStateChanged(
            boolean sensitiveNotificationProtectionActive) {
        mSensitiveNotificationProtectionActive = sensitiveNotificationProtectionActive;
    }

    /**
     * Asks the BubbleController to hide the IME from anywhere, whether it's focused on Bubbles or
     * not.
@@ -2842,6 +2852,7 @@ public class BubbleStackView extends FrameLayout
                || isExpanded()
                || mIsExpansionAnimating
                || mIsGestureInProgress
                || mSensitiveNotificationProtectionActive
                || mBubbleToExpandAfterFlyoutCollapse != null
                || bubbleView == null) {
            if (bubbleView != null && mFlyout.getVisibility() != VISIBLE) {
+10 −0
Original line number Diff line number Diff line
@@ -285,6 +285,16 @@ public interface Bubbles {
     */
    void onUserRemoved(int removedUserId);

    /**
     * Called when the Sensitive notification protection state has changed, such as when media
     * projection starts and stops.
     *
     * @param sensitiveNotificationProtectionActive {@code true} if notifications should be
     *     protected
     */
    void onSensitiveNotificationProtectionStateChanged(
            boolean sensitiveNotificationProtectionActive);

    /**
     * A listener to be notified of bubble state changes, used by launcher to render bubbles in
     * its process.
+3 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ import com.android.systemui.statusbar.pipeline.dagger.StatusBarPipelineModule;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.PolicyModule;
import com.android.systemui.statusbar.policy.SensitiveNotificationProtectionController;
import com.android.systemui.statusbar.policy.ZenModeController;
import com.android.systemui.statusbar.policy.dagger.SmartRepliesInflationModule;
import com.android.systemui.statusbar.policy.dagger.StatusBarPolicyModule;
@@ -358,6 +359,7 @@ public abstract class SystemUIModule {
            VisualInterruptionDecisionProvider visualInterruptionDecisionProvider,
            ZenModeController zenModeController,
            NotificationLockscreenUserManager notifUserManager,
            SensitiveNotificationProtectionController sensitiveNotificationProtectionController,
            CommonNotifCollection notifCollection,
            NotifPipeline notifPipeline,
            SysUiState sysUiState,
@@ -376,6 +378,7 @@ public abstract class SystemUIModule {
                visualInterruptionDecisionProvider,
                zenModeController,
                notifUserManager,
                sensitiveNotificationProtectionController,
                notifCollection,
                notifPipeline,
                sysUiState,
+24 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static android.service.notification.NotificationListenerService.REASON_GR
import static android.service.notification.NotificationStats.DISMISSAL_BUBBLE;
import static android.service.notification.NotificationStats.DISMISS_SENTIMENT_NEUTRAL;

import static com.android.server.notification.Flags.screenshareNotificationHiding;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;

@@ -69,6 +70,7 @@ import com.android.systemui.statusbar.notification.collection.render.Notificatio
import com.android.systemui.statusbar.notification.interruption.VisualInterruptionDecisionProvider;
import com.android.systemui.statusbar.phone.StatusBarWindowCallback;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.SensitiveNotificationProtectionController;
import com.android.systemui.statusbar.policy.ZenModeController;
import com.android.wm.shell.bubbles.Bubble;
import com.android.wm.shell.bubbles.BubbleEntry;
@@ -102,6 +104,7 @@ public class BubblesManager {
    private final NotificationVisibilityProvider mVisibilityProvider;
    private final VisualInterruptionDecisionProvider mVisualInterruptionDecisionProvider;
    private final NotificationLockscreenUserManager mNotifUserManager;
    private final SensitiveNotificationProtectionController mSensitiveNotifProtectionController;
    private final CommonNotifCollection mCommonNotifCollection;
    private final NotifPipeline mNotifPipeline;
    private final NotifPipelineFlags mNotifPipelineFlags;
@@ -111,6 +114,7 @@ public class BubblesManager {
    // TODO (b/145659174): allow for multiple callbacks to support the "shadow" new notif pipeline
    private final List<NotifCallback> mCallbacks = new ArrayList<>();
    private final StatusBarWindowCallback mStatusBarWindowCallback;
    private final Runnable mSensitiveStateChangedListener;
    private boolean mPanelExpanded;

    /**
@@ -130,6 +134,7 @@ public class BubblesManager {
            VisualInterruptionDecisionProvider visualInterruptionDecisionProvider,
            ZenModeController zenModeController,
            NotificationLockscreenUserManager notifUserManager,
            SensitiveNotificationProtectionController sensitiveNotificationProtectionController,
            CommonNotifCollection notifCollection,
            NotifPipeline notifPipeline,
            SysUiState sysUiState,
@@ -149,6 +154,7 @@ public class BubblesManager {
                    visualInterruptionDecisionProvider,
                    zenModeController,
                    notifUserManager,
                    sensitiveNotificationProtectionController,
                    notifCollection,
                    notifPipeline,
                    sysUiState,
@@ -173,6 +179,7 @@ public class BubblesManager {
            VisualInterruptionDecisionProvider visualInterruptionDecisionProvider,
            ZenModeController zenModeController,
            NotificationLockscreenUserManager notifUserManager,
            SensitiveNotificationProtectionController sensitiveNotificationProtectionController,
            CommonNotifCollection notifCollection,
            NotifPipeline notifPipeline,
            SysUiState sysUiState,
@@ -188,6 +195,7 @@ public class BubblesManager {
        mVisibilityProvider = visibilityProvider;
        mVisualInterruptionDecisionProvider = visualInterruptionDecisionProvider;
        mNotifUserManager = notifUserManager;
        mSensitiveNotifProtectionController = sensitiveNotificationProtectionController;
        mCommonNotifCollection = notifCollection;
        mNotifPipeline = notifPipeline;
        mNotifPipelineFlags = notifPipelineFlags;
@@ -251,6 +259,22 @@ public class BubblesManager {
                };
        notificationShadeWindowController.registerCallback(mStatusBarWindowCallback);

        mSensitiveStateChangedListener = new Runnable() {
            @Override
            public void run() {
                if (!screenshareNotificationHiding()) {
                    return;
                }
                bubbles.onSensitiveNotificationProtectionStateChanged(
                        mSensitiveNotifProtectionController.isSensitiveStateActive());
            }
        };

        if (screenshareNotificationHiding()) {
            mSensitiveNotifProtectionController
                    .registerSensitiveStateListener(mSensitiveStateChangedListener);
        }

        mSysuiProxy = new Bubbles.SysuiProxy() {
            @Override
            public void isNotificationPanelExpand(Consumer<Boolean> callback) {
Loading